Skip to content

Commit

Permalink
✨ Type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
luukdv committed Oct 25, 2020
1 parent 68a8258 commit 3c2325c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
cypress
dist
node_modules
src/color.js
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@
"types": "dist/color.d.ts",
"sideEffects": false,
"scripts": {
"build:browser": "rollup src/index.js -f iife -o dist/color.js -n colorjs --no-esModule -p terser -p \"babel={presets:['@babel/preset-env']}\"",
"build:cjs": "rollup src/index.js -f cjs -o dist/color.cjs.js -p \"babel={presets:['@babel/preset-env']}\"",
"build:esm": "rollup src/index.js -f es -o dist/color.esm.js -p \"babel={presets:['@babel/preset-env']}\"",
"build:types": "tsc --emitDeclarationOnly",
"build": "rimraf dist && run-p build:browser build:cjs build:esm build:types",
"build:browser": "rollup src/color.js -f iife -o dist/color.js -n colorjs --no-esModule -p terser -p \"babel={presets:['@babel/preset-env']}\"",
"build:cjs": "rollup src/color.js -f cjs -o dist/color.cjs.js -p \"babel={presets:['@babel/preset-env']}\"",
"build:esm": "rollup src/color.js -f es -o dist/color.esm.js -p \"babel={presets:['@babel/preset-env']}\"",
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
"build": "npm run transpile && rimraf dist && run-p build:browser build:cjs build:esm build:types",
"format": "prettier --write '**/*.{js,json,ts}'",
"prepublishOnly": "npm run build",
"test:cypress": "cypress open",
"test:server": "http-server -p 9000 ./test",
"test": "run-p test:cypress test:server",
"ts": "tsc --noEmit"
"test": "run-p transpile:watch test:cypress test:server",
"transpile:watch": "tsc --outDir src --watch",
"transpile": "tsc --outDir src",
"typecheck": "tsc --noEmit"
},
"dependencies": {},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/index.ts → src/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const getArgs = ({
const format = (input: Input, args: Args): Output => {
const list = input.map((val) => {
const rgb = Array.isArray(val) ? val : val.split(',').map(Number)

return args.format === 'hex' ? rgbToHex(rgb) : rgb
})

Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { average, prominent } from '../src'
import { average, prominent } from '../src/color.js'

it('Extracts the average color', () => {
cy.wrap(average('http://localhost:9000/sand.jpg'))
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"compilerOptions": {
"declaration": true,
"outDir": "./dist",
"strict": true,
"target": "ESNext",
},
"include": ["src"]
}

0 comments on commit 3c2325c

Please sign in to comment.