Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove node 6 and webpack 2 support #142

Merged
merged 3 commits into from May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 0 additions & 17 deletions .circleci/config.yml
Expand Up @@ -8,22 +8,6 @@

version: 2
jobs:
test-node6:
docker:
- image: circleci/node:6
steps:
- checkout
- run: node --version > _node_version && npm --version > _npm_version && cat _node_version && cat _npm_version
- restore_cache:
keys:
- v1-dependencies-{{ checksum "_node_version" }}-{{ checksum "_npm_version" }}
- run: node --version && npm --version
- run: npm install
- save_cache:
paths:
- ~/.npm
key: v1-dependencies-{{ checksum "_node_version" }}-{{ checksum "_npm_version" }}
- run: npm run test.ci
test-node8:
docker:
- image: circleci/node:8
Expand Down Expand Up @@ -77,7 +61,6 @@ workflows:
version: 2
build_and_test:
jobs:
- test-node6
- test-node8
- test-node10
- test-node12
3 changes: 3 additions & 0 deletions .eslintrc.js
Expand Up @@ -2,6 +2,9 @@

const eslint = {
extends: '@chrisblossom/eslint-config',
rules: {
'import/no-default-export': 'off',
},
overrides: [
{
files: ['dev-utils/**/*.js', 'dev-utils/**/.*.js'],
Expand Down
15 changes: 0 additions & 15 deletions .prettierrc.js
Expand Up @@ -6,21 +6,6 @@ const prettier = {
singleQuote: true,
trailingComma: 'all',
arrowParens: 'always',
overrides: [
{
files: ['*.js', '.*.js'],
excludeFiles: ['*/**', '*/.**'],
options: {
trailingComma: 'es5',
},
},
{
files: ['dev-utils/**/*.js', 'dev-utils/**/.*.js'],
options: {
trailingComma: 'es5',
},
},
],
};

module.exports = prettier;
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@

A webpack plugin to remove/clean your build folder(s).

> NOTE: Node v6+ and Webpack v2+ are supported and tested.
> NOTE: Node v8+ and webpack v3+ are supported and tested.

## About

Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
@@ -1,6 +1,5 @@
environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '8'
- nodejs_version: '10'
- nodejs_version: '12'
Expand Down
6 changes: 4 additions & 2 deletions dev-utils/get-webpack-version.js
Expand Up @@ -9,9 +9,11 @@ function getWebpackVersion() {
const webpackPath = require.resolve('webpack');
const { dir } = path.parse(webpackPath);

const webpackPkg = readPkgUp.sync({ cwd: dir, normalize: false });
const webpackPackageJson = readPkgUp.sync({ cwd: dir, normalize: false });

const version = webpackPkg.pkg.version ? webpackPkg.pkg.version : null;
const version = webpackPackageJson.package.version
? webpackPackageJson.package.version
: null;

return version;
}
Expand Down
6 changes: 3 additions & 3 deletions dev-utils/get-webpack-version.test.js
Expand Up @@ -5,7 +5,7 @@ const getWebpackVersionTest = () => require('./get-webpack-version')();
describe('webpackVersion', () => {
test('returns major only and is type number', () => {
jest.doMock('read-pkg-up', () => ({
sync: () => ({ pkg: { version: '4.29.0' } }),
sync: () => ({ package: { version: '4.29.0' } }),
}));

const version = getWebpackVersionTest();
Expand All @@ -14,15 +14,15 @@ describe('webpackVersion', () => {

test('handles alpha', () => {
jest.doMock('read-pkg-up', () => ({
sync: () => ({ pkg: { version: '5.0.0-alpha.8' } }),
sync: () => ({ package: { version: '5.0.0-alpha.8' } }),
}));

const version = getWebpackVersionTest();
expect(version).toEqual('5.0.0-alpha.8');
});

test('returns null if no version found', () => {
jest.doMock('read-pkg-up', () => ({ sync: () => ({ pkg: {} }) }));
jest.doMock('read-pkg-up', () => ({ sync: () => ({ package: {} }) }));

const version = getWebpackVersionTest();
expect(version).toEqual(null);
Expand Down
6 changes: 3 additions & 3 deletions dev-utils/node-version.js
Expand Up @@ -4,9 +4,9 @@ const readPkgUp = require('read-pkg-up');
const semver = require('semver');

function getNodeVersion() {
const pkg =
readPkgUp.sync({ cwd: process.cwd(), normalize: false }).pkg || {};
const engines = pkg.engines || {};
const packageJson =
readPkgUp.sync({ cwd: process.cwd(), normalize: false }).package || {};
const engines = packageJson.engines || {};
const node = engines.node || '8.9.0';

const nodeVersion = semver.coerce(node).raw;
Expand Down
8 changes: 4 additions & 4 deletions dev-utils/node-version.test.js
Expand Up @@ -11,7 +11,7 @@ test('handles undefined pkg', () => {
});

test('handles undefined engines', () => {
jest.doMock('read-pkg-up', () => ({ sync: () => ({ pkg: {} }) }));
jest.doMock('read-pkg-up', () => ({ sync: () => ({ package: {} }) }));

const nodeVersion = require('./node-version');

Expand All @@ -20,7 +20,7 @@ test('handles undefined engines', () => {

test('handles undefined node', () => {
jest.doMock('read-pkg-up', () => ({
sync: () => ({ pkg: { engines: { npm: '^5.0.0' } } }),
sync: () => ({ package: { engines: { npm: '^5.0.0' } } }),
}));

const nodeVersion = require('./node-version');
Expand All @@ -30,7 +30,7 @@ test('handles undefined node', () => {

test('handles non-digit characters', () => {
jest.doMock('read-pkg-up', () => ({
sync: () => ({ pkg: { engines: { node: '>=10.0.0' } } }),
sync: () => ({ package: { engines: { node: '>=10.0.0' } } }),
}));

const nodeVersion = require('./node-version');
Expand All @@ -40,7 +40,7 @@ test('handles non-digit characters', () => {

test('handles empty node', () => {
jest.doMock('read-pkg-up', () => ({
sync: () => ({ pkg: { engines: { node: '' } } }),
sync: () => ({ package: { engines: { node: '' } } }),
}));

const nodeVersion = require('./node-version');
Expand Down
24 changes: 11 additions & 13 deletions dev-utils/test-supported-webpack-versions.js
Expand Up @@ -5,7 +5,6 @@
'use strict';

const execa = require('execa');
const semver = require('semver');
const Listr = require('listr');
const del = require('del');
const readPkgUp = require('read-pkg-up');
Expand All @@ -15,7 +14,6 @@ const ciEnabled = process.argv[process.argv.length - 1] === '--ci';

const supported = [
//
'2',
'3',
'4',
'next',
Expand All @@ -26,14 +24,14 @@ const webpackTestTasks = supported.map((version) => {
/**
* Webpack version 5 (currently @next) removed support for node 6.
*/
if (
(version === 'next' || version === '5') &&
semver.lte(process.version, '8.0.0') === true
) {
return `node ${
process.version
} is not supported by webpack@${version}...node >=8 required`;
}
// if (
// (version === 'next' || version === '5') &&
// semver.lte(process.version, '8.0.0') === true
// ) {
// return `node ${
// process.version
// } is not supported by webpack@${version}...node >=8 required`;
// }

return false;
};
Expand Down Expand Up @@ -106,7 +104,7 @@ tasks
const packageJsonWebpackVersion = readPkgUp.sync({
cwd: process.cwd(),
normalize: false,
}).pkg.devDependencies.webpack;
}).package.devDependencies.webpack;

return new Listr(
[
Expand All @@ -120,12 +118,12 @@ tasks
'--no-save',
`webpack@${packageJsonWebpackVersion}`,
],
{ env: { FORCE_COLOR: true } }
{ env: { FORCE_COLOR: true } },
),
skip: () => ciEnabled === true,
},
],
listrOptions
listrOptions,
).run();
})
.catch((error) => {
Expand Down
22 changes: 11 additions & 11 deletions package.json
Expand Up @@ -11,7 +11,7 @@
"dist/"
],
"engines": {
"node": ">=6.9.0"
"node": ">=8.9.0"
},
"keywords": [
"webpack",
Expand Down Expand Up @@ -53,27 +53,27 @@
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-typescript": "^7.3.3",
"@chrisblossom/eslint-config": "^4.0.10",
"@types/jest": "^24.0.12",
"@types/node": "^12.0.0",
"@chrisblossom/eslint-config": "^5.0.0",
"@types/jest": "^24.0.13",
"@types/node": "^12.0.2",
"@types/read-pkg-up": "^3.0.1",
"babel-jest": "^24.8.0",
"babel-plugin-add-module-exports": "^1.0.2",
"codecov": "^3.3.0",
"codecov": "^3.5.0",
"cross-env": "^5.2.0",
"del-cli": "^1.1.0",
"eslint": "^5.16.0",
"execa": "^1.0.0",
"husky": "^2.2.0",
"husky": "^2.3.0",
"jest": "^24.8.0",
"lint-staged": "^8.1.6",
"lint-staged": "^8.1.7",
"listr": "^0.14.3",
"prettier": "^1.17.0",
"read-pkg-up": "^4.0.0",
"prettier": "^1.17.1",
"read-pkg-up": "^6.0.0",
"semver": "^6.0.0",
"temp-sandbox": "^2.0.0",
"temp-sandbox": "^3.0.0",
"typescript": "^3.4.5",
"webpack": "^4.30.0"
"webpack": "^4.32.0"
},
"dependencies": {
"@types/webpack": "^4.4.31",
Expand Down
4 changes: 2 additions & 2 deletions wallaby.config.js
Expand Up @@ -58,11 +58,11 @@ module.exports = (wallabyInitial) => {
const path = require('path');
const realModules = path.join(
wallabySetup.localProjectDir,
'node_modules'
'node_modules',
);
const linkedModules = path.join(
wallabySetup.projectCacheDir,
'node_modules'
'node_modules',
);

try {
Expand Down