@nice-move/init 0.3.13 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +2 -0
- package/package.json +15 -12
- package/action/editorconfig.mjs +0 -11
- package/action/git-file.mjs +0 -91
- package/action/license.mjs +0 -31
- package/action/package.mjs +0 -35
- package/action/readme.mjs +0 -22
- package/action/registry.mjs +0 -29
- package/bin/index.mjs +0 -13
- package/index.mjs +0 -41
- package/lib/color.mjs +0 -3
- package/lib/latest.mjs +0 -24
- package/lib/utils.mjs +0 -67
- package/prompt/dependencies.mjs +0 -235
- package/prompt/git-init.mjs +0 -35
- package/prompt/index.mjs +0 -73
- package/prompt/install.mjs +0 -22
- package/prompt/package.mjs +0 -98
- package/template/.editorconfig.tpl +0 -13
- package/template/.gitattributes.tpl +0 -3
- package/template/mit.tpl +0 -21
- package/template/unlicense.tpl +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-move/init",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Initialize your frontend workspaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -36,30 +36,33 @@
|
|
|
36
36
|
"url": "https://github.com/nice-move/nice-move/issues"
|
|
37
37
|
},
|
|
38
38
|
"bin": {
|
|
39
|
-
"nice-move-init": "
|
|
39
|
+
"nice-move-init": "dist/cli.mjs"
|
|
40
40
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"files": [],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "best-shot prod",
|
|
44
|
+
"prepublishOnly": "npm run build"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
43
47
|
"centra": "^2.5.0",
|
|
44
|
-
"chalk": "^5.0.
|
|
48
|
+
"chalk": "^5.0.1",
|
|
49
|
+
"cheetor": "^0.13.0",
|
|
45
50
|
"deepmerge": "^4.2.2",
|
|
46
|
-
"execa": "^6.
|
|
47
|
-
"fs-chain": "^8.
|
|
51
|
+
"execa": "^6.1.0",
|
|
52
|
+
"fs-chain": "^8.2.1",
|
|
48
53
|
"is-git-dirty": "^2.0.1",
|
|
49
54
|
"is-git-repository": "^2.0.0",
|
|
50
|
-
"ora": "^6.0
|
|
55
|
+
"ora": "^6.1.0",
|
|
51
56
|
"os-locale": "^6.0.2",
|
|
52
57
|
"parse-author": "^2.0.0",
|
|
53
58
|
"prompts": "^2.4.2",
|
|
54
59
|
"semver-regex": "^4.0.2",
|
|
55
|
-
"settingz": "^0.1.5",
|
|
56
60
|
"stringify-author": "^0.1.3",
|
|
57
|
-
"
|
|
58
|
-
"validate-npm-package-name": "^3.0.0",
|
|
61
|
+
"validate-npm-package-name": "^4.0.0",
|
|
59
62
|
"yarn-install": "^1.0.0"
|
|
60
63
|
},
|
|
61
64
|
"engines": {
|
|
62
|
-
"node": "^
|
|
65
|
+
"node": "^14.17.0 || >=16.13.0"
|
|
63
66
|
},
|
|
64
67
|
"publishConfig": {
|
|
65
68
|
"access": "public",
|
package/action/editorconfig.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Text } from 'fs-chain';
|
|
2
|
-
|
|
3
|
-
import { cyan } from '../lib/color.mjs';
|
|
4
|
-
|
|
5
|
-
export function EditorConfig() {
|
|
6
|
-
return new Text()
|
|
7
|
-
.source('../../template/.editorconfig.tpl', import.meta.url)
|
|
8
|
-
.output('.editorconfig')
|
|
9
|
-
.logger('Create/Overwrite', cyan('.editorconfig'))
|
|
10
|
-
.catch(console.warn);
|
|
11
|
-
}
|
package/action/git-file.mjs
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { type } from 'os';
|
|
2
|
-
|
|
3
|
-
import { Text } from 'fs-chain';
|
|
4
|
-
import ora from 'ora';
|
|
5
|
-
|
|
6
|
-
import { cyan, green, red } from '../lib/color.mjs';
|
|
7
|
-
import { download } from '../lib/utils.mjs';
|
|
8
|
-
|
|
9
|
-
const regexp =
|
|
10
|
-
/# Created by https?:\/\/(www\.)?(toptal\.com\/developers\/gitignore|gitignore\.io)\/api\/\S+[\S\s]+# End of https?:\/\/(www\.)?(toptal\.com\/developers\/gitignore|gitignore\.io)\/api\/\S+/;
|
|
11
|
-
|
|
12
|
-
const Types = {
|
|
13
|
-
Windows_NT: 'windows',
|
|
14
|
-
Linux: 'linux',
|
|
15
|
-
Darwin: 'macos',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
function getPlatform(context) {
|
|
19
|
-
try {
|
|
20
|
-
if (regexp.test(context)) {
|
|
21
|
-
return [
|
|
22
|
-
...new Set([
|
|
23
|
-
...context
|
|
24
|
-
.match(/gitignore\.io\/api\/(\S+)/)[1]
|
|
25
|
-
.split(',')
|
|
26
|
-
.filter((item) => item !== 'node'),
|
|
27
|
-
Types[type()],
|
|
28
|
-
]),
|
|
29
|
-
].sort();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
throw new Error('fail');
|
|
33
|
-
} catch {
|
|
34
|
-
return Types[type()];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function GitFile() {
|
|
39
|
-
await new Text()
|
|
40
|
-
.source('../../template/.gitattributes.tpl', import.meta.url)
|
|
41
|
-
.output('.gitattributes')
|
|
42
|
-
.logger('Create/Overwrite', cyan('.gitattributes'));
|
|
43
|
-
|
|
44
|
-
const spinner = ora({
|
|
45
|
-
text: 'Downloading template from `gitignore.io`',
|
|
46
|
-
}).start();
|
|
47
|
-
|
|
48
|
-
const message = `Create/Overwrite ${cyan('.gitignore')}`;
|
|
49
|
-
|
|
50
|
-
return new Text()
|
|
51
|
-
.source('.gitignore')
|
|
52
|
-
.onFail()
|
|
53
|
-
.onDone((oldText = '') => {
|
|
54
|
-
const platform = getPlatform(oldText);
|
|
55
|
-
|
|
56
|
-
return download(`https://gitignore.io/api/node,${platform}`)
|
|
57
|
-
.then((newText) => {
|
|
58
|
-
const [match] = oldText.match(regexp) || [];
|
|
59
|
-
|
|
60
|
-
const io = (
|
|
61
|
-
match
|
|
62
|
-
? oldText.replace(regexp, newText)
|
|
63
|
-
: `${oldText.trim()}\n\n${newText}`
|
|
64
|
-
)
|
|
65
|
-
.replace(
|
|
66
|
-
/(www\.)?toptal\.com\/developers\/gitignore/g,
|
|
67
|
-
'gitignore.io',
|
|
68
|
-
)
|
|
69
|
-
.trim()
|
|
70
|
-
.split(/\n\n\+/g)
|
|
71
|
-
.filter((item) => item.trim())
|
|
72
|
-
.join('\n\n');
|
|
73
|
-
|
|
74
|
-
return `${io}\n`;
|
|
75
|
-
})
|
|
76
|
-
.catch(() => oldText || 'node_modules\n');
|
|
77
|
-
})
|
|
78
|
-
.output()
|
|
79
|
-
.then(() => {
|
|
80
|
-
spinner.stopAndPersist({
|
|
81
|
-
symbol: green('√'),
|
|
82
|
-
text: message,
|
|
83
|
-
});
|
|
84
|
-
})
|
|
85
|
-
.catch((error) => {
|
|
86
|
-
spinner.stopAndPersist({
|
|
87
|
-
symbol: red('×'),
|
|
88
|
-
text: `${message} - ${error.message}`,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|
package/action/license.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Text } from 'fs-chain';
|
|
2
|
-
import { getPkg } from 'settingz';
|
|
3
|
-
|
|
4
|
-
import { cyan } from '../lib/color.mjs';
|
|
5
|
-
import { getAuthorName } from '../lib/utils.mjs';
|
|
6
|
-
|
|
7
|
-
export async function License() {
|
|
8
|
-
const { license, author = '' } = getPkg();
|
|
9
|
-
|
|
10
|
-
const isMIT = license === 'MIT';
|
|
11
|
-
|
|
12
|
-
if (isMIT || license === 'Unlicense') {
|
|
13
|
-
const holder = await getAuthorName(author);
|
|
14
|
-
|
|
15
|
-
return new Text()
|
|
16
|
-
.source(
|
|
17
|
-
isMIT ? '../../template/mit.tpl' : '../../template/unlicense.tpl',
|
|
18
|
-
import.meta.url,
|
|
19
|
-
)
|
|
20
|
-
.onDone((text) =>
|
|
21
|
-
isMIT
|
|
22
|
-
? text
|
|
23
|
-
.replace('{{year}}', new Date().getFullYear())
|
|
24
|
-
.replace('{{holder}}', holder)
|
|
25
|
-
: text,
|
|
26
|
-
)
|
|
27
|
-
.output('LICENSE')
|
|
28
|
-
.logger('Create/Overwrite', cyan('LICENSE'))
|
|
29
|
-
.catch(console.warn);
|
|
30
|
-
}
|
|
31
|
-
}
|
package/action/package.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import deepmerge from 'deepmerge';
|
|
2
|
-
import { Json } from 'fs-chain';
|
|
3
|
-
|
|
4
|
-
import { cyan } from '../lib/color.mjs';
|
|
5
|
-
import latest from '../lib/latest.mjs';
|
|
6
|
-
|
|
7
|
-
const pkg = 'package.json';
|
|
8
|
-
|
|
9
|
-
export function Package(info) {
|
|
10
|
-
return new Json()
|
|
11
|
-
.config({ pretty: true })
|
|
12
|
-
.source(pkg)
|
|
13
|
-
.onFail()
|
|
14
|
-
.onDone((old = {}) =>
|
|
15
|
-
deepmerge.all([
|
|
16
|
-
{
|
|
17
|
-
engines: {
|
|
18
|
-
node: latest.lts,
|
|
19
|
-
},
|
|
20
|
-
publishConfig:
|
|
21
|
-
info.private || old.private
|
|
22
|
-
? undefined
|
|
23
|
-
: {
|
|
24
|
-
access: 'public',
|
|
25
|
-
registry: 'https://registry.npmjs.org/',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
old,
|
|
29
|
-
info,
|
|
30
|
-
]),
|
|
31
|
-
)
|
|
32
|
-
.output()
|
|
33
|
-
.logger('Add project info to', cyan(pkg))
|
|
34
|
-
.catch(console.warn);
|
|
35
|
-
}
|
package/action/readme.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Text } from 'fs-chain';
|
|
2
|
-
import { getPkg } from 'settingz';
|
|
3
|
-
|
|
4
|
-
import { cyan } from '../lib/color.mjs';
|
|
5
|
-
|
|
6
|
-
export async function Readme() {
|
|
7
|
-
const { name, description } = getPkg();
|
|
8
|
-
|
|
9
|
-
new Text()
|
|
10
|
-
.source('README.md')
|
|
11
|
-
.onFail()
|
|
12
|
-
.onDone((text) =>
|
|
13
|
-
!text
|
|
14
|
-
? [`# ${name}`, description ? `${description}.\n` : '']
|
|
15
|
-
.filter(Boolean)
|
|
16
|
-
.join('\n\n')
|
|
17
|
-
: text,
|
|
18
|
-
)
|
|
19
|
-
.output()
|
|
20
|
-
.logger('Create', cyan('README.md'))
|
|
21
|
-
.catch(console.warn);
|
|
22
|
-
}
|
package/action/registry.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Text } from 'fs-chain';
|
|
2
|
-
import { osLocale } from 'os-locale';
|
|
3
|
-
|
|
4
|
-
import { cyan } from '../lib/color.mjs';
|
|
5
|
-
|
|
6
|
-
export async function Registry() {
|
|
7
|
-
const InChina = (await osLocale()) === 'zh-CN';
|
|
8
|
-
|
|
9
|
-
if (InChina) {
|
|
10
|
-
new Text()
|
|
11
|
-
.source('.npmrc')
|
|
12
|
-
.onFail()
|
|
13
|
-
.onDone((text = '') => {
|
|
14
|
-
if (
|
|
15
|
-
text.trim() &&
|
|
16
|
-
/registry\s*=\s*["']?https:\/\/mirrors\.tencent\.com\/npm\/["']?/i.test(
|
|
17
|
-
text,
|
|
18
|
-
)
|
|
19
|
-
) {
|
|
20
|
-
return text;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return `registry = https://mirrors.tencent.com/npm/\r${text}`;
|
|
24
|
-
})
|
|
25
|
-
.output()
|
|
26
|
-
.logger('Set registry to China mirror in', cyan('.npmrc'))
|
|
27
|
-
.catch(console.warn);
|
|
28
|
-
}
|
|
29
|
-
}
|
package/bin/index.mjs
DELETED
package/index.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { EditorConfig } from './action/editorconfig.mjs';
|
|
2
|
-
import { GitFile } from './action/git-file.mjs';
|
|
3
|
-
import { License } from './action/license.mjs';
|
|
4
|
-
import { Package } from './action/package.mjs';
|
|
5
|
-
import { Readme } from './action/readme.mjs';
|
|
6
|
-
import { Registry } from './action/registry.mjs';
|
|
7
|
-
import { Prompt } from './prompt/index.mjs';
|
|
8
|
-
|
|
9
|
-
export async function init() {
|
|
10
|
-
const {
|
|
11
|
-
Dependencies,
|
|
12
|
-
GitInit,
|
|
13
|
-
Install,
|
|
14
|
-
info,
|
|
15
|
-
options: { isGit } = {},
|
|
16
|
-
} = await Prompt();
|
|
17
|
-
|
|
18
|
-
console.log('-'.repeat(32));
|
|
19
|
-
|
|
20
|
-
const actions = [
|
|
21
|
-
GitInit,
|
|
22
|
-
Registry,
|
|
23
|
-
() => Package(info),
|
|
24
|
-
Readme,
|
|
25
|
-
License,
|
|
26
|
-
EditorConfig,
|
|
27
|
-
() => (GitInit || isGit ? GitFile() : undefined),
|
|
28
|
-
() => (Dependencies ? Dependencies(GitInit || isGit) : undefined),
|
|
29
|
-
Install,
|
|
30
|
-
].filter((func) => typeof func === 'function');
|
|
31
|
-
|
|
32
|
-
for (const action of actions) {
|
|
33
|
-
const io = await action();
|
|
34
|
-
|
|
35
|
-
if (io && io.catch) {
|
|
36
|
-
io.catch((error) => {
|
|
37
|
-
console.warn(error.message);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
package/lib/color.mjs
DELETED
package/lib/latest.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
ava: '^4.0.1',
|
|
3
|
-
eslint: '^8.8.0',
|
|
4
|
-
'eslint-plugin-ava': '^13.2.0',
|
|
5
|
-
garou: '^0.3.11',
|
|
6
|
-
prettier: '^2.5.1',
|
|
7
|
-
stylelint: '^14.3.0',
|
|
8
|
-
typescript: '^4.5.5',
|
|
9
|
-
'@bring-it/cli': '^0.5.6',
|
|
10
|
-
'@playwright/test': '^1.18.1',
|
|
11
|
-
'@types/react': '^16.14.23',
|
|
12
|
-
postcss: '^8.4.6',
|
|
13
|
-
react: '~16.14.0',
|
|
14
|
-
'react-dom': '~16.14.0',
|
|
15
|
-
rustywind: '^0.12.2',
|
|
16
|
-
tailwindcss: '~3.0.19',
|
|
17
|
-
vue: '~2.6.14',
|
|
18
|
-
'eslint-config-base': '^0.6.1',
|
|
19
|
-
'stylelint-config': '^0.6.14',
|
|
20
|
-
'prettier-config': '^0.5.2',
|
|
21
|
-
'commitlint-config': '^0.5.0',
|
|
22
|
-
cli: '^0.7.0',
|
|
23
|
-
lts: '^12.22.0 || ^14.17.0 || >=16.13.0',
|
|
24
|
-
};
|
package/lib/utils.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { readdirSync } from 'fs';
|
|
2
|
-
|
|
3
|
-
import centra from 'centra';
|
|
4
|
-
import { execa } from 'execa';
|
|
5
|
-
import stringify from 'stringify-author';
|
|
6
|
-
|
|
7
|
-
export function download(url) {
|
|
8
|
-
return centra(url)
|
|
9
|
-
.timeout(5000)
|
|
10
|
-
.send()
|
|
11
|
-
.then((response) => {
|
|
12
|
-
if (response.statusCode === 301) {
|
|
13
|
-
return download(response.headers.location);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return response.text();
|
|
17
|
-
})
|
|
18
|
-
.then((response) => {
|
|
19
|
-
const data = response.trim();
|
|
20
|
-
|
|
21
|
-
if (data) {
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw new Error('template download fail');
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function gitSupport() {
|
|
30
|
-
try {
|
|
31
|
-
const { stdout } = await execa('git', ['--version']);
|
|
32
|
-
|
|
33
|
-
return Boolean(stdout);
|
|
34
|
-
} catch {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function emptyDir() {
|
|
40
|
-
return readdirSync(process.cwd()).length === 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function trim(value) {
|
|
44
|
-
return value ? value.trim() : undefined;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getUser() {
|
|
48
|
-
return import('user-meta')
|
|
49
|
-
.then(({ default: meta }) => meta)
|
|
50
|
-
.catch(() => ({}));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export async function getAuthor(author) {
|
|
54
|
-
if (author) {
|
|
55
|
-
return author;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const meta = await getUser();
|
|
59
|
-
|
|
60
|
-
return meta.name ? stringify(meta) : 'Unknown';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export async function getAuthorName(author) {
|
|
64
|
-
const info = await getAuthor(author);
|
|
65
|
-
|
|
66
|
-
return info.name || 'Unknown';
|
|
67
|
-
}
|
package/prompt/dependencies.mjs
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import deepmerge from 'deepmerge';
|
|
2
|
-
import { Json, Text } from 'fs-chain';
|
|
3
|
-
import { getPkg } from 'settingz';
|
|
4
|
-
|
|
5
|
-
import latest from '../lib/latest.mjs';
|
|
6
|
-
|
|
7
|
-
function checkEslint({ vue, react }) {
|
|
8
|
-
const type =
|
|
9
|
-
(react && vue) || (!react && !vue) ? 'base' : react ? 'react' : 'vue';
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
eslintConfig: {
|
|
13
|
-
extends: `@nice-move/eslint-config-${type}`,
|
|
14
|
-
},
|
|
15
|
-
devDependencies: {
|
|
16
|
-
[`@nice-move/eslint-config-${type}`]: latest['eslint-config-base'],
|
|
17
|
-
eslint: latest.eslint,
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const message = 'Add/Reset project dependencies';
|
|
23
|
-
|
|
24
|
-
function action(isGit, wanted = {}) {
|
|
25
|
-
return new Json()
|
|
26
|
-
.config({ pretty: true })
|
|
27
|
-
.source('package.json')
|
|
28
|
-
.onFail()
|
|
29
|
-
.onDone(async (old = {}) => {
|
|
30
|
-
const { devDependencies = {}, dependencies = {} } = old;
|
|
31
|
-
const {
|
|
32
|
-
ava = 'ava' in devDependencies,
|
|
33
|
-
commitlint = 'commitlint' in devDependencies,
|
|
34
|
-
eslint = 'eslint' in devDependencies,
|
|
35
|
-
garou = 'garou' in devDependencies,
|
|
36
|
-
prettier = 'prettier' in devDependencies,
|
|
37
|
-
react = 'react' in dependencies,
|
|
38
|
-
stylelint = 'stylelint' in devDependencies,
|
|
39
|
-
typescript = 'typescript' in devDependencies,
|
|
40
|
-
vue = 'vue' in dependencies,
|
|
41
|
-
tailwindcss = 'tailwindcss' in dependencies ||
|
|
42
|
-
'tailwindcss' in devDependencies,
|
|
43
|
-
rustywind = 'rustywind' in devDependencies,
|
|
44
|
-
postcss = 'postcss' in devDependencies,
|
|
45
|
-
playwright = '@playwright/test' in devDependencies,
|
|
46
|
-
'bring-it': bringIt = '@bring-it/cli' in devDependencies,
|
|
47
|
-
} = wanted;
|
|
48
|
-
|
|
49
|
-
const useLint = eslint || stylelint || prettier || garou;
|
|
50
|
-
|
|
51
|
-
const prepublishOnly = [
|
|
52
|
-
useLint ? 'npm run lint:staged' : undefined,
|
|
53
|
-
ava ? 'npm test' : undefined,
|
|
54
|
-
].filter(Boolean);
|
|
55
|
-
|
|
56
|
-
if (prepublishOnly.length > 0) {
|
|
57
|
-
await new Text()
|
|
58
|
-
.onDone(() => ['#!/bin/sh', '', ...prepublishOnly, ''].join('\n'))
|
|
59
|
-
.output('.githooks/pre-commit');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (commitlint) {
|
|
63
|
-
await new Text()
|
|
64
|
-
.onDone(() =>
|
|
65
|
-
[
|
|
66
|
-
'#!/bin/sh',
|
|
67
|
-
'',
|
|
68
|
-
'npx --no-install nice-move lint commit',
|
|
69
|
-
'',
|
|
70
|
-
].join('\n'),
|
|
71
|
-
)
|
|
72
|
-
.output('.githooks/commit-msg');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return deepmerge.all(
|
|
76
|
-
[
|
|
77
|
-
old,
|
|
78
|
-
isGit && (useLint || ava || commitlint)
|
|
79
|
-
? {
|
|
80
|
-
scripts: {
|
|
81
|
-
prepare: 'git config core.hooksPath .githooks',
|
|
82
|
-
},
|
|
83
|
-
}
|
|
84
|
-
: undefined,
|
|
85
|
-
garou
|
|
86
|
-
? {
|
|
87
|
-
devDependencies: {
|
|
88
|
-
garou: latest.garou,
|
|
89
|
-
},
|
|
90
|
-
}
|
|
91
|
-
: undefined,
|
|
92
|
-
typescript
|
|
93
|
-
? {
|
|
94
|
-
devDependencies: {
|
|
95
|
-
typescript: latest.typescript,
|
|
96
|
-
},
|
|
97
|
-
}
|
|
98
|
-
: undefined,
|
|
99
|
-
useLint || commitlint
|
|
100
|
-
? {
|
|
101
|
-
devDependencies: {
|
|
102
|
-
'@nice-move/cli': latest.cli,
|
|
103
|
-
},
|
|
104
|
-
}
|
|
105
|
-
: undefined,
|
|
106
|
-
useLint
|
|
107
|
-
? {
|
|
108
|
-
scripts: {
|
|
109
|
-
'lint:staged': 'nice-move lint staged',
|
|
110
|
-
},
|
|
111
|
-
}
|
|
112
|
-
: undefined,
|
|
113
|
-
ava
|
|
114
|
-
? {
|
|
115
|
-
devDependencies: {
|
|
116
|
-
ava: latest.ava,
|
|
117
|
-
...(eslint
|
|
118
|
-
? {
|
|
119
|
-
'eslint-plugin-ava': latest['eslint-plugin-ava'],
|
|
120
|
-
}
|
|
121
|
-
: undefined),
|
|
122
|
-
},
|
|
123
|
-
scripts: {
|
|
124
|
-
prepublishOnly: old.private
|
|
125
|
-
? undefined
|
|
126
|
-
: prepublishOnly.join(' && ') || undefined,
|
|
127
|
-
test: 'ava --fail-fast',
|
|
128
|
-
},
|
|
129
|
-
}
|
|
130
|
-
: undefined,
|
|
131
|
-
eslint ? checkEslint({ react, vue }) : undefined,
|
|
132
|
-
stylelint
|
|
133
|
-
? {
|
|
134
|
-
devDependencies: {
|
|
135
|
-
'@nice-move/stylelint-config': latest['stylelint-config'],
|
|
136
|
-
stylelint: latest.stylelint,
|
|
137
|
-
},
|
|
138
|
-
stylelint: {
|
|
139
|
-
extends: '@nice-move/stylelint-config',
|
|
140
|
-
},
|
|
141
|
-
}
|
|
142
|
-
: undefined,
|
|
143
|
-
prettier
|
|
144
|
-
? {
|
|
145
|
-
devDependencies: {
|
|
146
|
-
'@nice-move/prettier-config': latest['prettier-config'],
|
|
147
|
-
prettier: latest.prettier,
|
|
148
|
-
},
|
|
149
|
-
prettier: '@nice-move/prettier-config',
|
|
150
|
-
}
|
|
151
|
-
: undefined,
|
|
152
|
-
react
|
|
153
|
-
? {
|
|
154
|
-
dependencies: {
|
|
155
|
-
react: latest.react,
|
|
156
|
-
'react-dom': latest['react-dom'],
|
|
157
|
-
},
|
|
158
|
-
devDependencies: { '@types/react': latest['@types/react'] },
|
|
159
|
-
}
|
|
160
|
-
: undefined,
|
|
161
|
-
vue ? { dependencies: { vue: latest.vue } } : undefined,
|
|
162
|
-
tailwindcss
|
|
163
|
-
? { dependencies: { tailwindcss: latest.tailwindcss } }
|
|
164
|
-
: undefined,
|
|
165
|
-
rustywind
|
|
166
|
-
? { devDependencies: { tailwindcss: latest.rustywind } }
|
|
167
|
-
: undefined,
|
|
168
|
-
postcss
|
|
169
|
-
? { devDependencies: { postcss: latest.postcss } }
|
|
170
|
-
: undefined,
|
|
171
|
-
playwright
|
|
172
|
-
? {
|
|
173
|
-
devDependencies: {
|
|
174
|
-
'@playwright/test': latest['@playwright/test'],
|
|
175
|
-
},
|
|
176
|
-
}
|
|
177
|
-
: undefined,
|
|
178
|
-
bringIt
|
|
179
|
-
? {
|
|
180
|
-
devDependencies: {
|
|
181
|
-
'@bring-it/cli': latest['@bring-it/cli'],
|
|
182
|
-
},
|
|
183
|
-
}
|
|
184
|
-
: undefined,
|
|
185
|
-
].filter(Boolean),
|
|
186
|
-
);
|
|
187
|
-
})
|
|
188
|
-
.output()
|
|
189
|
-
.logger(message)
|
|
190
|
-
.catch(console.warn);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export function Dependencies() {
|
|
194
|
-
const list = [
|
|
195
|
-
'react',
|
|
196
|
-
'vue',
|
|
197
|
-
'typescript',
|
|
198
|
-
'commitlint',
|
|
199
|
-
'eslint',
|
|
200
|
-
'stylelint',
|
|
201
|
-
'prettier',
|
|
202
|
-
'garou',
|
|
203
|
-
'rustywind',
|
|
204
|
-
'ava',
|
|
205
|
-
'playwright',
|
|
206
|
-
'bring-it',
|
|
207
|
-
'postcss',
|
|
208
|
-
'tailwindcss',
|
|
209
|
-
];
|
|
210
|
-
|
|
211
|
-
const { dependencies = {}, devDependencies = {} } = getPkg();
|
|
212
|
-
|
|
213
|
-
return {
|
|
214
|
-
instructions: false,
|
|
215
|
-
optionsPerPage: 20,
|
|
216
|
-
message,
|
|
217
|
-
name: 'Dependencies',
|
|
218
|
-
type: (first) => (first === false ? null : 'multiselect'),
|
|
219
|
-
choices: list.map((item) => ({
|
|
220
|
-
title: item,
|
|
221
|
-
value: item,
|
|
222
|
-
selected: item in dependencies || item in devDependencies,
|
|
223
|
-
})),
|
|
224
|
-
// eslint-disable-next-line consistent-return
|
|
225
|
-
format: (keywords) => {
|
|
226
|
-
if (keywords.length > 0) {
|
|
227
|
-
return (isGit) =>
|
|
228
|
-
action(
|
|
229
|
-
isGit,
|
|
230
|
-
Object.fromEntries(keywords.map((item) => [item, true])),
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
}
|