Commit 5ed4716a authored by Fatih Acet's avatar Fatih Acet

Merge branch '43511-upgrade-to-babel-7' into 'master'

Upgrade to Babel 7

Closes #43511

See merge request gitlab-org/gitlab-ce!22059
parents 8a8ae2f5 5d8967f3
{
"presets": [["latest", { "es2015": { "modules": false } }], "stage-2"],
"env": {
"karma": {
"plugins": ["rewire"]
},
"coverage": {
"plugins": [
[
"istanbul",
{
"exclude": ["spec/javascripts/**/*", "app/assets/javascripts/locale/**/app.js"]
}
],
[
"transform-define",
{
"process.env.BABEL_ENV": "coverage"
}
],
"rewire"
]
}
}
}
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',
];
// 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');
}
module.exports = { presets, plugins };
...@@ -585,3 +585,17 @@ ...@@ -585,3 +585,17 @@
and are therefore exempt. and are therefore exempt.
:versions: [] :versions: []
:when: 2018-08-30 12:06:35.668181000 Z :when: 2018-08-30 12:06:35.668181000 Z
- - :approve
- caniuse-lite
- :who: Mike Greiling
:why: CC-BY-4.0 license. Tool only used during build process, code is not present
in compiled/distributed product so attribution not needed.
:versions: []
:when: 2018-10-02 19:23:11.221660000 Z
- - :approve
- node-releases
- :who: Mike Greiling
:why: CC-BY-4.0 license. Tool only used during build process, code is not present
in compiled/distributed product so attribution not needed.
:versions: []
:when: 2018-10-02 19:23:54.840151000 Z
...@@ -22,6 +22,13 @@ webpackConfig.optimization.splitChunks = false; ...@@ -22,6 +22,13 @@ webpackConfig.optimization.splitChunks = false;
// use quicker sourcemap option // use quicker sourcemap option
webpackConfig.devtool = 'cheap-inline-source-map'; webpackConfig.devtool = 'cheap-inline-source-map';
// set BABEL_ENV to indicate when we're running code coverage
webpackConfig.plugins.push(
new webpack.DefinePlugin({
'process.env.BABEL_ENV': JSON.stringify(process.env.BABEL_ENV || process.env.NODE_ENV || null),
})
);
const specFilters = argumentsParser const specFilters = argumentsParser
.option( .option(
'-f, --filter-spec [filter]', '-f, --filter-spec [filter]',
...@@ -84,7 +91,7 @@ module.exports = function(config) { ...@@ -84,7 +91,7 @@ module.exports = function(config) {
basePath: ROOT_PATH, basePath: ROOT_PATH,
browsers: ['ChromeHeadlessCustom'], browsers: ['ChromeHeadlessCustom'],
client: { client: {
color: !process.env.CI color: !process.env.CI,
}, },
customLaunchers: { customLaunchers: {
ChromeHeadlessCustom: { ChromeHeadlessCustom: {
......
...@@ -18,15 +18,17 @@ ...@@ -18,15 +18,17 @@
"webpack-prod": "NODE_ENV=production webpack --config config/webpack.config.js" "webpack-prod": "NODE_ENV=production webpack --config config/webpack.config.js"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@gitlab-org/gitlab-svgs": "^1.29.0", "@gitlab-org/gitlab-svgs": "^1.29.0",
"@gitlab-org/gitlab-ui": "^1.8.0", "@gitlab-org/gitlab-ui": "^1.8.0",
"autosize": "^4.0.0", "autosize": "^4.0.0",
"axios": "^0.17.1", "axios": "^0.17.1",
"babel-core": "^6.26.3", "babel-loader": "^8.0.4",
"babel-loader": "^7.1.5",
"babel-plugin-transform-define": "^1.3.0",
"babel-preset-latest": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"blackst0ne-mermaid": "^7.1.0-fixed", "blackst0ne-mermaid": "^7.1.0-fixed",
"bootstrap": "4.1.1", "bootstrap": "4.1.1",
"brace-expansion": "^1.1.8", "brace-expansion": "^1.1.8",
...@@ -111,7 +113,7 @@ ...@@ -111,7 +113,7 @@
"devDependencies": { "devDependencies": {
"axios-mock-adapter": "^1.15.0", "axios-mock-adapter": "^1.15.0",
"babel-eslint": "^9.0.0", "babel-eslint": "^9.0.0",
"babel-plugin-istanbul": "^5.0.1", "babel-plugin-istanbul": "^5.1.0",
"babel-plugin-rewire": "^1.2.0", "babel-plugin-rewire": "^1.2.0",
"babel-template": "^6.26.0", "babel-template": "^6.26.0",
"babel-types": "^6.26.0", "babel-types": "^6.26.0",
...@@ -135,7 +137,7 @@ ...@@ -135,7 +137,7 @@
"jasmine-jquery": "^2.1.1", "jasmine-jquery": "^2.1.1",
"karma": "^3.0.0", "karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0", "karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.2", "karma-coverage-istanbul-reporter": "^2.0.4",
"karma-jasmine": "^1.1.2", "karma-jasmine": "^1.1.2",
"karma-junit-reporter": "^1.2.0", "karma-junit-reporter": "^1.2.0",
"karma-mocha-reporter": "^2.2.5", "karma-mocha-reporter": "^2.2.5",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment