Skip to content

Commit dae9982

Browse files
authored
chore(ci): remove node 8 from the CI (#1182)
* chore(ci): remove node 8 from the CI * chore: updated libs and fixed code removed node 8 from engines, removed code that cannot be executed * tests: added readable stream to dev deps * chore(ci): added test for packages upgraded jest to the latest * fix: execute test using typescript * fix: eslint warning
1 parent da08bb1 commit dae9982

File tree

20 files changed

+5575
-8349
lines changed

20 files changed

+5575
-8349
lines changed

.eslintrc.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
module.exports = {
2-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
2+
extends: ['eslint:recommended', 'plugin:node/recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
33
env: {
44
node: true,
55
es6: true,
66
jest: true,
77
},
8-
parser: '@typescript-eslint/parser',
98
root: true,
10-
plugins: ['node'],
11-
parserOptions: { ecmaVersion: 2017, sourceType: 'module' },
9+
plugins: ['node', 'prettier'],
10+
parserOptions: { ecmaVersion: 2020, sourceType: 'module' },
11+
1212
rules: {
1313
'no-useless-escape': 'off',
1414
'quote-props': ['error', 'as-needed'],
1515
'no-dupe-keys': 'error',
1616
'no-undef': 'error',
1717
'no-extra-semi': 'error',
18-
'quotes': ['error', 'single'],
19-
'prettier/prettier': ['error', { singleQuote: true }],
20-
'semi': 'error',
18+
quotes: ['error', 'single'],
19+
'prettier/prettier': ['error', { singleQuote: true }],
20+
semi: 'error',
2121
'no-template-curly-in-string': 'error',
2222
'no-caller': 'error',
2323
'global-require': 'off',
@@ -60,5 +60,5 @@ module.exports = {
6060
'valid-jsdoc': 'error',
6161
'eol-last': ['error', 'always'],
6262
'newline-per-chained-call': 'off',
63-
},
63+
}
6464
};

.github/workflows/nodejs.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ name: Node CI
33
on:
44
push:
55
branches:
6+
- master
67
- next
78
pull_request:
89
branches:
10+
- master
911
- next
1012

1113
jobs:
@@ -15,8 +17,8 @@ jobs:
1517

1618
strategy:
1719
matrix:
18-
node-version: [8.x, 10.x, 12.x]
19-
webpack-version: [latest, next]
20+
node-version: [10.x, 12.x]
21+
webpack-version: [next]
2022

2123
steps:
2224
- uses: actions/checkout@v1
@@ -28,8 +30,13 @@ jobs:
2830
run: |
2931
npm install
3032
npm run bootstrap
31-
- name: Use webpack ${{ matrix.webpack-version }}
32-
run: npm install --save webpack@${{ matrix.webpack-version }}
33+
- name: Run test for webpack version ${{ matrix.webpack-version }}
34+
run: |
35+
npm install --save webpack@${{ matrix.webpack-version }}
36+
npm run build
37+
npm run test:ci
38+
env:
39+
CI: true
3340
- name: smoketest
3441
run: |
3542
npm run build --if-present

azure-pipelines-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
pool:
44
vmImage: ${{ parameters.vmImage }}
55
strategy:
6-
maxParallel: 3
6+
maxParallel: 2
77
matrix:
88
node-12:
99
node_version: ^12.0.0

cli.js renamed to bin/cli.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
require('v8-compile-cache');
66

77
const importLocal = require('import-local');
8-
const logger = require('./lib/utils/logger');
8+
// eslint-disable-next-line node/no-unpublished-require
9+
const logger = require('../lib/utils/logger');
910

1011
// Prefer the local installation of webpack-cli
1112
if (importLocal(__filename)) {
@@ -14,7 +15,7 @@ if (importLocal(__filename)) {
1415
process.title = 'webpack';
1516

1617
const updateNotifier = require('update-notifier');
17-
const packageJson = require('./package.json');
18+
const packageJson = require('../package.json');
1819

1920
const notifier = updateNotifier({
2021
pkg: packageJson,
@@ -35,4 +36,5 @@ if (!semver.satisfies(process.version, version)) {
3536
process.exit(1);
3637
}
3738

38-
require('./lib/bootstrap');
39+
// eslint-disable-next-line node/no-unpublished-require
40+
require('../lib/bootstrap');

lib/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: false,
3+
parserOptions: { ecmaVersion: 2020, sourceType: 'module' },
4+
};

lib/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const parseArgs = require('./utils/parse-args');
88

99
require('./utils/process-log');
1010

11-
const cliPath = require.resolve('../cli.js');
11+
const cliPath = require.resolve('../bin/cli.js');
1212
const isFlagPresent = (args, flag) => args.find(arg => [flag, `--${flag}`].includes(arg));
1313
const isArgCommandName = (arg, cmd) => arg === cmd.name || arg === cmd.alias;
1414
const removeCmdFromArgs = (args, cmd) => args.filter(arg => !isArgCommandName(arg, cmd));

lib/commands/external.js

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/explicit-function-return-type */
2-
const { prompt } = require('inquirer');
3-
const chalk = require('chalk');
4-
const logger = require('../utils/logger');
2+
// const { prompt } = require('inquirer');
3+
// const chalk = require('chalk');
4+
// const logger = require('../utils/logger');
55

66
class ExternalCommand {
77
static async runCommand(command, args = []) {
@@ -31,32 +31,33 @@ class ExternalCommand {
3131
return false;
3232
}
3333
}
34-
static async promptInstallation(scopeName, name) {
35-
const path = require('path');
36-
const fs = require('fs');
37-
const isYarn = fs.existsSync(path.resolve(process.cwd(), 'yarn.lock'));
38-
const packageManager = isYarn ? 'yarn' : 'npm';
39-
const options = [isYarn ? 'add' : 'install', '-D', scopeName];
40-
41-
const commandToBeRun = `${packageManager} ${options.join(' ')}`;
42-
logger.error(`The command moved into a separate package: ${chalk.keyword('orange')(name)}\n`);
43-
const question = `Would you like to install ${name}? (That will run ${chalk.green(commandToBeRun)})`;
44-
const { installConfirm } = await prompt([
45-
{
46-
type: 'confirm',
47-
name: 'installConfirm',
48-
message: question,
49-
default: 'Y',
50-
choices: ['Yes', 'No', 'Y', 'N', 'y', 'n'],
51-
},
52-
]);
53-
if (installConfirm === true) {
54-
await ExternalCommand.runCommand(commandToBeRun);
55-
return ExternalCommand.validateEnv(name);
56-
}
57-
// eslint-disable-next-line require-atomic-updates
58-
process.exitCode = -1;
59-
}
34+
// TODO: to implement once "inquirer" will be avialable inside the CI
35+
// static async promptInstallation(scopeName, name) {
36+
// const path = require('path');
37+
// const fs = require('fs');
38+
// const isYarn = fs.existsSync(path.resolve(process.cwd(), 'yarn.lock'));
39+
// const packageManager = isYarn ? 'yarn' : 'npm';
40+
// const options = [isYarn ? 'add' : 'install', '-D', scopeName];
41+
//
42+
// const commandToBeRun = `${packageManager} ${options.join(' ')}`;
43+
// logger.error(`The command moved into a separate package: ${chalk.keyword('orange')(name)}\n`);
44+
// const question = `Would you like to install ${name}? (That will run ${chalk.green(commandToBeRun)})`;
45+
// const { installConfirm } = await prompt([
46+
// {
47+
// type: 'confirm',
48+
// name: 'installConfirm',
49+
// message: question,
50+
// default: 'Y',
51+
// choices: ['Yes', 'No', 'Y', 'N', 'y', 'n'],
52+
// },
53+
// ]);
54+
// if (installConfirm === true) {
55+
// await ExternalCommand.runCommand(commandToBeRun);
56+
// return ExternalCommand.validateEnv(name);
57+
// }
58+
// // eslint-disable-next-line require-atomic-updates
59+
// process.exitCode = -1;
60+
// }
6061

6162
static async run(name, ...args) {
6263
let pkgLoc = ExternalCommand.validateEnv(name);

lib/groups/advanced.js

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,43 @@ class AdvancedGroup extends GroupHelper {
66
constructor(options) {
77
super(options);
88
}
9-
loadPlugin(name) {
10-
const loadUtils = require('loader-utils');
11-
let args;
12-
try {
13-
const p = name && name.indexOf('?');
14-
if (p > -1) {
15-
args = loadUtils.parseQuery(name.substring(p));
16-
name = name.substring(0, p);
17-
}
18-
} catch (e) {
19-
logger.error('Invalid plugin arguments ' + name + ' (' + e + ').');
20-
process.exit(-1); // eslint-disable-line
21-
}
22-
23-
let path;
24-
try {
25-
const resolve = require('enhanced-resolve');
26-
path = resolve.sync(process.cwd(), name);
27-
} catch (e) {
28-
logger.error('Cannot resolve plugin ' + name + '.');
29-
process.exit(-1); // eslint-disable-line
30-
}
31-
let Plugin;
32-
try {
33-
Plugin = require(path);
34-
} catch (e) {
35-
logger.error('Cannot load plugin ' + name + '. (' + path + ')');
36-
throw e;
37-
}
38-
try {
39-
return new Plugin(args);
40-
} catch (e) {
41-
logger.error('Cannot instantiate plugin ' + name + '. (' + path + ')');
42-
throw e;
43-
}
44-
}
9+
// TODO: fixme. This function is requiring modules that are not installed
10+
// loadPlugin(name) {
11+
// const loadUtils = require('loader-utils');
12+
// let args;
13+
// try {
14+
// const p = name && name.indexOf('?');
15+
// if (p > -1) {
16+
// args = loadUtils.parseQuery(name.substring(p));
17+
// name = name.substring(0, p);
18+
// }
19+
// } catch (e) {
20+
// logger.error('Invalid plugin arguments ' + name + ' (' + e + ').');
21+
// process.exit(-1); // eslint-disable-line
22+
// }
23+
//
24+
// let path;
25+
// try {
26+
// const resolve = require('enhanced-resolve');
27+
// path = resolve.sync(process.cwd(), name);
28+
// } catch (e) {
29+
// logger.error('Cannot resolve plugin ' + name + '.');
30+
// process.exit(-1); // eslint-disable-line
31+
// }
32+
// let Plugin;
33+
// try {
34+
// Plugin = require(path);
35+
// } catch (e) {
36+
// logger.error('Cannot load plugin ' + name + '. (' + path + ')');
37+
// throw e;
38+
// }
39+
// try {
40+
// return new Plugin(args);
41+
// } catch (e) {
42+
// logger.error('Cannot instantiate plugin ' + name + '. (' + path + ')');
43+
// throw e;
44+
// }
45+
// }
4546
resolveOptions() {
4647
const { args } = this;
4748
if (args.hot) {

lib/groups/basic.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ class BasicGroup extends GroupHelper {
1212
if (this.WEBPACK_OPTION_FLAGS.includes(arg)) {
1313
this.opts.outputOptions[arg] = args[arg];
1414
}
15-
if (arg == 'analyze') {
16-
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
17-
this.opts.options.plugins = [new BundleAnalyzerPlugin()];
18-
}
15+
// TODO: to add once webpack bundle analyzer is installed, which is not at the moment
16+
// if (arg == 'analyze') {
17+
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
18+
// this.opts.options.plugins = [new BundleAnalyzerPlugin()];
19+
// }
1920
if (arg == 'sourcemap') {
2021
this.opts.options.devtool = args[arg] || 'eval';
2122
this.opts.outputOptions.devtool = args[arg];

lib/utils/group-helper.js

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,42 +35,43 @@ class GroupHelper {
3535
return result;
3636
}
3737

38-
loadPlugin(name) {
39-
const loadUtils = require('loader-utils');
40-
let args;
41-
try {
42-
const p = name && name.indexOf('?');
43-
if (p > -1) {
44-
args = loadUtils.parseQuery(name.substring(p));
45-
name = name.substring(0, p);
46-
}
47-
} catch (e) {
48-
console.error('Invalid plugin arguments ' + name + ' (' + e + ').');
49-
process.exit(-1); // eslint-disable-line
50-
}
51-
52-
let path;
53-
try {
54-
const resolve = require('enhanced-resolve');
55-
path = resolve.sync(process.cwd(), name);
56-
} catch (e) {
57-
console.error('Cannot resolve plugin ' + name + '.');
58-
process.exit(-1); // eslint-disable-line
59-
}
60-
let Plugin;
61-
try {
62-
Plugin = require(path);
63-
} catch (e) {
64-
console.error('Cannot load plugin ' + name + '. (' + path + ')');
65-
throw e;
66-
}
67-
try {
68-
return new Plugin(args);
69-
} catch (e) {
70-
console.error('Cannot instantiate plugin ' + name + '. (' + path + ')');
71-
throw e;
72-
}
73-
}
38+
// TODO: to re implement
39+
// loadPlugin(name) {
40+
// const loadUtils = require('loader-utils');
41+
// let args;
42+
// try {
43+
// const p = name && name.indexOf('?');
44+
// if (p > -1) {
45+
// args = loadUtils.parseQuery(name.substring(p));
46+
// name = name.substring(0, p);
47+
// }
48+
// } catch (e) {
49+
// console.error('Invalid plugin arguments ' + name + ' (' + e + ').');
50+
// process.exit(-1); // eslint-disable-line
51+
// }
52+
//
53+
// let path;
54+
// try {
55+
// const resolve = require('enhanced-resolve');
56+
// path = resolve.sync(process.cwd(), name);
57+
// } catch (e) {
58+
// console.error('Cannot resolve plugin ' + name + '.');
59+
// process.exit(-1); // eslint-disable-line
60+
// }
61+
// let Plugin;
62+
// try {
63+
// Plugin = require(path);
64+
// } catch (e) {
65+
// console.error('Cannot load plugin ' + name + '. (' + path + ')');
66+
// throw e;
67+
// }
68+
// try {
69+
// return new Plugin(args);
70+
// } catch (e) {
71+
// console.error('Cannot instantiate plugin ' + name + '. (' + path + ')');
72+
// throw e;
73+
// }
74+
// }
7475

7576
resolveFilePath(filename = '', defaultValue) {
7677
if (filename && Array.isArray(filename)) {

0 commit comments

Comments
 (0)