From 2d5d1ceb5c107826af9b8bc105be0816e3df44d7 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 13 Jul 2015 16:34:43 +0100 Subject: [PATCH] t --- CONTRIBUTING.md | 122 +----------------- Makefile | 58 +++------ package.json | 2 +- packages/babel-cli/package.json | 1 + packages/babel-cli/test/mocha.opts | 2 - packages/babel-cli/test/tmp/bar2.js | 2 - packages/babel-cli/test/tmp/foo2.js | 5 - .../babel-cli/test/tmp/not_node_modules.jsx | 10 -- packages/babel-runtime/.npmignore | 2 + .../scripts/build-dist.js} | 16 +-- packages/babel/.npmignore | 4 - packages/babel/package.json | 1 + .../babel/scripts/{build.sh => build-dist.sh} | 0 packages/babel/test/_helper.js | 12 -- packages/babel/test/_transformation-helper.js | 13 +- .../fixtures/transformation/api/options.json | 3 - .../async-to-generator/options.json | 1 - .../bluebird-coroutines/options.json | 3 +- .../comments-explosion/options.json | 3 +- .../es6.regex.unicode/options.json | 3 - .../es7.export-extensions/options.json | 1 - .../fixtures/transformation/flow/options.json | 3 +- .../options.json | 1 - .../options.json | 3 +- .../options.json | 1 - .../options.json | 1 - .../spec.function-name/export/options.json | 1 - packages/babel/test/mocha.opts | 2 - packages/babel/test/tmp/bar2.js | 2 - packages/babel/test/tmp/foo2.js | 5 - packages/babel/test/tmp/not_node_modules.jsx | 10 -- packages/babylon/src/tokenize.js | 1 + packages/babylon/test/mocha.opts | 2 - packages/build-cli.js | 11 -- scripts/{travis => }/build-website.sh | 4 +- scripts/{build-core.sh => build.sh} | 0 scripts/publish.js | 3 + scripts/test.sh | 9 +- scripts/travis/comment-issues.sh | 2 - scripts/travis/publish-cli.sh | 17 --- test/warning.js | 2 + 41 files changed, 45 insertions(+), 299 deletions(-) delete mode 100644 packages/babel-cli/test/mocha.opts delete mode 100644 packages/babel-cli/test/tmp/bar2.js delete mode 100644 packages/babel-cli/test/tmp/foo2.js delete mode 100644 packages/babel-cli/test/tmp/not_node_modules.jsx create mode 100644 packages/babel-runtime/.npmignore rename packages/{build-runtime.js => babel-runtime/scripts/build-dist.js} (86%) rename packages/babel/scripts/{build.sh => build-dist.sh} (100%) delete mode 100644 packages/babel/test/fixtures/transformation/api/options.json delete mode 100644 packages/babel/test/fixtures/transformation/es6.regex.unicode/options.json delete mode 100644 packages/babel/test/mocha.opts delete mode 100644 packages/babel/test/tmp/bar2.js delete mode 100644 packages/babel/test/tmp/foo2.js delete mode 100644 packages/babel/test/tmp/not_node_modules.jsx delete mode 100644 packages/babylon/test/mocha.opts delete mode 100644 packages/build-cli.js rename scripts/{travis => }/build-website.sh (68%) rename scripts/{build-core.sh => build.sh} (100%) create mode 100644 scripts/publish.js delete mode 100644 scripts/travis/comment-issues.sh delete mode 100644 scripts/travis/publish-cli.sh create mode 100644 test/warning.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2cc37d6ae1..126cdb99cf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,129 +26,8 @@ contributing, please read the ## Developing -> Note: Babel moves fast. Only the latest release is guaranteed to build correctly. -> Older releases are not officially supported. If you attempt to build them, do that at your own risk. - #### Setup -```sh -$ git clone https://github.com/babel/babel -$ cd babel -$ make bootstrap -``` - -Then you can either run: - -```sh -$ make build-core -``` - -to build Babel **once** or: - -```sh -$ make watch-core -``` - -to have Babel build itself then incrementally build files on change. - -#### Running tests - -You can run tests via: - -```sh -$ make test -``` - -This is mostly overkill and you can limit the tests to a select few by directly -running them with `mocha`: - -```sh -$ mocha test/core/transformation.js -``` - -Use mocha's `--grep` option to run a subset of tests by name: - -```sh -$ mocha test/core/transformation.js --grep es7 -``` - -If you don't have `mocha` installed globally, you can still use it from Babel's -dependencies in `node_modules`, but make sure `node_modules/.bin` is added to -your [`$PATH`](http://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path) environment variable. - - -#### Workflow - -* Fork the repository -* Clone your fork and change directory to it (`git clone git@github.com:yourUserName/babel.git && cd babel`) -* Install the project dependencies (`make bootstrap`) -* Link your forked clone (`npm link`) -* Develop your changes ensuring you're fetching updates from upstream often -* Ensure the test are passing (`make test`) -* Create new pull request explaining your proposed change or reference an issue in your commit message - -#### Dependencies - -+ [ast-types](http://ghub.io/ast-types) This is required to monkeypatch regenerators AST definitions. Could be improved in the future. - -+ [chalk](http://ghub.io/chalk) This is used for terminal color highlighting for syntax errors. - -+ [convert-source-map](http://ghub.io/convert-source-map) Turns a source map object into a comment etc. - -+ [core-js](http://ghub.io/core-js) Used for the polyfill. - -+ [debug](http://ghub.io/debug) Used to output debugging information when NODE_DEBUG is set to babel. - -+ [detect-indent](http://ghub.io/detect-indent) This is used in the code generator so it can infer indentation. - -+ [estraverse](http://ghub.io/estraverse) The only method on this is attachComments. I'd like to implement our own comment attachment algorithm eventually though. - -+ [esutils](http://ghub.io/esutils) Various ES related utilities. Check whether something is a keyword etc. - -+ [fs-readdir-recursive](http://ghub.io/fs-readdir-recursive) Recursively search a directory for. - -+ [globals](http://ghub.io/globals) A list of JavaScript global variables. This is used by the scope tracking to check for colliding variables. - -+ [is-integer](http://ghub.io/is-integer) Checks if something is an integer. - -+ [js-tokens](http://ghub.io/js-tokens) This is used to get tokens for syntax error highlighting. - -+ [line-numbers](http://ghub.io/line-numbers) Used to produce the code frames in syntax errors. - -+ [lodash](http://ghub.io/lodash) Used for various utilities. - -+ [minimatch](http://ghub.io/minimatch) This is used to match glob-style ignore/only filters. - -+ [output-file-sync](http://ghub.io/output-file-sync) Synchronously writes a file and create its ancestor directories if needed. - -+ [path-is-absolute](http://ghub.io/path-is-absolute) Checks if a path is absolute. C:\foo and \foo are considered absolute. - -+ [regenerator](http://ghub.io/regenerator) This is used to transform generators/async functions. - -+ [regexpu](http://ghub.io/regexpu) Used to transform unicode regex patterns. - -+ [repeating](http://ghub.io/repeating) Repeats a string. - -+ [shebang-regex](http://ghub.io/shebang-regex) Literally just a regex that matches shebangs. - -+ [slash](http://ghub.io/slash) Normalises path separators. - -+ [source-map](http://ghub.io/source-map) Generates sourcemaps. - -+ [source-map-support](http://ghub.io/source-map-support) Adds source map support to babel-node/babel/register. - -+ [strip-json-comments](http://ghub.io/strip-json-comments) Remove comments from a JSON string. This is used for .babelrc files. - -+ [to-fast-properties](http://ghub.io/to-fast-properties) A V8 trick to put an object into fast properties mode. - -+ [trim-right](http://ghub.io/trim-right) Trims the rightside whitespace. - -+ [path-exists](https://www.npmjs.com/package/path-exists) Checks if a path exists. (replaces the deprecated `fs.exists` methods) - -+ [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) Gets the user home directory with fallback to the system temporary directory. This is used to resolve the babel-node/babel/register cache. - -+ [resolve](https://www.npmjs.com/package/resolve) Implements the [`require.resolve()` algorithm](http://nodejs.org/docs/v0.12.0/api/all.html#all_require_resolve) such that we can `require.resolve()` on behalf of a file asynchronously and synchronously. - #### Code Standards * **General** @@ -177,4 +56,5 @@ your [`$PATH`](http://unix.stackexchange.com/questions/26047/how-to-correctly-ad * No pollution of global variables and prototypes #### Internals + Please see [`/doc`](/doc) for internals documentation relevant to developing babel. diff --git a/Makefile b/Makefile index b01f576dfe..fb61dbfd5b 100644 --- a/Makefile +++ b/Makefile @@ -1,69 +1,51 @@ MAKEFLAGS = -j1 -ISTANBUL_CMD = node_modules/istanbul/lib/cli.js cover -#UGLIFY_CMD = node_modules/uglify-js/bin/uglifyjs --mangle sort -MOCHA_CMD = node_modules/mocha/bin/_mocha -BABEL_CMD = node_modules/babel/bin/babel - export NODE_ENV = test .PHONY: clean test test-cov test-clean test-travis test-browser publish build bootstrap publish-core publish-runtime build-website build-core watch-core build-core-test clean-core prepublish -build-core: clean-core - ./scripts/build-core.sh +build: clean + ./scripts/build.sh -watch-core: clean-core - ./scripts/build-core.sh --watch +build-dist: build + cd packages/babel; \ + scripts/build-dist.sh + cd packages/babel-runtime; \ + node scripts/build-dist.js -clean-core: - rm -rf packages/*/lib +watch: clean + scripts/build.sh --watch lint: eslint packages/*/src -build: build-core - cd packages/babel; \ - scripts/build.sh - -clean: - rm -rf coverage packages/babel/templates.json test/tmp dist lib +clean: test-clean + rm -rf coverage + rm -rf packages/*/dist dist + rm -rf packages/*/lib packages/babel/templates.json test-clean: - rm -rf test/tmp + rm -rf packages/*/test/tmp -test: +test: lint ./scripts/test.sh make test-clean test-browser: ./scripts/test-browser.sh -test-cov: - rm -rf coverage +test-cov: clean BABEL_ENV=test; \ - make build-core + make build node $(ISTANBUL_CMD) $(MOCHA_CMD) -- test/core test-travis: bootstrap lint build test -publish: lint +publish: build-dist git pull --rebase make test - read -p "Version: " version; \ - npm version $$version --message "v%s" - git push --follow-tags - -publish-runtime: - cd packages; \ - node build-runtime.js; \ - cd babel-runtime; \ - npm publish - -travis-deploy: - @./scripts/travis/publish-cli.sh - make publish-runtime - @./scripts/travis/build-website.sh - @./scripts/travis/comment-issues.sh + node scripts/publish + ./scripts/build-website.sh bootstrap: ./scripts/bootstrap.sh diff --git a/package.json b/package.json index 78d6a95f39..0ad8fbb238 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "chai": "^2.2.0", "es5-shim": "^4.1.7", "eslint": "^0.21.2", - "esvalid": "^1.1.0", "fs-readdir-recursive": "^0.1.2", "istanbul": "^0.3.5", "matcha": "^0.6.0", @@ -15,6 +14,7 @@ "output-file-sync": "^1.1.1", "path-exists": "^1.0.0", "rimraf": "^2.4.1", + "semver": "^5.0.0", "uglify-js": "^2.4.16" } } diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 652158f429..ed060efda5 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -7,6 +7,7 @@ "repository": "babel/babel", "preferGlobal": true, "dependencies": { + "babel": "*", "chokidar": "^1.0.0", "commander": "^2.6.0", "convert-source-map": "^1.1.0", diff --git a/packages/babel-cli/test/mocha.opts b/packages/babel-cli/test/mocha.opts deleted file mode 100644 index 850a6c2f64..0000000000 --- a/packages/babel-cli/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---reporter dot ---ui tdd diff --git a/packages/babel-cli/test/tmp/bar2.js b/packages/babel-cli/test/tmp/bar2.js deleted file mode 100644 index 26c2d21a78..0000000000 --- a/packages/babel-cli/test/tmp/bar2.js +++ /dev/null @@ -1,2 +0,0 @@ -var bar = () => console.log("bar"); -bar(); \ No newline at end of file diff --git a/packages/babel-cli/test/tmp/foo2.js b/packages/babel-cli/test/tmp/foo2.js deleted file mode 100644 index 4c4e8d7d6d..0000000000 --- a/packages/babel-cli/test/tmp/foo2.js +++ /dev/null @@ -1,5 +0,0 @@ -import "./bar2"; -import "./not_node_modules"; - -var foo = () => console.log("foo"); -foo(); \ No newline at end of file diff --git a/packages/babel-cli/test/tmp/not_node_modules.jsx b/packages/babel-cli/test/tmp/not_node_modules.jsx deleted file mode 100644 index d46284bf2d..0000000000 --- a/packages/babel-cli/test/tmp/not_node_modules.jsx +++ /dev/null @@ -1,10 +0,0 @@ -/* -The purpose of this file is to test that the node_modules check in the require -hook doesn't mistakenly exclude something like "not_node_modules". To pass, this -file merely needs to be transpiled. The transpiled code won't, and doesn't need -to, execute without error. It won't execute because React will be undefined. -*/ -try { - ; -} -catch (e) {} \ No newline at end of file diff --git a/packages/babel-runtime/.npmignore b/packages/babel-runtime/.npmignore new file mode 100644 index 0000000000..3efd5b92d4 --- /dev/null +++ b/packages/babel-runtime/.npmignore @@ -0,0 +1,2 @@ +scripts +node_modules diff --git a/packages/build-runtime.js b/packages/babel-runtime/scripts/build-dist.js similarity index 86% rename from packages/build-runtime.js rename to packages/babel-runtime/scripts/build-dist.js index 962126bfa4..1b8e12a6ec 100644 --- a/packages/build-runtime.js +++ b/packages/babel-runtime/scripts/build-dist.js @@ -1,5 +1,3 @@ -"use strict"; - var outputFile = require("output-file-sync"); var transform = require("../lib/babel/transformation"); var each = require("lodash/collection/each"); @@ -10,7 +8,7 @@ var t = require("../lib/babel/types"); var _ = require("lodash"); function relative(filename) { - return __dirname + "/babel-runtime/" + filename; + return __dirname + "/../" + filename; } function readFile(filename, shouldDefaultify) { @@ -27,16 +25,6 @@ function defaultify(name) { return 'module.exports = { "default": ' + name + ', __esModule: true };'; } -function updatePackage() { - var pkgLoc = relative("package.json"); - var pkg = require(pkgLoc); - - var mainPkg = require("../package.json"); - pkg.version = mainPkg.version; - - writeRootFile("package.json", JSON.stringify(pkg, null, 2)); -} - function writeRootFile(filename, content) { filename = relative(filename); console.log(filename); @@ -92,5 +80,3 @@ each(paths, function (path) { writeFile("core-js/" + path + ".js", defaultify('require("core-js/library/fn/' + path + '")')); }); - -updatePackage(); diff --git a/packages/babel/.npmignore b/packages/babel/.npmignore index 8d2dc7c4cf..f6cf7ce26a 100644 --- a/packages/babel/.npmignore +++ b/packages/babel/.npmignore @@ -3,14 +3,10 @@ .* /lib/transformation/templates /test -/benchmark -/Makefile /dist /tests.json /CHANGELOG.md /.package.json -/coverage -/vendor /packages /src _babel.github.io diff --git a/packages/babel/package.json b/packages/babel/package.json index dfe9bd4114..d1826655dd 100644 --- a/packages/babel/package.json +++ b/packages/babel/package.json @@ -41,6 +41,7 @@ "babel-plugin-runtime": "^1.0.7", "babel-plugin-undeclared-variables-check": "^1.0.2", "babel-plugin-undefined-to-void": "^1.1.6", + "babylon": "*", "bluebird": "^2.9.33", "chalk": "^1.0.0", "convert-source-map": "^1.1.0", diff --git a/packages/babel/scripts/build.sh b/packages/babel/scripts/build-dist.sh similarity index 100% rename from packages/babel/scripts/build.sh rename to packages/babel/scripts/build-dist.sh diff --git a/packages/babel/test/_helper.js b/packages/babel/test/_helper.js index 1d4d325255..d66bde6363 100644 --- a/packages/babel/test/_helper.js +++ b/packages/babel/test/_helper.js @@ -1,5 +1,4 @@ var pathExists = require("path-exists"); -var esvalid = require("esvalid"); var util = require("../lib/util"); var path = require("path"); var fs = require("fs"); @@ -20,17 +19,6 @@ var readFile = exports.readFile = function (filename) { } }; -exports.esvalid = function (ast, code, loc) { - var errors = esvalid.errors(ast); - if (errors.length) { - var msg = []; - _.each(errors, function (err) { - msg.push(err.message + " - " + util.inspect(err.node)); - }); - throw new Error(loc + ": " + msg.join(". ") + "\n" + code); - } -}; - exports.assertVendor = function (name) { if (!pathExists.sync(__dirname + "/../../../vendor/" + name)) { console.error("No vendor/" + name + " - run `make bootstrap`"); diff --git a/packages/babel/test/_transformation-helper.js b/packages/babel/test/_transformation-helper.js index f115800613..baa99bfe5c 100644 --- a/packages/babel/test/_transformation-helper.js +++ b/packages/babel/test/_transformation-helper.js @@ -44,6 +44,7 @@ chai.assert.throw = function (fn, msg) { return chai.assert._throw(fn, msg); }; + var run = function (task, done) { var actual = task.actual; var expect = task.expect; @@ -60,14 +61,6 @@ var run = function (task, done) { var execCode = exec.code; var result; - var noCheckAst = opts.noCheckAst; - delete opts.noCheckAst; - - var checkAst = function (result, opts) { - if (noCheckAst) return; - helper.esvalid(result.ast.program, result.code, opts.loc); - }; - if (execCode) { result = transform(execCode, getOpts(exec)); execCode = result.code; @@ -90,8 +83,6 @@ var run = function (task, done) { err.message += codeFrame(execCode); throw err; } - - checkAst(result, exec); } var actualCode = actual.code; @@ -106,8 +97,6 @@ var run = function (task, done) { //require("fs").writeFileSync(expect.loc, actualCode); throw err; } - - checkAst(result, actual); } if (task.sourceMap) { diff --git a/packages/babel/test/fixtures/transformation/api/options.json b/packages/babel/test/fixtures/transformation/api/options.json deleted file mode 100644 index df1ae3d305..0000000000 --- a/packages/babel/test/fixtures/transformation/api/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "noCheckAst": true -} diff --git a/packages/babel/test/fixtures/transformation/async-to-generator/options.json b/packages/babel/test/fixtures/transformation/async-to-generator/options.json index 66f9b5aed0..58a90a50f5 100644 --- a/packages/babel/test/fixtures/transformation/async-to-generator/options.json +++ b/packages/babel/test/fixtures/transformation/async-to-generator/options.json @@ -1,5 +1,4 @@ { "externalHelpers": true, - "noCheckAst": true, "optional": ["asyncToGenerator"] } diff --git a/packages/babel/test/fixtures/transformation/bluebird-coroutines/options.json b/packages/babel/test/fixtures/transformation/bluebird-coroutines/options.json index beb0408342..264ef8fbf1 100644 --- a/packages/babel/test/fixtures/transformation/bluebird-coroutines/options.json +++ b/packages/babel/test/fixtures/transformation/bluebird-coroutines/options.json @@ -1,4 +1,3 @@ { - "optional": ["bluebirdCoroutines"], - "noCheckAst": true + "optional": ["bluebirdCoroutines"] } diff --git a/packages/babel/test/fixtures/transformation/es6.modules/comments-explosion/options.json b/packages/babel/test/fixtures/transformation/es6.modules/comments-explosion/options.json index 3c07e6da8c..896d86d463 100644 --- a/packages/babel/test/fixtures/transformation/es6.modules/comments-explosion/options.json +++ b/packages/babel/test/fixtures/transformation/es6.modules/comments-explosion/options.json @@ -1,4 +1,3 @@ { - "blacklist": ["es6.modules"], - "noCheckAst": true + "blacklist": ["es6.modules"] } diff --git a/packages/babel/test/fixtures/transformation/es6.regex.unicode/options.json b/packages/babel/test/fixtures/transformation/es6.regex.unicode/options.json deleted file mode 100644 index df1ae3d305..0000000000 --- a/packages/babel/test/fixtures/transformation/es6.regex.unicode/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "noCheckAst": true -} diff --git a/packages/babel/test/fixtures/transformation/es7.export-extensions/options.json b/packages/babel/test/fixtures/transformation/es7.export-extensions/options.json index e5a4490293..1a6e61aa55 100644 --- a/packages/babel/test/fixtures/transformation/es7.export-extensions/options.json +++ b/packages/babel/test/fixtures/transformation/es7.export-extensions/options.json @@ -1,5 +1,4 @@ { - "noCheckAst": true, "externalHelpers": true, "optional": "es7.exportExtensions" } diff --git a/packages/babel/test/fixtures/transformation/flow/options.json b/packages/babel/test/fixtures/transformation/flow/options.json index d19f6a5598..1ed4f62ce4 100644 --- a/packages/babel/test/fixtures/transformation/flow/options.json +++ b/packages/babel/test/fixtures/transformation/flow/options.json @@ -1,4 +1,3 @@ { - "whitelist": ["flow", "es7.asyncFunctions", "es7.classProperties"], - "noCheckAst": true + "whitelist": ["flow", "es7.asyncFunctions", "es7.classProperties"] } diff --git a/packages/babel/test/fixtures/transformation/minification.dead-code-elimination/options.json b/packages/babel/test/fixtures/transformation/minification.dead-code-elimination/options.json index d0d3299cba..d3218f85cd 100644 --- a/packages/babel/test/fixtures/transformation/minification.dead-code-elimination/options.json +++ b/packages/babel/test/fixtures/transformation/minification.dead-code-elimination/options.json @@ -1,7 +1,6 @@ { "experimental": true, "externalHelpers": true, - "noCheckAst": true, "blacklist": ["regenerator"], "optional": ["minification.deadCodeElimination"] } diff --git a/packages/babel/test/fixtures/transformation/misc/enforce-newline-modules-blacklist/options.json b/packages/babel/test/fixtures/transformation/misc/enforce-newline-modules-blacklist/options.json index 3c07e6da8c..896d86d463 100644 --- a/packages/babel/test/fixtures/transformation/misc/enforce-newline-modules-blacklist/options.json +++ b/packages/babel/test/fixtures/transformation/misc/enforce-newline-modules-blacklist/options.json @@ -1,4 +1,3 @@ { - "blacklist": ["es6.modules"], - "noCheckAst": true + "blacklist": ["es6.modules"] } diff --git a/packages/babel/test/fixtures/transformation/optimisation.react.constant-elements/options.json b/packages/babel/test/fixtures/transformation/optimisation.react.constant-elements/options.json index 68adf800b3..4b11341de8 100644 --- a/packages/babel/test/fixtures/transformation/optimisation.react.constant-elements/options.json +++ b/packages/babel/test/fixtures/transformation/optimisation.react.constant-elements/options.json @@ -1,5 +1,4 @@ { - "noCheckAst": true, "optional": ["optimisation.react.constantElements"], "blacklist": ["react", "react.displayName"] } diff --git a/packages/babel/test/fixtures/transformation/optimisation.react.inline-elements/options.json b/packages/babel/test/fixtures/transformation/optimisation.react.inline-elements/options.json index a0efc4990e..a867493bdc 100644 --- a/packages/babel/test/fixtures/transformation/optimisation.react.inline-elements/options.json +++ b/packages/babel/test/fixtures/transformation/optimisation.react.inline-elements/options.json @@ -1,5 +1,4 @@ { "externalHelpers": true, - "noCheckAst": true, "optional": ["optimisation.react.inlineElements"] } diff --git a/packages/babel/test/fixtures/transformation/spec.function-name/export/options.json b/packages/babel/test/fixtures/transformation/spec.function-name/export/options.json index f66d497de1..896d86d463 100644 --- a/packages/babel/test/fixtures/transformation/spec.function-name/export/options.json +++ b/packages/babel/test/fixtures/transformation/spec.function-name/export/options.json @@ -1,4 +1,3 @@ { - "noCheckAst": true, "blacklist": ["es6.modules"] } diff --git a/packages/babel/test/mocha.opts b/packages/babel/test/mocha.opts deleted file mode 100644 index 850a6c2f64..0000000000 --- a/packages/babel/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---reporter dot ---ui tdd diff --git a/packages/babel/test/tmp/bar2.js b/packages/babel/test/tmp/bar2.js deleted file mode 100644 index 26c2d21a78..0000000000 --- a/packages/babel/test/tmp/bar2.js +++ /dev/null @@ -1,2 +0,0 @@ -var bar = () => console.log("bar"); -bar(); \ No newline at end of file diff --git a/packages/babel/test/tmp/foo2.js b/packages/babel/test/tmp/foo2.js deleted file mode 100644 index 4c4e8d7d6d..0000000000 --- a/packages/babel/test/tmp/foo2.js +++ /dev/null @@ -1,5 +0,0 @@ -import "./bar2"; -import "./not_node_modules"; - -var foo = () => console.log("foo"); -foo(); \ No newline at end of file diff --git a/packages/babel/test/tmp/not_node_modules.jsx b/packages/babel/test/tmp/not_node_modules.jsx deleted file mode 100644 index d46284bf2d..0000000000 --- a/packages/babel/test/tmp/not_node_modules.jsx +++ /dev/null @@ -1,10 +0,0 @@ -/* -The purpose of this file is to test that the node_modules check in the require -hook doesn't mistakenly exclude something like "not_node_modules". To pass, this -file merely needs to be transpiled. The transpiled code won't, and doesn't need -to, execute without error. It won't execute because React will be undefined. -*/ -try { - ; -} -catch (e) {} \ No newline at end of file diff --git a/packages/babylon/src/tokenize.js b/packages/babylon/src/tokenize.js index fbe25a01f2..9d09561bce 100755 --- a/packages/babylon/src/tokenize.js +++ b/packages/babylon/src/tokenize.js @@ -30,6 +30,7 @@ export class Token { const pp = Parser.prototype; // Are we running under Rhino? +/* global Packages */ const isRhino = typeof Packages === "object" && Object.prototype.toString.call(Packages) === "[object JavaPackage]"; // Move to the next token diff --git a/packages/babylon/test/mocha.opts b/packages/babylon/test/mocha.opts deleted file mode 100644 index 850a6c2f64..0000000000 --- a/packages/babylon/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---reporter dot ---ui tdd diff --git a/packages/build-cli.js b/packages/build-cli.js deleted file mode 100644 index ab3568fbdd..0000000000 --- a/packages/build-cli.js +++ /dev/null @@ -1,11 +0,0 @@ -var outputFile = require("output-file-sync"); - -var pkgLoc = __dirname + "/babel-cli/package.json"; -var pkg = require(pkgLoc); - -var mainPkg = require("../package.json"); - -pkg.version = mainPkg.version; -pkg.dependencies["babel-core"] = "^" + mainPkg.version; - -outputFile(pkgLoc, JSON.stringify(pkg, null, 2)); diff --git a/scripts/travis/build-website.sh b/scripts/build-website.sh similarity index 68% rename from scripts/travis/build-website.sh rename to scripts/build-website.sh index b6dce23e48..70bf240cfb 100644 --- a/scripts/travis/build-website.sh +++ b/scripts/build-website.sh @@ -12,5 +12,5 @@ if [ ! -d ./_babel ]; then fi make build -git commit -am "${TRAVIS_TAG}" -git push "https://${GH_TOKEN}@github.com/babel/babel.github.io" +git commit -am "v`babel -V`" +git push diff --git a/scripts/build-core.sh b/scripts/build.sh similarity index 100% rename from scripts/build-core.sh rename to scripts/build.sh diff --git a/scripts/publish.js b/scripts/publish.js new file mode 100644 index 0000000000..f0a01d420d --- /dev/null +++ b/scripts/publish.js @@ -0,0 +1,3 @@ +var fs = require("fs"); + +var packageNames = fs.readDirSync(__filename + "/../packages"); diff --git a/scripts/test.sh b/scripts/test.sh index 92d8d29513..bbe6c70e8a 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,15 +1,16 @@ #!/bin/sh set -e +TEST_DIRS="" + for f in packages/*; do if [ -n "$TEST_ONLY" ] && [ `basename $f` != "$TEST_ONLY" ]; then continue fi if [ -d "$f/test" ]; then - echo $f - cd $f - node ../../node_modules/mocha/bin/_mocha - cd ../../ + TEST_DIRS="$f/test $TEST_DIRS" fi done + +node node_modules/mocha/bin/_mocha $TEST_DIRS --reporter dot --ui tdd diff --git a/scripts/travis/comment-issues.sh b/scripts/travis/comment-issues.sh deleted file mode 100644 index 2005ff9b31..0000000000 --- a/scripts/travis/comment-issues.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -set -e diff --git a/scripts/travis/publish-cli.sh b/scripts/travis/publish-cli.sh deleted file mode 100644 index 0598b7e1e9..0000000000 --- a/scripts/travis/publish-cli.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -e - -LAST_TAG=$(git describe $(git rev-list --tags --max-count=1)) -TAG_DIFF=$(git diff $LAST_TAG -- packages/babel-cli/) - -if [ -n "$TAG_DIFF" ]; then - echo "Changes detected to babel-cli since last tag, publishing new version." - - cd ../packages - node build-cli.js - - cd babel-cli - npm publish -else - echo "No changes detected to babel-cli since last tag" -fi diff --git a/test/warning.js b/test/warning.js new file mode 100644 index 0000000000..072f4a8f07 --- /dev/null +++ b/test/warning.js @@ -0,0 +1,2 @@ +console.error("Don't run `mocha` directly. Use `make test`. See CONTRIBUTING.md for usage instructions."); +process.exit(0);