From edac0780911041e2ccff7753c67f9f5c55124f6e Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Fri, 13 Nov 2015 18:58:02 -0500 Subject: [PATCH 1/4] Make `Splore work in Safari and Firefox To make this happen I updated to Babel 6 and changed to the es2015 preset since Firefox/Safari do NOT support classes, let, generators... Now that compiled code is not ES6 any more we can run Uglify on it too. 'Splore is 200k minimized which isn't terrible. Towards #603 --- clients/splore/.babelrc | 14 ++++++-------- clients/splore/.flowconfig | 4 +++- clients/splore/build.sh | 8 ++++++++ clients/splore/index.html | 2 +- clients/splore/package.json | 35 ++++++++++++++++++++++++++--------- js/.babelrc | 14 ++++++-------- js/.flowconfig | 4 ++++ js/package.json | 18 +++++++++++++----- js/src/http_store.js | 4 ++-- js/src/noms.js | 5 +++-- 10 files changed, 72 insertions(+), 36 deletions(-) create mode 100755 clients/splore/build.sh diff --git a/clients/splore/.babelrc b/clients/splore/.babelrc index 5d19ab5269..ebf90c3cc2 100644 --- a/clients/splore/.babelrc +++ b/clients/splore/.babelrc @@ -1,11 +1,9 @@ { - "optional": ["asyncToGenerator"], - "blacklist": [ - "es6.blockScoping", - "es6.constants", - "es6.forOf", - "es6.properties.computed", - "es6.properties.shorthand", - "es6.templateLiterals" + "presets": ["react", "es2015"], + "plugins": [ + "syntax-async-functions", + "syntax-flow", + "transform-class-properties", + "transform-regenerator" ] } diff --git a/clients/splore/.flowconfig b/clients/splore/.flowconfig index 98f8912668..65cf8e0bb3 100644 --- a/clients/splore/.flowconfig +++ b/clients/splore/.flowconfig @@ -1,6 +1,8 @@ [ignore] +.*/node_modules/babel.* +.*/node_modules/babylon/.* +.*/node_modules/fbjs/.* .*/node_modules/react/.* -.*/node_modules/fbjs/flow/.* [include] diff --git a/clients/splore/build.sh b/clients/splore/build.sh new file mode 100755 index 0000000000..96d44fff3c --- /dev/null +++ b/clients/splore/build.sh @@ -0,0 +1,8 @@ +SRC="node_modules/babel-regenerator-runtime/runtime.js main.js" +OUT="out.js" + +export NODE_ENV=production +node_modules/.bin/browserify \ + -p bundle-collapser/plugin \ + -g uglifyify $SRC \ + | node_modules/.bin/uglifyjs -c -m > $OUT diff --git a/clients/splore/index.html b/clients/splore/index.html index 38ad37a15f..5a89a50ed5 100644 --- a/clients/splore/index.html +++ b/clients/splore/index.html @@ -3,6 +3,6 @@ 'Splore - +
diff --git a/clients/splore/package.json b/clients/splore/package.json index 084bc83e69..0511fc35a0 100644 --- a/clients/splore/package.json +++ b/clients/splore/package.json @@ -6,23 +6,40 @@ "react-dom": "^0.14.1" }, "devDependencies": { - "babel": "^5.6.23", - "babel-eslint": "^4.1.3", - "babelify": "^6.1.3", + "babel-cli": "^6.1.18", + "babel-core": "^6.1.20", + "babel-eslint": "^4.1.5", + "babel-plugin-syntax-async-functions": "^6.1.18", + "babel-plugin-syntax-flow": "^6.1.18", + "babel-plugin-transform-class-properties": "^6.2.2", + "babel-plugin-transform-regenerator": "^6.2.0", + "babel-preset-es2015": "^6.1.18", + "babel-preset-react": "^6.1.18", + "babel-regenerator-runtime": "^6.2.0", + "babelify": "^7.2.0", "browserify": "^12.0.1", + "bundle-collapser": "^1.2.1", + "chai": "^3.2.0", "envify": "^3.4.0", - "eslint": "^1.7.3", - "eslint-plugin-react": "^3.6.3", + "eslint": "^1.9.0", + "eslint-plugin-react": "^3.8.0", "flow-bin": "^0.18.1", + "grunt": "^0.4.5", + "mocha": "^2.3.0", + "uglify-js": "^2.6.1", + "uglifyify": "^3.0.1", "watchify": "^3.6" }, "scripts": { - "start": "NOMS_SERVER=http://localhost:8000 watchify -o out.js -v -d main.js", - "build": "NOMS_SERVER=http://localhost:8000 NODE_ENV=production browserify main.js > out.js", - "prod_build": "NOMS_SERVER=http://ds.noms.io NODE_ENV=production browserify main.js > out.js", + "start": "NOMS_SERVER=http://localhost:8000 watchify -o out.js -v -d node_modules/babel-regenerator-runtime/runtime.js main.js", + "build": "NOMS_SERVER=http://localhost:8000 ./build.sh", + "prod_build": "NOMS_SERVER=http://ds.noms.io ./build.sh", "test": "rm -f out.js && eslint *.js && flow" }, "browserify": { - "transform": ["babelify", "envify"] + "transform": [ + "babelify", + "envify" + ] } } diff --git a/js/.babelrc b/js/.babelrc index 5d19ab5269..ebf90c3cc2 100644 --- a/js/.babelrc +++ b/js/.babelrc @@ -1,11 +1,9 @@ { - "optional": ["asyncToGenerator"], - "blacklist": [ - "es6.blockScoping", - "es6.constants", - "es6.forOf", - "es6.properties.computed", - "es6.properties.shorthand", - "es6.templateLiterals" + "presets": ["react", "es2015"], + "plugins": [ + "syntax-async-functions", + "syntax-flow", + "transform-class-properties", + "transform-regenerator" ] } diff --git a/js/.flowconfig b/js/.flowconfig index ec1001dd21..65cf8e0bb3 100644 --- a/js/.flowconfig +++ b/js/.flowconfig @@ -1,4 +1,8 @@ [ignore] +.*/node_modules/babel.* +.*/node_modules/babylon/.* +.*/node_modules/fbjs/.* +.*/node_modules/react/.* [include] diff --git a/js/package.json b/js/package.json index e8a0801ecc..359c7993bf 100644 --- a/js/package.json +++ b/js/package.json @@ -6,11 +6,19 @@ "text-encoding-utf-8": "^1.0.1" }, "devDependencies": { - "babel": "~5.6.23", - "babel-eslint": "^4.1.3", + "babel-cli": "^6.1.18", + "babel-core": "^6.1.20", + "babel-eslint": "^4.1.5", + "babel-plugin-syntax-async-functions": "^6.1.18", + "babel-plugin-syntax-flow": "^6.1.18", + "babel-plugin-transform-class-properties": "^6.2.2", + "babel-plugin-transform-regenerator": "^6.2.0", + "babel-polyfill": "^6.2.0", + "babel-preset-es2015": "^6.1.18", + "babel-preset-react": "^6.1.18", "chai": "^3.2.0", - "eslint": "^1.7.3", - "eslint-plugin-react": "^3.6.3", + "eslint": "^1.9.0", + "eslint-plugin-react": "^3.8.0", "flow-bin": "^0.18.1", "mocha": "^2.3.0" }, @@ -18,7 +26,7 @@ "start": "babel -w src/ -d dist/", "build": "babel src/ -d dist/", "pretest": "eslint src/ && flow src/", - "test": "mocha --ui tdd --reporter dot --compilers js:babel/register src/" + "test": "mocha --ui tdd --reporter dot --require babel-polyfill --compilers js:babel-core/register src/" }, "browser": { "./dist/fetch.js": "./dist/browser/fetch.js" diff --git a/js/src/http_store.js b/js/src/http_store.js index 24c1610b73..cbc20a1ab2 100644 --- a/js/src/http_store.js +++ b/js/src/http_store.js @@ -25,8 +25,8 @@ export default class HttpStore { constructor(url: string, maxReads: number = 3) { this._rpc = { getRefs: url + '/getRefs/', - ref: url + '/ref', - root: url + '/root' + ref: url + '/ref/', + root: url + '/root/' }; this._readQueue = Object.create(null); this._anyPending = false; diff --git a/js/src/noms.js b/js/src/noms.js index d5f989b617..b9ba789377 100644 --- a/js/src/noms.js +++ b/js/src/noms.js @@ -8,11 +8,10 @@ import {encodeNomsValue} from './encode.js'; import {readValue} from './decode.js'; import {Type} from './type.js'; import Struct from './struct.js'; -import ChunkStore from './chunk_store.js'; +import type {ChunkStore} from './chunk_store.js'; export { Chunk, - ChunkStore, encodeNomsValue, HttpStore, MemoryStore, @@ -21,3 +20,5 @@ export { Struct, Type }; + +export type {ChunkStore}; From af23cc0dfe043f4d26fc2f228c9268e808f994d7 Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Mon, 23 Nov 2015 13:01:12 -0500 Subject: [PATCH 2/4] Chart too --- clients/chart/.babelrc | 12 +----------- clients/chart/.eslintrc | 36 +----------------------------------- clients/chart/.flowconfig | 14 +------------- clients/chart/build.sh | 11 +++++++++++ clients/chart/package.json | 29 +++++++++++++++++++++-------- clients/splore/.babelrc | 10 +--------- clients/splore/.eslintrc | 36 +----------------------------------- clients/splore/.flowconfig | 14 +------------- clients/splore/build.sh | 2 +- clients/splore/package.json | 1 - 10 files changed, 39 insertions(+), 126 deletions(-) mode change 100644 => 120000 clients/chart/.babelrc mode change 100644 => 120000 clients/chart/.eslintrc mode change 100644 => 120000 clients/chart/.flowconfig create mode 100755 clients/chart/build.sh mode change 100644 => 120000 clients/splore/.babelrc mode change 100644 => 120000 clients/splore/.eslintrc mode change 100644 => 120000 clients/splore/.flowconfig diff --git a/clients/chart/.babelrc b/clients/chart/.babelrc deleted file mode 100644 index 5d19ab5269..0000000000 --- a/clients/chart/.babelrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "optional": ["asyncToGenerator"], - "blacklist": [ - "es6.blockScoping", - "es6.constants", - "es6.forOf", - "es6.properties.computed", - "es6.properties.shorthand", - "es6.templateLiterals" - ] -} diff --git a/clients/chart/.babelrc b/clients/chart/.babelrc new file mode 120000 index 0000000000..1e7d0c1803 --- /dev/null +++ b/clients/chart/.babelrc @@ -0,0 +1 @@ +../../js/.babelrc \ No newline at end of file diff --git a/clients/chart/.eslintrc b/clients/chart/.eslintrc deleted file mode 100644 index 1c3e995d8c..0000000000 --- a/clients/chart/.eslintrc +++ /dev/null @@ -1,35 +0,0 @@ -{ - "parser": "babel-eslint", - "rules": { - "array-bracket-spacing": [2, "never"], - "camelcase": 2, - "eqeqeq": 2, - "indent": [2, 2, {"SwitchCase": 1}], - "linebreak-style": [2, "unix"], - "no-multi-spaces": 2, - "no-new-wrappers": 2, - "no-throw-literal": 2, - "no-var": 2, - "object-curly-spacing": [2, "never"], - "quotes": [2, "single"], - "radix": 2, - "semi": 2, - "space-after-keywords": 2, - "space-before-function-paren": [2, "never"], - "space-infix-ops": 2, - "space-in-parens": [2, "never"] - }, - "env": { - "es6": true, - "node": true, - "browser": true - }, - "extends": "eslint:recommended", - "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true - }, - "plugins": [ - "react" - ] -} diff --git a/clients/chart/.eslintrc b/clients/chart/.eslintrc new file mode 120000 index 0000000000..0e3373d7ee --- /dev/null +++ b/clients/chart/.eslintrc @@ -0,0 +1 @@ +../../js/.eslintrc \ No newline at end of file diff --git a/clients/chart/.flowconfig b/clients/chart/.flowconfig deleted file mode 100644 index 2ee138b7b3..0000000000 --- a/clients/chart/.flowconfig +++ /dev/null @@ -1,13 +0,0 @@ -[ignore] -.*/node_modules/d3/.* -.*/node_modules/fbjs/flow/.* -.*/node_modules/react/.* - -[include] - -[libs] - -[options] -unsafe.enable_getters_and_setters=true -munge_underscores=true -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue diff --git a/clients/chart/.flowconfig b/clients/chart/.flowconfig new file mode 120000 index 0000000000..6eef3a9002 --- /dev/null +++ b/clients/chart/.flowconfig @@ -0,0 +1 @@ +../../js/.flowconfig \ No newline at end of file diff --git a/clients/chart/build.sh b/clients/chart/build.sh new file mode 100755 index 0000000000..e55d4273c6 --- /dev/null +++ b/clients/chart/build.sh @@ -0,0 +1,11 @@ +SRC="node_modules/babel-regenerator-runtime/runtime.js src/main.js" +OUT="out.js" + +export NODE_ENV=production + +cp node_modules/nvd3/build/nv.d3.min.css nv.d3.css + +node_modules/.bin/browserify \ + -p bundle-collapser/plugin \ + $SRC \ + | node_modules/.bin/uglifyjs -c -m > $OUT diff --git a/clients/chart/package.json b/clients/chart/package.json index 097ba46dae..86fa1e28f6 100644 --- a/clients/chart/package.json +++ b/clients/chart/package.json @@ -7,20 +7,33 @@ "react-dom": "^0.14.1" }, "devDependencies": { - "babel": "^5.6.23", - "babel-eslint": "^4.1.3", - "babelify": "^6.1.3", + "babel-cli": "^6.1.18", + "babel-core": "^6.1.20", + "babel-eslint": "^4.1.5", + "babel-plugin-syntax-async-functions": "^6.1.18", + "babel-plugin-syntax-flow": "^6.1.18", + "babel-plugin-transform-class-properties": "^6.2.2", + "babel-plugin-transform-regenerator": "^6.2.0", + "babel-preset-es2015": "^6.1.18", + "babel-preset-react": "^6.1.18", + "babel-regenerator-runtime": "^6.2.0", + "babelify": "^7.2.0", "browserify": "^12.0.1", + "bundle-collapser": "^1.2.1", + "chai": "^3.2.0", "envify": "^3.4.0", - "eslint": "^1.7.3", - "eslint-plugin-react": "^3.6.3", + "eslint": "^1.9.0", + "eslint-plugin-react": "^3.8.0", "flow-bin": "^0.18.1", + "grunt": "^0.4.5", + "mocha": "^2.3.0", + "uglify-js": "^2.6.1", "watchify": "^3.6" }, "scripts": { - "start": "cp node_modules/nvd3/build/nv.d3.css nv.d3.css; NOMS_SERVER=http://localhost:8000 watchify -o out.js -v -d src/main.js", - "build": "cp node_modules/nvd3/build/nv.d3.min.css nv.d3.css; NOMS_SERVER=http://localhost:8000 NODE_ENV=production browserify src/main.js > out.js", - "test": "rm -f out.js && eslint *.js && flow" + "start": "cp node_modules/nvd3/build/nv.d3.css nv.d3.css; watchify -o out.js -v -d src/main.js", + "build": "./build.sh", + "test": "rm -f out.js && eslint src/ && flow src/" }, "browserify": { "transform": [ diff --git a/clients/splore/.babelrc b/clients/splore/.babelrc deleted file mode 100644 index ebf90c3cc2..0000000000 --- a/clients/splore/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": ["react", "es2015"], - "plugins": [ - "syntax-async-functions", - "syntax-flow", - "transform-class-properties", - "transform-regenerator" - ] -} diff --git a/clients/splore/.babelrc b/clients/splore/.babelrc new file mode 120000 index 0000000000..1e7d0c1803 --- /dev/null +++ b/clients/splore/.babelrc @@ -0,0 +1 @@ +../../js/.babelrc \ No newline at end of file diff --git a/clients/splore/.eslintrc b/clients/splore/.eslintrc deleted file mode 100644 index 1c3e995d8c..0000000000 --- a/clients/splore/.eslintrc +++ /dev/null @@ -1,35 +0,0 @@ -{ - "parser": "babel-eslint", - "rules": { - "array-bracket-spacing": [2, "never"], - "camelcase": 2, - "eqeqeq": 2, - "indent": [2, 2, {"SwitchCase": 1}], - "linebreak-style": [2, "unix"], - "no-multi-spaces": 2, - "no-new-wrappers": 2, - "no-throw-literal": 2, - "no-var": 2, - "object-curly-spacing": [2, "never"], - "quotes": [2, "single"], - "radix": 2, - "semi": 2, - "space-after-keywords": 2, - "space-before-function-paren": [2, "never"], - "space-infix-ops": 2, - "space-in-parens": [2, "never"] - }, - "env": { - "es6": true, - "node": true, - "browser": true - }, - "extends": "eslint:recommended", - "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true - }, - "plugins": [ - "react" - ] -} diff --git a/clients/splore/.eslintrc b/clients/splore/.eslintrc new file mode 120000 index 0000000000..0e3373d7ee --- /dev/null +++ b/clients/splore/.eslintrc @@ -0,0 +1 @@ +../../js/.eslintrc \ No newline at end of file diff --git a/clients/splore/.flowconfig b/clients/splore/.flowconfig deleted file mode 100644 index 65cf8e0bb3..0000000000 --- a/clients/splore/.flowconfig +++ /dev/null @@ -1,13 +0,0 @@ -[ignore] -.*/node_modules/babel.* -.*/node_modules/babylon/.* -.*/node_modules/fbjs/.* -.*/node_modules/react/.* - -[include] - -[libs] - -[options] -unsafe.enable_getters_and_setters=true -munge_underscores=true diff --git a/clients/splore/.flowconfig b/clients/splore/.flowconfig new file mode 120000 index 0000000000..6eef3a9002 --- /dev/null +++ b/clients/splore/.flowconfig @@ -0,0 +1 @@ +../../js/.flowconfig \ No newline at end of file diff --git a/clients/splore/build.sh b/clients/splore/build.sh index 96d44fff3c..0017649a74 100755 --- a/clients/splore/build.sh +++ b/clients/splore/build.sh @@ -4,5 +4,5 @@ OUT="out.js" export NODE_ENV=production node_modules/.bin/browserify \ -p bundle-collapser/plugin \ - -g uglifyify $SRC \ + $SRC \ | node_modules/.bin/uglifyjs -c -m > $OUT diff --git a/clients/splore/package.json b/clients/splore/package.json index 0511fc35a0..b1fcce9d52 100644 --- a/clients/splore/package.json +++ b/clients/splore/package.json @@ -27,7 +27,6 @@ "grunt": "^0.4.5", "mocha": "^2.3.0", "uglify-js": "^2.6.1", - "uglifyify": "^3.0.1", "watchify": "^3.6" }, "scripts": { From 547a61d98554ffc84fde3041a0265619612f63bd Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Mon, 23 Nov 2015 15:38:14 -0500 Subject: [PATCH 3/4] tagshow --- clients/tagshow/.babelrc | 12 +----------- clients/tagshow/.eslintrc | 36 +----------------------------------- clients/tagshow/.flowconfig | 12 +----------- clients/tagshow/build.sh | 9 +++++++++ clients/tagshow/package.json | 35 ++++++++++++++++++++++++++--------- 5 files changed, 38 insertions(+), 66 deletions(-) mode change 100644 => 120000 clients/tagshow/.babelrc mode change 100644 => 120000 clients/tagshow/.eslintrc mode change 100644 => 120000 clients/tagshow/.flowconfig create mode 100755 clients/tagshow/build.sh diff --git a/clients/tagshow/.babelrc b/clients/tagshow/.babelrc deleted file mode 100644 index 5d19ab5269..0000000000 --- a/clients/tagshow/.babelrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "optional": ["asyncToGenerator"], - "blacklist": [ - "es6.blockScoping", - "es6.constants", - "es6.forOf", - "es6.properties.computed", - "es6.properties.shorthand", - "es6.templateLiterals" - ] -} diff --git a/clients/tagshow/.babelrc b/clients/tagshow/.babelrc new file mode 120000 index 0000000000..1e7d0c1803 --- /dev/null +++ b/clients/tagshow/.babelrc @@ -0,0 +1 @@ +../../js/.babelrc \ No newline at end of file diff --git a/clients/tagshow/.eslintrc b/clients/tagshow/.eslintrc deleted file mode 100644 index 1c3e995d8c..0000000000 --- a/clients/tagshow/.eslintrc +++ /dev/null @@ -1,35 +0,0 @@ -{ - "parser": "babel-eslint", - "rules": { - "array-bracket-spacing": [2, "never"], - "camelcase": 2, - "eqeqeq": 2, - "indent": [2, 2, {"SwitchCase": 1}], - "linebreak-style": [2, "unix"], - "no-multi-spaces": 2, - "no-new-wrappers": 2, - "no-throw-literal": 2, - "no-var": 2, - "object-curly-spacing": [2, "never"], - "quotes": [2, "single"], - "radix": 2, - "semi": 2, - "space-after-keywords": 2, - "space-before-function-paren": [2, "never"], - "space-infix-ops": 2, - "space-in-parens": [2, "never"] - }, - "env": { - "es6": true, - "node": true, - "browser": true - }, - "extends": "eslint:recommended", - "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true - }, - "plugins": [ - "react" - ] -} diff --git a/clients/tagshow/.eslintrc b/clients/tagshow/.eslintrc new file mode 120000 index 0000000000..0e3373d7ee --- /dev/null +++ b/clients/tagshow/.eslintrc @@ -0,0 +1 @@ +../../js/.eslintrc \ No newline at end of file diff --git a/clients/tagshow/.flowconfig b/clients/tagshow/.flowconfig deleted file mode 100644 index 98f8912668..0000000000 --- a/clients/tagshow/.flowconfig +++ /dev/null @@ -1,11 +0,0 @@ -[ignore] -.*/node_modules/react/.* -.*/node_modules/fbjs/flow/.* - -[include] - -[libs] - -[options] -unsafe.enable_getters_and_setters=true -munge_underscores=true diff --git a/clients/tagshow/.flowconfig b/clients/tagshow/.flowconfig new file mode 120000 index 0000000000..6eef3a9002 --- /dev/null +++ b/clients/tagshow/.flowconfig @@ -0,0 +1 @@ +../../js/.flowconfig \ No newline at end of file diff --git a/clients/tagshow/build.sh b/clients/tagshow/build.sh new file mode 100755 index 0000000000..f8a985d85d --- /dev/null +++ b/clients/tagshow/build.sh @@ -0,0 +1,9 @@ +SRC="node_modules/babel-regenerator-runtime/runtime.js main.js" +OUT="tagshow.js" + +export NODE_ENV=production + +node_modules/.bin/browserify \ + -p bundle-collapser/plugin \ + $SRC \ + | node_modules/.bin/uglifyjs -c -m > $OUT diff --git a/clients/tagshow/package.json b/clients/tagshow/package.json index 4b8bccac30..07f5bee7e0 100644 --- a/clients/tagshow/package.json +++ b/clients/tagshow/package.json @@ -6,22 +6,39 @@ "react-dom": "^0.14.1" }, "devDependencies": { - "babel-eslint": "^4.1.3", - "babel": "^5.6.23", - "babelify": "^6.1.3", + "babel-cli": "^6.1.18", + "babel-core": "^6.1.20", + "babel-eslint": "^4.1.5", + "babel-plugin-syntax-async-functions": "^6.1.18", + "babel-plugin-syntax-flow": "^6.1.18", + "babel-plugin-transform-class-properties": "^6.2.2", + "babel-plugin-transform-regenerator": "^6.2.0", + "babel-preset-es2015": "^6.1.18", + "babel-preset-react": "^6.1.18", + "babel-regenerator-runtime": "^6.2.0", + "babelify": "^7.2.0", "browserify": "^12.0.1", + "bundle-collapser": "^1.2.1", "chai": "^3.2.0", - "eslint-plugin-react": "^3.6.3", - "eslint": "^1.7.3", + "envify": "^3.4.0", + "eslint": "^1.9.0", + "eslint-plugin-react": "^3.8.0", "flow-bin": "^0.18.1", + "grunt": "^0.4.5", "mocha": "^2.3.0", + "uglify-js": "^2.6.1", "watchify": "^3.6" }, "scripts": { - "start": "watchify -o tagshow.js -t babelify -v -d main.js", - "build": "NODE_ENV=production browserify main.js -t babelify > tagshow.js", + "start": "watchify -o tagshow.js -t babelify -v -d node_modules/babel-regenerator-runtime/runtime.js main.js", + "build": "./build.sh", "pretest": "rm -f tagshow.js && eslint *.js && flow", - "test": "mocha --ui tdd --reporter dot --compilers js:babel/register ./*_test.js" - + "test": "mocha --ui tdd --reporter dot --compilers js:babel-core/register ./*_test.js" + }, + "browserify": { + "transform": [ + "babelify", + "envify" + ] } } From 28a47966a0a7393c83ed2e0bdefd915688cee28a Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Mon, 23 Nov 2015 16:05:17 -0500 Subject: [PATCH 4/4] pitchmap --- clients/pitchmap/ui/.babelrc | 12 +---------- clients/pitchmap/ui/.eslintrc | 36 +------------------------------- clients/pitchmap/ui/.flowconfig | 12 +---------- clients/pitchmap/ui/build.sh | 9 ++++++++ clients/pitchmap/ui/main.js | 7 +++---- clients/pitchmap/ui/package.json | 33 ++++++++++++++++++++++------- clients/tagshow/package.json | 1 - 7 files changed, 41 insertions(+), 69 deletions(-) mode change 100644 => 120000 clients/pitchmap/ui/.babelrc mode change 100644 => 120000 clients/pitchmap/ui/.eslintrc mode change 100644 => 120000 clients/pitchmap/ui/.flowconfig create mode 100755 clients/pitchmap/ui/build.sh diff --git a/clients/pitchmap/ui/.babelrc b/clients/pitchmap/ui/.babelrc deleted file mode 100644 index 5d19ab5269..0000000000 --- a/clients/pitchmap/ui/.babelrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "optional": ["asyncToGenerator"], - "blacklist": [ - "es6.blockScoping", - "es6.constants", - "es6.forOf", - "es6.properties.computed", - "es6.properties.shorthand", - "es6.templateLiterals" - ] -} diff --git a/clients/pitchmap/ui/.babelrc b/clients/pitchmap/ui/.babelrc new file mode 120000 index 0000000000..2036edcccd --- /dev/null +++ b/clients/pitchmap/ui/.babelrc @@ -0,0 +1 @@ +../../../js/.babelrc \ No newline at end of file diff --git a/clients/pitchmap/ui/.eslintrc b/clients/pitchmap/ui/.eslintrc deleted file mode 100644 index 1c3e995d8c..0000000000 --- a/clients/pitchmap/ui/.eslintrc +++ /dev/null @@ -1,35 +0,0 @@ -{ - "parser": "babel-eslint", - "rules": { - "array-bracket-spacing": [2, "never"], - "camelcase": 2, - "eqeqeq": 2, - "indent": [2, 2, {"SwitchCase": 1}], - "linebreak-style": [2, "unix"], - "no-multi-spaces": 2, - "no-new-wrappers": 2, - "no-throw-literal": 2, - "no-var": 2, - "object-curly-spacing": [2, "never"], - "quotes": [2, "single"], - "radix": 2, - "semi": 2, - "space-after-keywords": 2, - "space-before-function-paren": [2, "never"], - "space-infix-ops": 2, - "space-in-parens": [2, "never"] - }, - "env": { - "es6": true, - "node": true, - "browser": true - }, - "extends": "eslint:recommended", - "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true - }, - "plugins": [ - "react" - ] -} diff --git a/clients/pitchmap/ui/.eslintrc b/clients/pitchmap/ui/.eslintrc new file mode 120000 index 0000000000..c1751ce249 --- /dev/null +++ b/clients/pitchmap/ui/.eslintrc @@ -0,0 +1 @@ +../../../js/.eslintrc \ No newline at end of file diff --git a/clients/pitchmap/ui/.flowconfig b/clients/pitchmap/ui/.flowconfig deleted file mode 100644 index 98f8912668..0000000000 --- a/clients/pitchmap/ui/.flowconfig +++ /dev/null @@ -1,11 +0,0 @@ -[ignore] -.*/node_modules/react/.* -.*/node_modules/fbjs/flow/.* - -[include] - -[libs] - -[options] -unsafe.enable_getters_and_setters=true -munge_underscores=true diff --git a/clients/pitchmap/ui/.flowconfig b/clients/pitchmap/ui/.flowconfig new file mode 120000 index 0000000000..69e272d83e --- /dev/null +++ b/clients/pitchmap/ui/.flowconfig @@ -0,0 +1 @@ +../../../js/.flowconfig \ No newline at end of file diff --git a/clients/pitchmap/ui/build.sh b/clients/pitchmap/ui/build.sh new file mode 100755 index 0000000000..03ceda2ac6 --- /dev/null +++ b/clients/pitchmap/ui/build.sh @@ -0,0 +1,9 @@ +SRC="node_modules/babel-regenerator-runtime/runtime.js main.js" +OUT="out.js" + +export NODE_ENV=production + +node_modules/.bin/browserify \ + -p bundle-collapser/plugin \ + $SRC \ + | node_modules/.bin/uglifyjs -c -m > $OUT diff --git a/clients/pitchmap/ui/main.js b/clients/pitchmap/ui/main.js index 5eba4e4f48..478660aabe 100644 --- a/clients/pitchmap/ui/main.js +++ b/clients/pitchmap/ui/main.js @@ -1,15 +1,13 @@ /* @flow */ import HeatMap from './heat_map.js'; -import React from 'react'; //eslint-disable-line no-unused-lets +import React from 'react'; import ReactDOM from 'react-dom'; import {readValue, HttpStore, Ref} from 'noms'; let httpStore: HttpStore; -let renderNode: ?HTMLElement; window.addEventListener('load', async () => { - renderNode = document.getElementById('heatmap'); httpStore = new HttpStore('http://localhost:8000'); let rootRef = await httpStore.getRoot(); let datasets = await readValue(rootRef, httpStore); @@ -46,7 +44,7 @@ class PitcherList extends React.Component { }; } - render() { + render() : React.Element { let currentPitcher = this.state.currentPitcher; let pitchListRef = this.props.pitchersMap.get(currentPitcher); @@ -69,5 +67,6 @@ class PitcherList extends React.Component { } function renderPitchersMap(map: Map) { + let renderNode = document.getElementById('heatmap'); ReactDOM.render(, renderNode); } diff --git a/clients/pitchmap/ui/package.json b/clients/pitchmap/ui/package.json index 2c703a702a..da908ff385 100644 --- a/clients/pitchmap/ui/package.json +++ b/clients/pitchmap/ui/package.json @@ -5,18 +5,37 @@ "react-dom": "^0.14.1" }, "devDependencies": { - "babel": "^5.6.23", - "babel-eslint": "^4.1.3", - "babelify": "^6.1.3", + "babel-cli": "^6.1.18", + "babel-core": "^6.1.20", + "babel-eslint": "^4.1.5", + "babel-plugin-syntax-async-functions": "^6.1.18", + "babel-plugin-syntax-flow": "^6.1.18", + "babel-plugin-transform-class-properties": "^6.2.2", + "babel-plugin-transform-regenerator": "^6.2.0", + "babel-preset-es2015": "^6.1.18", + "babel-preset-react": "^6.1.18", + "babel-regenerator-runtime": "^6.2.0", + "babelify": "^7.2.0", "browserify": "^12.0.1", - "eslint": "^1.7.3", - "eslint-plugin-react": "^3.6.3", + "bundle-collapser": "^1.2.1", + "chai": "^3.2.0", + "envify": "^3.4.0", + "eslint": "^1.9.0", + "eslint-plugin-react": "^3.8.0", "flow-bin": "^0.18.1", + "mocha": "^2.3.0", + "uglify-js": "^2.6.1", "watchify": "^3.6" }, "scripts": { - "start": "watchify -o out.js -t babelify -v -d main.js", - "build": "NODE_ENV=production browserify main.js -t babelify > out.js", + "start": "watchify -o out.js -t babelify -v -d node_modules/babel-regenerator-runtime/runtime.js main.js", + "build": "./build.sh", "test": "rm -f out.js && eslint *.js && flow" + }, + "browserify": { + "transform": [ + "babelify", + "envify" + ] } } diff --git a/clients/tagshow/package.json b/clients/tagshow/package.json index 07f5bee7e0..fec763d823 100644 --- a/clients/tagshow/package.json +++ b/clients/tagshow/package.json @@ -24,7 +24,6 @@ "eslint": "^1.9.0", "eslint-plugin-react": "^3.8.0", "flow-bin": "^0.18.1", - "grunt": "^0.4.5", "mocha": "^2.3.0", "uglify-js": "^2.6.1", "watchify": "^3.6"