diff --git a/.gitignore b/.gitignore index e728f7a..c378830 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# Temporal +.tmp +tmp.js + # Compiled build diff --git a/.npmignore b/.npmignore index b38186b..0413cf9 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,3 @@ src -example \ No newline at end of file +example +*.test.js \ No newline at end of file diff --git a/package.json b/package.json index 5e485bd..06efed8 100644 --- a/package.json +++ b/package.json @@ -6,41 +6,46 @@ "scripts": { "dev": "watch 'npm run build' src", "eslint": "eslint src", - "prebuild": "npm run eslint", + "tmp": "cp -R build/ .tmp", + "precopy": "if [ ! -d build ]; then npm run build; fi", + "postcopy": "find .tmp -type f -name '*.test.js' -delete", + "uglify": "uglifyjs ./.tmp/**/*.js -m -c -o bundle.js", + "preuglify": "npm run tmp", "build": "babel src -d build", + "prebuild": "npm run eslint", "test": "jest --config .jest.json", - "pretest:bundlesize": "npm run build", "test:bundlesize": "bundlesize", + "pretest:bundlesize": "npm run uglify", + "posttest:bundlesize": "rm -fR .tmp bundle.js", "test:watch": "npm test -- --watch", "test:coverage": "npm test -- --coverage", "prepublish": "npm run build", "release": "np --no-yarn", - "preexample:install": "npm run example:peripheral:install", + "example:install": "npm run example:webapp:install", + "preexample:install": "npm run example:peripheral:install", "example:start": "npm run example:peripheral:start", "example:deploy": "npm run example:webapp:deploy", - "example:webapp:install": "cd example/webapp && npm install", + "example:webapp:install": "cd example/webapp && yarn install", "example:webapp:build": "cd example/webapp && npm run build", "example:webapp:deploy": "cd example/webapp && npm run deploy", - "example:peripheral:install": "cd example/peripheral && npm install", + "example:peripheral:install": "cd example/peripheral && yarn install", "example:peripheral:build": "cd example/peripheral && npm run build", "example:peripheral:start": "cd example/peripheral && npm start", + "test:ci": "jest --config .jest.ci.json", - "pretest:coverage:ci": "npm run test:coverage", "test:coverage:ci": "codecov -t $CODECOV_TOKEN", - "test:bundlesize:ci": "bundlesize", - "preexample:deploy:ci": "npm run example:webapp:install", - "example:deploy:ci": "npm run example:webapp:build" + "pretest:coverage:ci": "npm run test:coverage", + "test:bundlesize:ci": "npm run test:bundlesize", + "example:deploy:ci": "npm run example:webapp:build", + "preexample:deploy:ci": "npm run example:webapp:install" }, "babel": { "presets": [ "latest" ] }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/jvallelunga/redux-bluetooth.git" - }, + "repository": "git+ssh://git@github.com/jvallelunga/redux-bluetooth.git", "keywords": [ "redux", "middleware", @@ -70,6 +75,7 @@ "eslint-plugin-react": "^7.1.0", "jest": "^20.0.4", "np": "^2.16.0", + "uglify-js": "^3.0.24", "watch": "^1.0.2" }, "dependencies": { @@ -80,7 +86,7 @@ }, "bundlesize": [ { - "path": "./build/**.js", + "path": "bundle.js", "maxSize": "2 Kb" } ] diff --git a/yarn.lock b/yarn.lock index b494f09..812aad9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -218,6 +218,18 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" +axios@0.15.3: + version "0.15.3" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.15.3.tgz#2c9d638b2e191a08ea1d6cc988eadd6ba5bdc053" + dependencies: + follow-redirects "1.0.0" + +axios@0.16.1: + version "0.16.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.1.tgz#c0b6d26600842384b8f509e57111f0d2df8223ca" + dependencies: + follow-redirects "^1.2.3" + axobject-query@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0" @@ -850,6 +862,24 @@ builtin-modules@^1.0.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" +bundlesize@^0.11.2: + version "0.11.2" + resolved "https://registry.yarnpkg.com/bundlesize/-/bundlesize-0.11.2.tgz#020c4c33e21868d8352beff6483f815f7299e50c" + dependencies: + axios "0.16.1" + bytes "2.5.0" + ci-env "1.1.0" + commander "2.11.0" + github-build "1.1.1" + glob "7.1.2" + gzip-size "3.0.0" + prettycli "1.3.0" + read-pkg-up "2.0.0" + +bytes@2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.5.0.tgz#4c9423ea2d252c270c41b2bdefeff9bb6b62c06a" + caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" @@ -906,7 +936,7 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -939,6 +969,10 @@ chokidar@^1.6.1: optionalDependencies: fsevents "^1.0.0" +ci-env@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ci-env/-/ci-env-1.1.0.tgz#0f58b7d4283934bd1adc73a425ffb1df89e6a89c" + ci-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" @@ -1026,10 +1060,16 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@^2.8.1, commander@^2.9.0: +commander@2.11.0, commander@^2.8.1, commander@^2.9.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" +commander@~2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -1137,7 +1177,7 @@ date-fns@^1.27.2: version "1.28.5" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" -debug@^2.1.1, debug@^2.2.0, debug@^2.6.3, debug@^2.6.8: +debug@^2.1.1, debug@^2.2.0, debug@^2.4.5, debug@^2.6.3, debug@^2.6.8: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" dependencies: @@ -1222,6 +1262,10 @@ duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" +duplexer@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1634,6 +1678,18 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" +follow-redirects@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.0.0.tgz#8e34298cbd2e176f254effec75a1c78cc849fd37" + dependencies: + debug "^2.2.0" + +follow-redirects@^1.2.3: + version "1.2.4" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.2.4.tgz#355e8f4d16876b43f577b0d5ce2668b9723214ea" + dependencies: + debug "^2.4.5" + for-in@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -1737,6 +1793,12 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +github-build@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/github-build/-/github-build-1.1.1.tgz#7a1fd4ed018dc8b4098f31701fd8e0f1b8a9e8cb" + dependencies: + axios "0.15.3" + glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" @@ -1750,7 +1812,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1: +glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -1796,10 +1858,20 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" +gzip-size@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-3.0.0.tgz#546188e9bdc337f673772f81660464b389dce520" + dependencies: + duplexer "^0.1.1" + handlebars@^4.0.3: version "4.0.10" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" @@ -3132,6 +3204,12 @@ pretty-format@^20.0.3: ansi-regex "^2.1.1" ansi-styles "^3.0.0" +prettycli@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/prettycli/-/prettycli-1.3.0.tgz#1c6a05018064c4dfb6dd1332435fd6715e49b273" + dependencies: + chalk "1.1.3" + private@^0.1.6: version "0.1.7" resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" @@ -3180,6 +3258,13 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.1.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +read-pkg-up@2.0.0, read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -3187,13 +3272,6 @@ read-pkg-up@^1.0.1: find-up "^1.0.0" read-pkg "^1.0.0" -read-pkg-up@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" - dependencies: - find-up "^2.0.0" - read-pkg "^2.0.0" - read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" @@ -3856,6 +3934,13 @@ uglify-js@^2.6: optionalDependencies: uglify-to-browserify "~1.0.0" +uglify-js@^3.0.24: + version "3.0.24" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.0.24.tgz#ee93400ad9857fb7a1671778db83f6a23f033121" + dependencies: + commander "~2.9.0" + source-map "~0.5.1" + uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"