Skip to content

Commit 817f0c8

Browse files
committed
feat: drop support for Node <8.3, drop standard, upgrade deps
1 parent 2f40de7 commit 817f0c8

File tree

10 files changed

+2990
-2777
lines changed

10 files changed

+2990
-2777
lines changed

.npmignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
media
2-
.nyc_output
3-
coverage

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
* Unit testing with [ava][]
5252
* Commit linting with [commitlint][]
53-
* Linting with [eslint][] (with an option to choose between [prettier][] and [xo][] or [standard][])
53+
* Linting with [xo][] (uses [eslint][] and [prettier][])
5454
* Markdown Linting with [remark][]
5555
* Automatic code formatting with [prettier][]
5656
* Automatic `git init`
@@ -223,8 +223,6 @@ If you are seeking permission to use these trademarks, then please [contact us](
223223

224224
[express]: https://expressjs.com
225225

226-
[standard]: https://standardjs.com/
227-
228226
[commitlint]: https://github.com/marionebl/commitlint
229227

230228
[np]: https://github.com/sindresorhus/np

package.json

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"template/test/**/*.js",
1818
"template/**/__tests__/**/*.js",
1919
"template/**/*.test.js"
20+
],
21+
"helpers": [
22+
"template/test/helpers/**/*"
2023
]
2124
},
2225
"bin": "cli.js",
@@ -35,43 +38,43 @@
3538
"Shaun Warman <[email protected]> (http://shaunwarman.com)"
3639
],
3740
"dependencies": {
38-
"cac": "^6.3.12",
39-
"camelcase": "^5.0.0",
40-
"execa": "^1.0.0",
41+
"cac": "^6.5.2",
42+
"camelcase": "^5.3.1",
43+
"execa": "^2.0.4",
4144
"fixpack": "^2.3.1",
42-
"github-username": "^4.1.0",
45+
"github-username": "^5.0.1",
4346
"github-username-regex": "^1.0.0",
44-
"global": "^4.3.2",
47+
"global": "^4.4.0",
4548
"is-email": "^1.0.0",
4649
"is-url": "^1.2.4",
4750
"is-valid-npm-name": "^0.0.4",
4851
"npm-conf": "^1.1.3",
4952
"sao": "0.22.17",
50-
"semver": "^5.6.0",
53+
"semver": "^6.3.0",
5154
"shelljs": "^0.8.3",
52-
"spdx-license-list": "^5.0.0",
55+
"spdx-license-list": "^6.1.0",
5356
"speakingurl": "^14.0.1",
54-
"superb": "^3.0.0",
55-
"update-notifier": "^2.5.0",
57+
"superb": "^4.0.0",
58+
"update-notifier": "^3.0.1",
5659
"uppercamelcase": "^3.0.0"
5760
},
5861
"devDependencies": {
59-
"@commitlint/cli": "^7.2.1",
60-
"@commitlint/config-conventional": "^7.1.2",
61-
"ava": "^1.0.1",
62-
"codecov": "^3.1.0",
63-
"cross-env": "^5.2.0",
64-
"eslint": "^5.12.0",
62+
"@commitlint/cli": "^8.1.0",
63+
"@commitlint/config-conventional": "^8.1.0",
64+
"ava": "^2.3.0",
65+
"codecov": "^3.5.0",
66+
"cross-env": "^5.2.1",
67+
"eslint": "^6.3.0",
6568
"eslint-config-xo-lass": "^1.0.3",
66-
"husky": "^1.3.1",
67-
"lint-staged": "^8.1.0",
68-
"nyc": "^13.1.0",
69-
"remark-cli": "^6.0.1",
70-
"remark-preset-github": "^0.0.13",
71-
"xo": "^0.23.0"
69+
"husky": "^3.0.5",
70+
"lint-staged": "^9.2.5",
71+
"nyc": "^14.1.1",
72+
"remark-cli": "^7.0.0",
73+
"remark-preset-github": "^0.0.16",
74+
"xo": "^0.24.0"
7275
},
7376
"engines": {
74-
"node": ">=7.6.0"
77+
"node": ">=8.3.0"
7578
},
7679
"homepage": "https://lass.js.org",
7780
"husky": {

sao.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ module.exports = {
6767
default: conf.get('init-version') || '0.0.0',
6868
validate: val => (semver.valid(val) ? true : 'Invalid semver version')
6969
},
70-
eslint: {
71-
message: 'Choose an eslint configuration',
72-
choices: ['prettier', 'standard'],
73-
type: 'list',
74-
default: 'prettier',
75-
store: true
76-
},
7770
author: {
7871
message: "What is your name (the author's)",
7972
default: conf.get('init-author-name') || ':gitUser:',
@@ -201,9 +194,8 @@ module.exports = {
201194
ctx.npmInstall();
202195
}
203196

204-
// Format code according to eslint configuration
205-
const linter = ctx.answers.eslint === 'standard' ? 'standard' : 'xo';
206-
await execa(`./node_modules/.bin/${linter}`, ['--fix'], {
197+
// Format code with xo
198+
await execa(`./node_modules/.bin/xo`, ['--fix'], {
207199
cwd: ctx.folderPath,
208200
stdio: 'inherit'
209201
});

template/.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
.nyc_output
2-
coverage
1+
media

template/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Script {
22
constructor(config) {
3-
config = Object.assign({}, config);
3+
config = { ...config };
44
this._name = config.name || 'script';
55

66
this.renderName = this.renderName.bind(this);

template/package

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,14 @@
2424
"codecov": "latest",
2525
"cross-env": "latest",
2626
"eslint": "latest",
27-
"eslint-config-<%- eslint %>": "latest",
28-
"eslint-plugin-<%- eslint %>": "latest",
2927
"fixpack": "latest",
3028
"husky": "latest",
3129
"lint-staged": "latest",
3230
"nyc": "latest",
33-
"prettier": "latest",
3431
"remark-cli": "latest",
3532
"remark-preset-github": "latest",
36-
<% if (eslint === 'prettier') { %>
3733
"eslint-config-xo-lass": "latest",
38-
<% } %>
39-
<%- eslint === 'standard' ? `"standard"`: `"xo"` %>: "latest"
34+
"xo": "latest"
4035
},
4136
"engines": {
4237
"node": ">=8.3"
@@ -51,18 +46,12 @@
5146
}
5247
},
5348
"lint-staged": {
54-
"linters": {
55-
"*.js": [
56-
<% if (eslint === 'standard') { %>
57-
"standard --fix",
58-
<% } else { %>
59-
"xo --fix",
60-
<% } %>
61-
"git add"
62-
],
63-
"*.md": ["remark . -qfo", "git add"],
64-
"package.json": [ "fixpack", "git add" ]
65-
}
49+
"*.js": [
50+
"xo --fix",
51+
"git add"
52+
],
53+
"*.md": ["remark . -qfo", "git add"],
54+
"package.json": [ "fixpack", "git add" ]
6655
},
6756
"commitlint": {
6857
"extends": [
@@ -91,7 +80,6 @@
9180
"type": "git",
9281
"url": "<%- repo %>"
9382
},
94-
<% if (eslint === 'prettier') { %>
9583
"prettier": {
9684
"singleQuote": true,
9785
"bracketSpacing": true,
@@ -102,14 +90,9 @@
10290
"space": true,
10391
"extends": [ "xo-lass" ]
10492
},
105-
<% } %>
10693
"scripts": {
10794
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
108-
<% if (eslint === 'prettier') { %>
10995
"lint": "xo && remark . -qfo",
110-
<% } else { %>
111-
"lint": "standard && remark . -qfo",
112-
<% } %>
11396
"test": "npm run lint && npm run ava",
11497
"test-coverage": "npm run lint && npm run nyc",
11598
"ava": "cross-env NODE_ENV=test ava",

template/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const test = require('ava');
22

3-
const Script = require('..');
43
const { beforeEach, afterEach } = require('./helpers');
4+
const Script = require('..');
55

66
test.beforeEach(beforeEach);
77
test.afterEach(afterEach);

test/test.js

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ test('allows SPDX licenses', async t => {
4949
Math.floor(Math.random() * [...spdxLicenseList].length)
5050
];
5151
};
52+
5253
const license = getRandomLicense();
5354
const stream = await sao.mockPrompt(template, {
5455
name: 'lass',
@@ -69,12 +70,10 @@ test('allows SPDX licenses', async t => {
6970
// test.todo('logs error if soa fails to write license');
7071

7172
test('defaults', async t => {
72-
const stream = await sao.mockPrompt(
73-
template,
74-
Object.assign({}, defaults, {
75-
name: 'my-package-name'
76-
})
77-
);
73+
const stream = await sao.mockPrompt(template, {
74+
...defaults,
75+
name: 'my-package-name'
76+
});
7877

7978
const ignoredFiles = ['yarn-error.log'];
8079
t.snapshot(
@@ -87,97 +86,63 @@ test('defaults', async t => {
8786
});
8887

8988
test('username retains capital letters', async t => {
90-
const stream = await sao.mockPrompt(
91-
template,
92-
Object.assign({}, defaults, {
93-
name: 'my-package-name',
94-
username: 'fooBar'
95-
})
96-
);
89+
const stream = await sao.mockPrompt(template, {
90+
...defaults,
91+
name: 'my-package-name',
92+
username: 'fooBar'
93+
});
9794
t.is(stream.meta.answers.username, 'fooBar');
9895
t.regex(stream.meta.answers.repo, /fooBar/);
9996
});
10097

10198
test('invalid name', async t => {
10299
const error = await t.throwsAsync(
103-
sao.mockPrompt(
104-
template,
105-
Object.assign({}, defaults, {
106-
name: 'Foo Bar Baz Beep'
107-
})
108-
)
100+
sao.mockPrompt(template, { ...defaults, name: 'Foo Bar Baz Beep' })
109101
);
110102
t.regex(error.message, /package name cannot have uppercase letters/);
111103
});
112104

113105
test('allows scope', async t => {
114106
await t.notThrowsAsync(
115-
sao.mockPrompt(
116-
template,
117-
Object.assign({}, defaults, {
118-
name: '@foo/bar'
119-
})
120-
)
107+
sao.mockPrompt(template, { ...defaults, name: '@foo/bar' })
121108
);
122109
});
123110

124111
test('invalid version', async t => {
125112
const error = await t.throwsAsync(
126-
sao.mockPrompt(
127-
template,
128-
Object.assign({}, defaults, {
129-
version: 'abcdef'
130-
})
131-
)
113+
sao.mockPrompt(template, { ...defaults, version: 'abcdef' })
132114
);
133115
t.regex(error.message, /Invalid semver version/);
134116
});
135117

136118
test('invalid email', async t => {
137119
const error = await t.throwsAsync(
138-
sao.mockPrompt(
139-
template,
140-
Object.assign({}, defaults, {
141-
email: 'niftylettuce'
142-
})
143-
)
120+
sao.mockPrompt(template, { ...defaults, email: 'niftylettuce' })
144121
);
145122
t.regex(error.message, /Invalid email/);
146123
});
147124

148125
test('invalid website', async t => {
149126
const error = await t.throwsAsync(
150-
sao.mockPrompt(
151-
template,
152-
Object.assign({}, defaults, {
153-
website: 'niftylettuce'
154-
})
155-
)
127+
sao.mockPrompt(template, { ...defaults, website: 'niftylettuce' })
156128
);
157129
t.regex(error.message, /Invalid URL/);
158130
});
159131

160132
test('invalid username', async t => {
161133
const error = await t.throwsAsync(
162-
sao.mockPrompt(
163-
template,
164-
Object.assign({}, defaults, {
165-
username: '$$$'
166-
})
167-
)
134+
sao.mockPrompt(template, { ...defaults, username: '$$$' })
168135
);
169136
t.regex(error.message, /Invalid GitHub username/);
170137
});
171138

172139
test('invalid repo', async t => {
173140
const error = await t.throwsAsync(
174-
sao.mockPrompt(
175-
template,
176-
Object.assign({}, defaults, {
177-
username: 'lassjs',
178-
repo: 'https://bitbucket.org/foo/bar'
179-
})
180-
)
141+
sao.mockPrompt(template, {
142+
...defaults,
143+
username: 'lassjs',
144+
repo: 'https://bitbucket.org/foo/bar'
145+
})
181146
);
182147
t.regex(
183148
error.message,

0 commit comments

Comments
 (0)