@nice-move/init 0.3.11 → 0.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-move/init",
3
- "version": "0.3.11",
3
+ "version": "0.4.3",
4
4
  "description": "Initialize your frontend workspaces",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -36,25 +36,28 @@
36
36
  "url": "https://github.com/nice-move/nice-move/issues"
37
37
  },
38
38
  "bin": {
39
- "nice-move-init": "bin/index.mjs"
39
+ "nice-move-init": "dist/bin.cjs"
40
40
  },
41
- "main": "index.mjs",
42
- "dependencies": {
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": "^4.1.2",
48
+ "chalk": "^5.0.1",
45
49
  "deepmerge": "^4.2.2",
46
- "execa": "^5.1.1",
47
- "fs-chain": "^8.1.1",
50
+ "execa": "^6.1.0",
51
+ "fs-chain": "^8.1.2",
48
52
  "is-git-dirty": "^2.0.1",
49
53
  "is-git-repository": "^2.0.0",
50
- "ora": "^6.0.1",
51
- "os-locale": "^6.0.1",
54
+ "ora": "^6.1.0",
55
+ "os-locale": "^6.0.2",
52
56
  "parse-author": "^2.0.0",
53
57
  "prompts": "^2.4.2",
54
58
  "semver-regex": "^4.0.2",
55
- "settingz": "^0.1.0",
59
+ "settingz": "^0.1.7",
56
60
  "stringify-author": "^0.1.3",
57
- "user-meta": "^1.0.0",
58
61
  "validate-npm-package-name": "^3.0.0",
59
62
  "yarn-install": "^1.0.0"
60
63
  },
