Merge pull request #8201 from ahocevar/no-babelrc
Remove babelrc, transform using babel-core
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["jsdoc-closure"],
|
|
||||||
"parserOpts": {
|
|
||||||
"parser": "recast"
|
|
||||||
},
|
|
||||||
"generatorOpts": {
|
|
||||||
"generator": "recast"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-3
@@ -16,11 +16,11 @@
|
|||||||
"karma": "karma start test/karma.config.js",
|
"karma": "karma start test/karma.config.js",
|
||||||
"serve-examples": "mkdir -p build/examples && webpack --config examples/webpack/config.js --watch & serve build/examples",
|
"serve-examples": "mkdir -p build/examples && webpack --config examples/webpack/config.js --watch & serve build/examples",
|
||||||
"build-examples": "webpack --config examples/webpack/config.js --env=prod",
|
"build-examples": "webpack --config examples/webpack/config.js --env=prod",
|
||||||
"build-index": "node tasks/generate-index.js",
|
"build-index": "node tasks/generate-index",
|
||||||
"prebuild": "npm run build-index",
|
"prebuild": "npm run build-index",
|
||||||
"build": "webpack --config config/webpack.js",
|
"build": "webpack --config config/webpack.js",
|
||||||
"presrc-closure": "npm run prebuild",
|
"presrc-closure": "npm run prebuild",
|
||||||
"src-closure": "babel -q --out-dir build/src-closure src/",
|
"src-closure": "node tasks/transform-types",
|
||||||
"pretypecheck": "npm run src-closure",
|
"pretypecheck": "npm run src-closure",
|
||||||
"typecheck": "node tasks/typecheck",
|
"typecheck": "node tasks/typecheck",
|
||||||
"apidoc": "jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
|
"apidoc": "jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"rbush": "2.0.2"
|
"rbush": "2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "6.26.0",
|
"babel-core": "^6.26.3",
|
||||||
"babel-minify-webpack-plugin": "^0.3.0",
|
"babel-minify-webpack-plugin": "^0.3.0",
|
||||||
"babel-plugin-jsdoc-closure": "1.5.1",
|
"babel-plugin-jsdoc-closure": "1.5.1",
|
||||||
"chaikin-smooth": "1.0.4",
|
"chaikin-smooth": "1.0.4",
|
||||||
@@ -56,6 +56,7 @@
|
|||||||
"expect.js": "0.3.1",
|
"expect.js": "0.3.1",
|
||||||
"front-matter": "^2.1.2",
|
"front-matter": "^2.1.2",
|
||||||
"fs-extra": "^6.0.0",
|
"fs-extra": "^6.0.0",
|
||||||
|
"glob": "^7.1.2",
|
||||||
"google-closure-compiler": "20180506.0.0",
|
"google-closure-compiler": "20180506.0.0",
|
||||||
"handlebars": "4.0.11",
|
"handlebars": "4.0.11",
|
||||||
"html-webpack-plugin": "^3.0.1",
|
"html-webpack-plugin": "^3.0.1",
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* @filedesc
|
||||||
|
* Transforms type comments in all source files to types that Closure Compiler
|
||||||
|
* understands.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const glob = require('glob');
|
||||||
|
const mkdirp = require('mkdirp').sync;
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const transform = require('babel-core').transformFileSync;
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
plugins: 'jsdoc-closure',
|
||||||
|
parserOpts: {
|
||||||
|
parser: 'recast'
|
||||||
|
},
|
||||||
|
generatorOpts: {
|
||||||
|
generator: 'recast'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const outDir = path.join('build', 'src-closure');
|
||||||
|
|
||||||
|
glob('src/**/*.js', (err, matches) => {
|
||||||
|
matches.forEach(match => {
|
||||||
|
const out = path.join(outDir, path.relative('src', match));
|
||||||
|
mkdirp(path.dirname(out));
|
||||||
|
fs.writeFileSync(out, transform(match, options).code, 'utf-8');
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user