Skip to content

Commit

Permalink
chore: node v8 minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Aug 20, 2019
1 parent 817d112 commit 96318c3
Show file tree
Hide file tree
Showing 152 changed files with 12,206 additions and 12,198 deletions.
121 changes: 22 additions & 99 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,48 @@
unit_tests: &unit_tests
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: NPM Rebuild
command: npm install
- run:
name: Run unit tests.
command: npm run ci:test
canary_tests: &canary_tests
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: NPM Rebuild
command: npm install
- run:
name: Install Webpack Canary
command: npm i --no-save webpack@next
- run:
name: Run unit tests.
command: if [[ $(compver --name webpack --gte next --lt latest) < 1 ]] ; then printf "Next is older than Latest - Skipping Canary Suite"; else npm run ci:test ; fi

version: 2
jobs:
dependency_cache:
docker:
- image: webpackcontrib/circleci-node-base:latest
- image: rollupcabal/circleci-node-base:latest
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Node Info
command: node --version && npm --version
- run:
name: Install Dependencies
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
paths:
- ./node_modules

node8-latest:
docker:
- image: webpackcontrib/circleci-node8:latest
node-v12-latest:
machine: true
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: NPM Rebuild
command: npm install
- run:
name: Run unit tests.
command: npm run ci:coverage
name: Setup Node 12 and Run Tests
command: |
set +e
touch $BASH_ENV
curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 12
nvm alias default 12
node --version && npm --version
npm install
npm run ci:coverage
- run:
name: Submit coverage data to codecov.
command: bash <(curl -s https://codecov.io/bash)
when: on_success
node6-latest:
docker:
- image: webpackcontrib/circleci-node6:latest
<<: *unit_tests
node10-latest:
docker:
- image: webpackcontrib/circleci-node10:latest
<<: *unit_tests
node8-canary:
docker:
- image: webpackcontrib/circleci-node8:latest
<<: *canary_tests
analysis:
docker:
- image: webpackcontrib/circleci-node-base:latest
- image: rollupcabal/circleci-node-base:latest
steps:
- checkout
- restore_cache:
Expand All @@ -88,68 +59,20 @@ jobs:
- run:
name: Validate Commit Messages
command: npm run ci:lint:commits
publish:
docker:
- image: webpackcontrib/circleci-node-base:latest
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: NPM Rebuild
command: npm install
# - run:
# name: Validate Commit Messages
# command: npm run release:validate
- run:
name: Publish to NPM
command: printf "noop running conventional-github-releaser"

version: 2.0
workflows:
version: 2
validate-publish:
validate:
jobs:
- dependency_cache
- node6-latest:
requires:
- dependency_cache
filters:
tags:
only: /.*/
- analysis:
requires:
- dependency_cache
filters:
tags:
only: /.*/
- node8-latest:
- node-v12-latest:
requires:
- analysis
- node6-latest
filters:
tags:
only: /.*/
- node10-latest:
requires:
- analysis
- node6-latest
filters:
tags:
only: /.*/
- node8-canary:
requires:
- analysis
- node6-latest
filters:
tags:
only: /.*/
- publish:
requires:
- node8-latest
- node8-canary
- node10-latest
filters:
branches:
only:
- master
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "shellscape",
"globals": {
"document": true,
"ʎɐɹɔosǝʌɹǝs": true,
"WebSocket": true,
"window": true,
"__webpack_hash__": true
},
"rules": {
"class-methods-use-this": "off"
}
}
12 changes: 0 additions & 12 deletions .eslintrc.js

This file was deleted.

7 changes: 2 additions & 5 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ ${commandHelp()}
}