@@ -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
- }
@@ -1,89 +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
- throw new Error('fail');
32
- } catch {
33
- return Types[type()];
34
- }
35
- }
36
-
37
- export async function GitFile() {
38
- await new Text()
39
- .source('../../template/.gitattributes.tpl', import.meta.url)
40
- .output('.gitattributes')
41
- .logger('Create/Overwrite', cyan('.gitattributes'));
42
-
43
- const spinner = ora({
44
- text: 'Downloading template from `gitignore.io`',
45
- }).start();
46
-
47
- const message = `Create/Overwrite ${cyan('.gitignore')}`;
48
-
49
- return new Text()
50
- .source('.gitignore')
51
- .onFail()
52
- .onDone((oldText = '') => {
53
- const platform = getPlatform(oldText);
54
- return download(`https://gitignore.io/api/node,${platform}`)
55
- .then((newText) => {
56
- const [match] = oldText.match(regexp) || [];
57
-
58
- const io = (
59
- match
60
- ? oldText.replace(regexp, newText)
61
- : `${oldText.trim()}\n\n${newText}`
62
- )
63
- .replace(
64
- /(www\.)?toptal\.com\/developers\/gitignore/g,
65
- 'gitignore.io',
66
- )
67
- .trim()
68
- .split(/\n\n\+/g)
69
- .filter((item) => item.trim())
70
- .join('\n\n');
71
-
72
- return `${io}\n`;
73
- })
74
- .catch(() => oldText || 'node_modules\n');
75
- })
76
- .output()
77
- .then(() => {
78
- spinner.stopAndPersist({
79
- symbol: green('√'),
80
- text: message,
81
- });
82
- })
83
- .catch((error) => {
84
- spinner.stopAndPersist({
85
- symbol: red('×'),
86
- text: `${message} - ${error.message}`,
87
- });
88
- });
89
- }
@@ -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
- }
@@ -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
- }
@@ -1,28 +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
- return `registry = https://mirrors.tencent.com/npm/\r${text}`;
23
- })
24
- .output()
25
- .logger('Set registry to China mirror in', cyan('.npmrc'))
26
- .catch(console.warn);
27
- }
28
- }
package/bin/index.mjs DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { init } from '../index.mjs';
4
-
5
- const io = init();
6
-
7
- if (io && io.catch) {
8
- io.catch((error) => {
9
- if (error.message !== 'cancel') {
10
- throw error;
11
- }
12
- });
13
- }
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
- // eslint-disable-next-line no-await-in-loop
34
- const io = await action();
35
- if (io && io.catch) {
36
- io.catch((error) => {
37
- console.warn(error.message);
38
- });
39
- }
40
- }
41
- }
package/lib/color.mjs DELETED
@@ -1,3 +0,0 @@
1
- import chalk from 'chalk';
2
-
3
- export const { cyan, red, green } = chalk;
package/lib/latest.mjs DELETED
@@ -1,25 +0,0 @@
1
- export default {
2
- ava: '^3.15.0',
3
- commitlint: '^14.1.0',
4
- eslint: '^7.32.0',
5
- 'eslint-plugin-ava': '^13.1.0',
6
- garou: '^0.2.5',
7
- prettier: '^2.4.1',
8
- stylelint: '^14.0.1',
9
- typescript: '^4.4.4',
10
- '@bring-it/cli': '^0.5.6',
11
- '@playwright/test': '^1.16.3',
12
- '@types/react': '^16.14.20',
13
- postcss: '^8.3.11',
14
- react: '~16.14.0',
15
- 'react-dom': '~16.14.0',
16
- rustywind: '^0.12.2',
17
- tailwindcss: '~2.2.19',
18
- vue: '~2.6.14',
19
- 'eslint-config-base': '^0.5.68',
20
- 'stylelint-config': '^0.6.7',
21
- 'prettier-config': '^0.5.1',
22
- 'commitlint-config': '^0.3.0',
23
- cli: '^0.5.33',
24
- lts: '^12.22.0 || ^14.17.0 || >=16.13.0',
25
- };
package/lib/utils.mjs DELETED
@@ -1,61 +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
- return response.text();
16
- })
17
- .then((response) => {
18
- const data = response.trim();
19
- if (data) {
20
- return data;
21
- }
22
- throw new Error('template download fail');
23
- });
24
- }
25
-
26
- export async function gitSupport() {
27
- try {
28
- const { stdout } = await execa('git', ['--version']);
29
- return Boolean(stdout);
30
- } catch {
31
- return false;
32
- }
33
- }
34
-
35
- export function emptyDir() {
36
- return readdirSync(process.cwd()).length === 0;
37
- }
38
-
39
- export function trim(value) {
40
- return value ? value.trim() : undefined;
41
- }
42
-
43
- function getUser() {
44
- return import('user-meta')
45
- .then(({ default: meta }) => meta)
46
- .catch(() => ({}));
47
- }
48
-
49
- export async function getAuthor(author) {
50
- if (author) {
51
- return author;
52
- }
53
-
54
- const meta = await getUser();
55
-
56
- return meta.name ? stringify(meta) : 'Unknown';
57
- }
58
-
59
- export async function getAuthorName(author) {
60
- return (await getAuthor(author)).name || 'Unknown';
61
- }
@@ -1,237 +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' : 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
- ['#!/bin/sh', '', 'npx --no-install commitlint -e', ''].join('\n'),
66
- )
67
- .output('.githooks/commit-msg');
68
- }
69
-
70
- return deepmerge.all(
71
- [
72
- old,
73
- isGit && (useLint || ava || commitlint)
74
- ? {
75
- scripts: {
76
- prepare: 'git config core.hooksPath .githooks',
77
- },
78
- }
79
- : undefined,
80
- garou
81
- ? {
82
- devDependencies: {
83
- garou: latest.garou,
84
- },
85
- }
86
- : undefined,
87
- typescript
88
- ? {
89
- devDependencies: {
90
- typescript: latest.typescript,
91
- },
92
- }
93
- : undefined,
94
- commitlint
95
- ? {
96
- commitlint: {
97
- extends: '@nice-move/commitlint-config',
98
- },
99
- devDependencies: {
100
- commitlint: latest.commitlint,
101
- '@nice-move/commitlint-config': latest['commitlint-config'],
102
- },
103
- }
104
- : undefined,
105
- useLint
106
- ? {
107
- devDependencies: {
108
- '@nice-move/cli': latest.cli,
109
- },
110
- scripts: {
111
- lint: 'nice-move lint',
112
- },
113
- }
114
- : undefined,
115
- ava
116
- ? {
117
- devDependencies: {
118
- ava: latest.ava,
119
- ...(eslint
120
- ? {
121
- 'eslint-plugin-ava': latest['eslint-plugin-ava'],
122
- }
123
- : undefined),
124
- },
125
- scripts: {
126
- prepublishOnly: old.private
127
- ? undefined
128
- : prepublishOnly.join(' && ') || undefined,
129
- test: 'ava --fail-fast',
130
- },
131
- }
132
- : undefined,
133
- eslint ? checkEslint({ react, vue }) : undefined,
134
- stylelint
135
- ? {
136
- devDependencies: {
137
- '@nice-move/stylelint-config': latest['stylelint-config'],
138
- stylelint: latest.stylelint,
139
- },
140
- stylelint: {
141
- extends: '@nice-move/stylelint-config',
142
- },
143
- }
144
- : undefined,
145
- prettier
146
- ? {
147
- devDependencies: {
148
- '@nice-move/prettier-config': latest['prettier-config'],
149
- prettier: latest.prettier,
150
- },
151
- prettier: '@nice-move/prettier-config',
152
- }
153
- : undefined,
154
- react
155
- ? {
156
- dependencies: {
157
- react: latest.react,
158
- 'react-dom': latest['react-dom'],
159
- },
160
- devDependencies: { '@types/react': latest['@types/react'] },
161
- }
162
- : undefined,
163
- vue ? { dependencies: { vue: latest.vue } } : undefined,
164
- tailwindcss
165
- ? { dependencies: { tailwindcss: latest.tailwindcss } }
166
- : undefined,
167
- rustywind
168
- ? { devDependencies: { tailwindcss: latest.rustywind } }
169
- : undefined,
170
- postcss
171
- ? { devDependencies: { postcss: latest.postcss } }
172
- : undefined,
173
- playwright
174
- ? {
175
- devDependencies: {
176
- '@playwright/test': latest['@playwright/test'],
177
- },
178
- }
179
- : undefined,
180
- bringIt
181
- ? {
182
- devDependencies: {
183
- '@bring-it/cli': latest['@bring-it/cli'],
184
- },
185
- }
186
- : undefined,
187
- ].filter(Boolean),
188
- );
189
- })
190
- .output()
191
- .logger(message)
192
- .catch(console.warn);
193
- }
194
-
195
- export function Dependencies() {
196
- const list = [
197
- 'react',
198
- 'vue',
199
- 'typescript',
200
- 'commitlint',
201
- 'eslint',
202
- 'stylelint',
203
- 'prettier',
204
- 'garou',
205
- 'rustywind',
206
- 'ava',
207
- 'playwright',
208
- 'bring-it',
209
- 'postcss',
210
- 'tailwindcss',
211
- ];
212
-
213
- const { dependencies = {}, devDependencies = {} } = getPkg();
214
-
215
- return {
216
- instructions: false,
217
- optionsPerPage: 20,
218
- message,
219
- name: 'Dependencies',
220
- type: (first) => (first === false ? null : 'multiselect'),
221
- choices: list.map((item) => ({
222
- title: item,
223
- value: item,
224
- selected: item in dependencies || item in devDependencies,
225
- })),
226
- // eslint-disable-next-line consistent-return
227
- format: (keywords) => {
228
- if (keywords.length > 0) {
229
- return (isGit) =>
230
- action(
231
- isGit,
232
- Object.fromEntries(keywords.map((item) => [item, true])),
233
- );
234
- }
235
- },
236
- };
237
- }
@@ -1,34 +0,0 @@
1
- import execa from 'execa';
2
-
3
- import { green, red } from '../lib/color.mjs';
4
-
5
- const message = 'Initialize as git repository';
6
-
7
- function init() {
8
- return execa('git', ['init']).then(
9
- (io) => {
10
- console.log(green('√'), message);
11
- return io;
12
- },
13
- (error) => {
14
- console.log(red('×'), message);
15
- throw error;
16
- },
17
- );
18
- }
19
-
20
- export function GitInit({ gitSupported, isGit }) {
21
- return {
22
- message,
23
- name: 'GitInit',
24
- initial: true,
25
- type: (first) =>
26
- first === false || !gitSupported || isGit ? null : 'confirm',
27
- // eslint-disable-next-line consistent-return
28
- format(value) {
29
- if (value === true) {
30
- return init;
31
- }
32
- },
33
- };
34
- }
package/prompt/index.mjs DELETED
@@ -1,72 +0,0 @@
1
- import isGitDirty from 'is-git-dirty';
2
- import isGitRepo from 'is-git-repository';
3
- import prompts from 'prompts';
4
- import { getPkg } from 'settingz';
5
-
6
- import { emptyDir, gitSupport } from '../lib/utils.mjs';
7
-
8
- import { Dependencies } from './dependencies.mjs';
9
- import { GitInit } from './git-init.mjs';
10
- import { Install } from './install.mjs';
11
- import { Package } from './package.mjs';
12
-
13
- export async function Prompt() {
14
- const gitSupported = await gitSupport();
15
- const isGit = gitSupported && isGitRepo();
16
- const isDirty = isGit ? isGitDirty() : false;
17
- const isEmpty = emptyDir();
18
- const pkg = getPkg();
19
- const cwd = process.cwd();
20
-
21
- const options = {
22
- gitSupported,
23
- isGit,
24
- isDirty,
25
- isEmpty,
26
- pkg,
27
- cwd,
28
- };
29
-
30
- const PackagePrompts = await Package(options);
31
-
32
- return prompts(
33
- [
34
- {
35
- active: 'do it',
36
- inactive: 'cancel',
37
- message:
38
- isDirty === true ? 'Repository not clean' : 'Workspace not empty',
39
- name: 'okay',
40
- type: () => (isEmpty || isDirty === false ? null : 'toggle'),
41
- },
42
- GitInit(options),
43
- ...PackagePrompts,
44
- Dependencies(options),
45
- Install(options),
46
- ],
47
- {
48
- onCancel() {
49
- throw new Error('cancel');
50
- },
51
- },
52
- )
53
- .then(({ okay, ...rest }) => {
54
- if (okay === false) {
55
- throw new Error('cancel');
56
- }
57
- return Object.entries(rest);
58
- })
59
- .then((sets) => {
60
- const names = PackagePrompts.map(({ name }) => name);
61
-
62
- const info = Object.fromEntries(
63
- sets.filter(([key]) => names.includes(key)),
64
- );
65
-
66
- const rest = Object.fromEntries(
67
- sets.filter(([key]) => !names.includes(key)),
68
- );
69
-
70
- return { ...rest, info, options };
71
- });
72
- }
@@ -1,22 +0,0 @@
1
- import install from 'yarn-install';
2
-
3
- import { cyan } from '../lib/color.mjs';
4
-
5
- const message = `Run ${cyan('npm')} / ${cyan('yarn')} install command`;
6
-
7
- export function Install() {
8
- return {
9
- message,
10
- name: 'Install',
11
- type: (first) => (first === false ? null : 'confirm'),
12
- // eslint-disable-next-line consistent-return
13
- format(value) {
14
- if (value === true) {
15
- return () => {
16
- console.log('-'.repeat(32));
17
- install();
18
- };
19
- }
20
- },
21
- };
22
- }
@@ -1,98 +0,0 @@
1
- import { parse as parsePath } from 'path';
2
-
3
- import parse from 'parse-author';
4
- import semverRegex from 'semver-regex';
5
- import validate from 'validate-npm-package-name';
6
-
7
- import { getAuthor, trim } from '../lib/utils.mjs';
8
-
9
- const semver = semverRegex();
10
-
11
- function arrayLength(data) {
12
- return Array.isArray(data) && data.length > 0;
13
- }
14
-
15
- export async function Package({
16
- cwd,
17
- pkg: {
18
- author,
19
- description,
20
- license,
21
- name,
22
- private: isPrivate,
23
- version,
24
- workspaces,
25
- } = {},
26
- }) {
27
- return [
28
- {
29
- format: trim,
30
- initial: parsePath(cwd).base,
31
- message: 'package.json » name',
32
- name: 'name',
33
- type: (first) => (first === false || name ? null : 'text'),
34
- validate: (value) => validate(trim(value) || '').validForNewPackages,
35
- },
36
- {
37
- format: trim,
38
- initial: '0.0.0',
39
- message: 'package.json » version',
40
- name: 'version',
41
- type: (first) => (first === false || version ? null : 'text'),
42
- validate: (value) => semver.test(trim(value) || ''),
43
- },
44
- {
45
- format: trim,
46
- message: 'package.json » description',
47
- name: 'description',
48
- type: (first) => (first === false || description ? null : 'text'),
49
- },
50
- {
51
- active: 'MIT',
52
- format: (value) => (value ? 'MIT' : 'UNLICENSED'),
53
- inactive: 'UNLICENSED',
54
- initial: true,
55
- message: 'package.json » license',
56
- name: 'license',
57
- type: (first) => (first === false || license ? null : 'toggle'),
58
- },
59
- {
60
- type: (first) =>
61
- first === false ||
62
- (typeof author === 'string' ? author : author && author.name)
63
- ? null
64
- : 'text',
65
- format: parse,
66
- initial: await getAuthor(author),
67
- message: 'package.json » author',
68
- name: 'author',
69
- },
70
- {
71
- active: 'true',
72
- inactive: 'false',
73
- initial: false,
74
- message: 'package.json » private',
75
- name: 'private',
76
- format: (value) => (value === false ? undefined : value),
77
- type: (first) =>
78
- first === false || isPrivate !== undefined ? null : 'toggle',
79
- },
80
- {
81
- active: 'recommend',
82
- inactive: 'false',
83
- initial: false,
84
- message: 'package.json » workspaces',
85
- name: 'workspaces',
86
- format: (value) => (value ? ['packages/*', 'tools/*'] : undefined),
87
- type: (first, feedback) =>
88
- first === false ||
89
- isPrivate === false ||
90
- feedback.private === false ||
91
- arrayLength(
92
- workspaces && workspaces.packages ? workspaces.packages : workspaces,
93
- )
94
- ? null
95
- : 'toggle',
96
- },
97
- ];
98
- }
@@ -1,13 +0,0 @@
1
- # Created by nice-move
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- end_of_line = lf
7
- indent_size = 2
8
- indent_style = space
9
- insert_final_newline = true
10
- max_line_length = 80
11
- quote_type = single
12
- tab_width = 2
13
- trim_trailing_whitespace = true
@@ -1,3 +0,0 @@
1
- # Created by nice-move
2
-
3
- * text=auto eol=lf
package/template/mit.tpl DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) {{year}} {{holder}}
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,24 +0,0 @@
1
- This is free and unencumbered software released into the public domain.
2
-
3
- Anyone is free to copy, modify, publish, use, compile, sell, or
4
- distribute this software, either in source code form or as a compiled
5
- binary, for any purpose, commercial or non-commercial, and by any
6
- means.
7
-
8
- In jurisdictions that recognize copyright laws, the author or authors
9
- of this software dedicate any and all copyright interest in the
10
- software to the public domain. We make this dedication for the benefit
11
- of the public at large and to the detriment of our heirs and
12
- successors. We intend this dedication to be an overt act of
13
- relinquishment in perpetuity of all present and future rights to this
14
- software under copyright law.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- For more information, please refer to <https://unlicense.org/>