Add .babelrc.js for a temporary time period
This commit is contained in:
parent
784488de12
commit
9af5a888d6
2 changed files with 59 additions and 0 deletions
58
debian/patches/0720-use-babelrc.js-tmp.patch
vendored
Normal file
58
debian/patches/0720-use-babelrc.js-tmp.patch
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
Description: Using .babelrc.js out of babel.config.js for a temporary
|
||||
period of time :)
|
||||
Author: Utkarsh Gupta <guptautkarsh2102@gmail.com>
|
||||
|
||||
--- /dev/null
|
||||
+++ gitlab-11.10.4+dfsg/.babelrc.js
|
||||
@@ -0,0 +1,51 @@
|
||||
+/* eslint-disable import/no-commonjs, filenames/match-regex */
|
||||
+
|
||||
+const BABEL_ENV = process.env.BABEL_ENV || process.env.NODE_ENV || null;
|
||||
+
|
||||
+const presets = [
|
||||
+ [
|
||||
+ '@babel/preset-env',
|
||||
+ {
|
||||
+ modules: false,
|
||||
+ targets: {
|
||||
+ ie: '11',
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
+];
|
||||
+
|
||||
+// include stage 3 proposals
|
||||
+const plugins = [
|
||||
+ '@babel/plugin-syntax-dynamic-import',
|
||||
+ '@babel/plugin-syntax-import-meta',
|
||||
+ '@babel/plugin-proposal-class-properties',
|
||||
+ '@babel/plugin-proposal-json-strings',
|
||||
+ '@babel/plugin-proposal-private-methods',
|
||||
+];
|
||||
+
|
||||
+// add code coverage tooling if necessary
|
||||
+if (BABEL_ENV === 'coverage') {
|
||||
+ plugins.push([
|
||||
+ 'babel-plugin-istanbul',
|
||||
+ {
|
||||
+ exclude: ['spec/javascripts/**/*', 'app/assets/javascripts/locale/**/app.js'],
|
||||
+ },
|
||||
+ ]);
|
||||
+}
|
||||
+
|
||||
+// add rewire support when running tests
|
||||
+if (BABEL_ENV === 'karma' || BABEL_ENV === 'coverage') {
|
||||
+ plugins.push('babel-plugin-rewire');
|
||||
+}
|
||||
+
|
||||
+// Jest is running in node environment
|
||||
+if (BABEL_ENV === 'jest') {
|
||||
+ plugins.push('@babel/plugin-transform-modules-commonjs');
|
||||
+ /*
|
||||
+ without the following, babel-plugin-istanbul throws an error:
|
||||
+ https://gitlab.com/gitlab-org/gitlab-ce/issues/58390
|
||||
+ */
|
||||
+ plugins.push('babel-plugin-dynamic-import-node');
|
||||
+}
|
||||
+
|
||||
+module.exports = { presets, plugins };
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
|
@ -31,3 +31,4 @@
|
|||
0690-debian-usage-ping.patch
|
||||
0700-add-salsa-link-to-help.patch
|
||||
0710-use-yarnpkg.patch
|
||||
0720-use-babelrc.js-tmp.patch
|
||||
|
|
Loading…
Add table
Reference in a new issue