if (problems.length) {
const prefix =
problems.length === cli.input.length ? 'The' : 'Some of the';
const prefix = problems.length === cli.input.length ? 'The' : 'Some of the';
const message = `${prefix} input provided did not match any known commands or existing files:
${problems.join(' ')}`;
log.error(message);
Expand Down Expand Up @@ -125,9 +124,7 @@ ${commandHelp()}

/* istanbul ignore if */
if (!(error instanceof Error)) {
error = new Error(
`webpack-command failed with a value of: ${inspect(error)}`
);
error = new Error(`webpack-command failed with a value of: ${inspect(error)}`);
}

// Assume that errors are generated by webpack first: e.g. ModuleNotFoundError
Expand Down
4 changes: 1 addition & 3 deletions lib/commands/HelpCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ module.exports = class HelpCommand extends Command {
const command = cli.commands[target];

if (!command) {
throw new HelpCommandError(
`The command '${target}' has not been installed`
);
throw new HelpCommandError(`The command '${target}' has not been installed`);
}

if (options.stdout === false) {
Expand Down
11 changes: 3 additions & 8 deletions lib/commands/TeachCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ module.exports = class TeachCommand extends Command {
const dataPath = join(__dirname, '../../data/commands.json');
const dataFile = read(dataPath, 'utf-8');
const commands = JSON.parse(dataFile);
const format = () =>
JSON.stringify(commands, Object.keys(commands).sort(), 2);
const format = () => JSON.stringify(commands, Object.keys(commands).sort(), 2);

if (!command) {
throw new TeachCommandError('The --command flag is required.');
Expand All @@ -68,19 +67,15 @@ module.exports = class TeachCommand extends Command {

if (commands[command]) {
throw new TeachCommandError(
`The '${command}' command was already added via ${
commands[command]
}. Use \`webpack teach --command ${command} --forget\` and try again.`
`The '${command}' command was already added via ${commands[command]}. Use \`webpack teach --command ${command} --forget\` and try again.`
);
}

try {
// eslint-disable-next-line global-require, import/no-dynamic-require
require(commandModule);
} catch (e) {
throw new TeachCommandError(
`The command module '${commandModule}' was not found.`
);
throw new TeachCommandError(`The command module '${commandModule}' was not found.`);
}

commands[command] = commandModule;
Expand Down
6 changes: 2 additions & 4 deletions lib/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ function load() {
// eslint-disable-next-line global-require, import/no-dynamic-require
CommandClass = require(commandModule);
} catch (e) {
throw new CommandError(
`The command module '${commandModule}' was not found.`
);
throw new CommandError(`The command module '${commandModule}' was not found.`);
}

commands[command] = new CommandClass();
Expand All @@ -37,5 +35,5 @@ module.exports = {
return ` ${result}`;
},

load,
load
};
8 changes: 3 additions & 5 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,15 @@ module.exports = (config) => {
config: first,
reporter,
resolve,
reject,
reject
});

if (first.watch) {
log.info('Watching enabled');
for (const conf of configs) {
if (conf.bail) {
const configName =
configs.length > 1
? `config[${conf.name || configs.indexOf(conf)}]`
: 'the config';
configs.length > 1 ? `config[${conf.name || configs.indexOf(conf)}]` : 'the config';
log.warn(
chalk`The {bold \`bail\`} option in ${configName} will force webpack to exit on the first error`
);
Expand All @@ -160,6 +158,6 @@ module.exports = (config) => {
process.stdin.resume();
}
});
},
}
};
};
8 changes: 3 additions & 5 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ module.exports = {
const found = config.find((conf) => conf.name === argv.configName);

if (!found) {
throw new WebpackCommandError(
`The --config-name specified was not found`
);
throw new WebpackCommandError(`The --config-name specified was not found`);
}

result = found;
Expand All @@ -41,7 +39,7 @@ module.exports = {
const loaderOptions = {
allowMissing: true,
configPath: argv.config,
require: argv.require,
require: argv.require
};

if (argv.config) {
Expand All @@ -59,5 +57,5 @@ module.exports = {

return target;
});
},
}
};
Loading

0 comments on commit 96318c3

Please sign in to comment.