From 06a158c395f4eff4fdd59dc5f30aee7f2fd80b59 Mon Sep 17 00:00:00 2001
From: Patrick Browne <pt.browne@gmail.com>
Date: Wed, 29 Jan 2020 14:38:37 +0100
Subject: [PATCH 1/2] fix: Revert "refactor: Mv default arg of BABEL_OUTPUT_DIR
 to transpile:*"

This reverts commit 9c21d353b00487a26c73cbc6df568754ee180ae6.
---
 package.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json
index 872678663a..b7e24e7d9a 100644
--- a/package.json
+++ b/package.json
@@ -48,9 +48,9 @@
     "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:react": "babel react/ --out-dir $BABEL_OUTPUT_DIR/react --verbose",
+    "transpile:helpers": "env babel helpers/ --out-dir $BABEL_OUTPUT_DIR/helpers --verbose",
+    "transpile": "env BABEL_OUTPUT_DIR=${BABEL_OUTPUT_DIR:-transpiled} 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",
     "posttranspile": "postcss transpiled/react/stylesheet.css --replace",
     "posttranspile:es5": "postcss es5/react/stylesheet.css --replace",

From 9081029346da08a38eaa45499bfa88748ddb2637 Mon Sep 17 00:00:00 2001
From: Patrick Browne <pt.browne@gmail.com>
Date: Wed, 29 Jan 2020 14:38:46 +0100
Subject: [PATCH 2/2] fix: Revert "feat: Distribute es5 packages"

This reverts commit 67827fb7d4737948f50af47e2bab5192a69b9c81.
---
 .gitignore      |  1 -
 babel.config.js | 35 ++++++++++++-----------------------
 package.json    | 10 ++++------
 3 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/.gitignore b/.gitignore
index dc10340290..d3a1bb7fe7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,4 +26,3 @@ transpiled
 react/Icon/icons-sprite.js
 react/palette.js
 screenshots/
-es5
diff --git a/babel.config.js b/babel.config.js
index e79bbbd717..04c919adde 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -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
@@ -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: [
     [
@@ -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 } }]],
diff --git a/package.json b/package.json
index b7e24e7d9a..de489deaea 100644
--- a/package.json
+++ b/package.json
@@ -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": "babel react/ --out-dir $BABEL_OUTPUT_DIR/react --verbose",
-    "transpile:helpers": "env babel helpers/ --out-dir $BABEL_OUTPUT_DIR/helpers --verbose",
-    "transpile": "env BABEL_OUTPUT_DIR=${BABEL_OUTPUT_DIR:-transpiled} 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",