Skip to content

Commit

Permalink
Revert ES5 transpilation (#1374)
Browse files Browse the repository at this point in the history
Revert ES5 transpilation
  • Loading branch information
ptbrowne authored Jan 29, 2020
2 parents 196401b + 9081029 commit 8f3c7c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 30 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ transpiled
react/Icon/icons-sprite.js
react/palette.js
screenshots/
es5
35 changes: 12 additions & 23 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const path = require('path')
const { isUsingDevStyleguidist } = require('./scripts/build-utils')

const TRANSPILATION_DIRECTORY = process.env.BABEL_ENV === 'transpilationES5' ? 'es5' : 'transpiled'

const plugins = [
// While developing on the styleguidist, we do not want babel to touch the CSS
// otherwise CSS hot reload does not work
Expand All @@ -13,26 +11,13 @@ const plugins = [
{
extensions: ['.styl'],
preprocessCss: './preprocess',
extractCss: `./${TRANSPILATION_DIRECTORY}/react/stylesheet.css`,
extractCss: './transpiled/react/stylesheet.css',
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
],
['inline-json-import', {}]
].filter(Boolean)

const transpilationPlugins = [
...plugins,
[
'./scripts/babel-transform-relative-paths-plugin.js',
{
from: path.resolve(__dirname, './react'),
to: `cozy-ui/${TRANSPILATION_DIRECTORY}/react`
}
]
]

const transpilationIgnores = ['**/*.spec.jsx', '**/*.spec.js']

module.exports = {
presets: [
[
Expand All @@ -42,13 +27,17 @@ module.exports = {
],
env: {
transpilation: {
plugins: transpilationPlugins,
ignore: transpilationIgnores
},
transpilationES5: {
presets: [['cozy-app', { transformRuntime: { helpers: true } }]],
plugins: transpilationPlugins,
ignore: transpilationIgnores
plugins: [
...plugins,
[
'./scripts/babel-transform-relative-paths-plugin.js',
{
from: path.resolve(__dirname, './react'),
to: 'cozy-ui/transpiled/react'
}
]
],
ignore: ['**/*.spec.jsx', '**/*.spec.js']
},
test: {
presets: [['cozy-app', { transformRuntime: { helpers: true } }]],
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,17 @@
"prebuild:doc:kss": "run-s clean:doc:kss build:css:kss",
"prepare": "yarn release",
"prepush": "[[ $(git rev-parse --abbrev-ref HEAD) != 'gh-pages' ]] && yarn lint || true",
"release": "npm-run-all --parallel sprite palette && yarn transpile && yarn transpile:es5",
"release": "npm-run-all --parallel sprite palette && yarn transpile",
"semantic-release": "semantic-release",
"sprite": "scripts/make-icon-sprite.sh",
"jest": "yarn test:jest",
"screenshots": "node scripts/screenshots.js --screenshot-dir ./screenshots --styleguide-dir ./build/react",
"test": "yarn test:jest",
"test:jest": "jest",
"transpile:react": "env BABEL_OUTPUT_DIR=${BABEL_OUTPUT_DIR:-transpiled} bash -c \"babel react/ --out-dir \\$BABEL_OUTPUT_DIR/react --verbose\"",
"transpile:helpers": "env BABEL_OUTPUT_DIR=${BABEL_OUTPUT_DIR:-transpiled} bash -c \"env babel helpers/ --out-dir \\$BABEL_OUTPUT_DIR/helpers --verbose\"",
"transpile": "env BABEL_ENV=${BABEL_ENV:-transpilation} bash -c \"yarn transpile:react && yarn transpile:helpers\"",
"transpile:es5": "env BABEL_OUTPUT_DIR=es5 BABEL_ENV=transpilationES5 yarn transpile",
"transpile:react": "env BABEL_ENV=transpilation babel react/ --out-dir transpiled/react --verbose",
"transpile:helpers": "babel helpers/ --out-dir transpiled/helpers --verbose",
"transpile": "yarn transpile:react && yarn transpile:helpers",
"posttranspile": "postcss transpiled/react/stylesheet.css --replace",
"posttranspile:es5": "postcss es5/react/stylesheet.css --replace",
"travis-deploy-once": "travis-deploy-once",
"watch:css": "yarn build:css --watch",
"prewatch:doc:react": "yarn sprite",
Expand Down

0 comments on commit 8f3c7c9

Please sign in to comment.