create-alistt69-kit 0.1.9 → 0.1.12
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/LICENSE +20 -20
- package/README.md +123 -122
- package/bin/index.js +24 -24
- package/package.json +44 -44
- package/src/core/apply-features.js +14 -14
- package/src/core/collect-project-info.js +170 -194
- package/src/core/copy-base-template.js +11 -11
- package/src/core/create-project.js +99 -98
- package/src/core/install-dependencies.js +27 -27
- package/src/core/parse-cli-args.js +122 -122
- package/src/core/prepare-target-directory.js +69 -69
- package/src/core/render-project-readme.js +188 -75
- package/src/core/replace-tokens.js +45 -45
- package/src/core/restore-special-files.js +18 -18
- package/src/features/autoprefixer/files/postcss.config.cjs +4 -4
- package/src/features/autoprefixer/index.js +19 -23
- package/src/features/define-feature.js +33 -0
- package/src/features/eslint/files/eslint.config.mjs +133 -133
- package/src/features/eslint/index.js +30 -35
- package/src/features/index.js +25 -15
- package/src/features/react-router/files/src/app/App.tsx +20 -20
- package/src/features/react-router/files/src/app/layouts/app/index.tsx +36 -36
- package/src/features/react-router/files/src/app/providers/router/config/router.tsx +13 -13
- package/src/features/react-router/files/src/pages/error/index.ts +1 -1
- package/src/features/react-router/files/src/pages/error/lazy.ts +3 -3
- package/src/features/react-router/files/src/pages/error/page.tsx +7 -7
- package/src/features/react-router/files/src/pages/main/index.ts +1 -1
- package/src/features/react-router/files/src/pages/main/lazy.ts +3 -3
- package/src/features/react-router/files/src/pages/main/page.tsx +7 -7
- package/src/features/react-router/index.js +19 -23
- package/src/features/stylelint/files/stylelint.config.mjs +13 -13
- package/src/features/stylelint/index.js +24 -29
- package/src/templates/base/.editorconfig +11 -11
- package/src/templates/base/README.md +2 -2
- package/src/templates/base/babel.config.json +12 -12
- package/src/templates/base/gitignore +27 -27
- package/src/templates/base/package.json +48 -48
- package/src/templates/base/public/index.html +12 -12
- package/src/templates/base/src/app/App.tsx +17 -17
- package/src/templates/base/src/index.tsx +16 -16
- package/src/templates/base/src/styles/index.scss +13 -13
- package/src/templates/base/tsconfig.json +25 -25
- package/src/utils/console-format.js +11 -11
- package/src/utils/package-json.js +96 -72
- package/src/utils/package-manager.js +22 -22
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "./build",
|
|
4
|
-
"noImplicitAny": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"target": "es6",
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"allowJs": true,
|
|
9
|
-
"moduleResolution": "node",
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"baseUrl": "./",
|
|
16
|
-
"paths": {
|
|
17
|
-
"@/*": ["./src/*"]
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"ts-node": {
|
|
21
|
-
"compilerOptions": {
|
|
22
|
-
"module": "CommonJS"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./build",
|
|
4
|
+
"noImplicitAny": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"target": "es6",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"baseUrl": "./",
|
|
16
|
+
"paths": {
|
|
17
|
+
"@/*": ["./src/*"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"ts-node": {
|
|
21
|
+
"compilerOptions": {
|
|
22
|
+
"module": "CommonJS"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const color = (code, text) => `\u001B[${code}m${text}\u001B[0m`;
|
|
2
|
-
|
|
3
|
-
export const format = {
|
|
4
|
-
cyan: (text) => color('36', text),
|
|
5
|
-
green: (text) => color('32', text),
|
|
6
|
-
yellow: (text) => color('33', text),
|
|
7
|
-
dim: (text) => color('2', text),
|
|
8
|
-
bold: (text) => color('1', text),
|
|
9
|
-
|
|
10
|
-
sectionTitle: (text) => color('36', text),
|
|
11
|
-
label: (text) => color('2', text),
|
|
1
|
+
const color = (code, text) => `\u001B[${code}m${text}\u001B[0m`;
|
|
2
|
+
|
|
3
|
+
export const format = {
|
|
4
|
+
cyan: (text) => color('36', text),
|
|
5
|
+
green: (text) => color('32', text),
|
|
6
|
+
yellow: (text) => color('33', text),
|
|
7
|
+
dim: (text) => color('2', text),
|
|
8
|
+
bold: (text) => color('1', text),
|
|
9
|
+
|
|
10
|
+
sectionTitle: (text) => color('36', text),
|
|
11
|
+
label: (text) => color('2', text),
|
|
12
12
|
};
|
|
@@ -1,73 +1,97 @@
|
|
|
1
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
packageJson.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
function sortRecordEntries(record) {
|
|
5
|
+
if (!record) {
|
|
6
|
+
return record;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return Object.fromEntries(
|
|
10
|
+
Object.entries(record).sort(([leftName], [rightName]) => (
|
|
11
|
+
leftName.localeCompare(rightName)
|
|
12
|
+
)),
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function mergeRecordEntries(currentRecord, entriesToAdd) {
|
|
17
|
+
if (!entriesToAdd || Object.keys(entriesToAdd).length === 0) {
|
|
18
|
+
return currentRecord;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return sortRecordEntries({
|
|
22
|
+
...(currentRecord ?? {}),
|
|
23
|
+
...entriesToAdd,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function normalizePackageJson(packageJson) {
|
|
28
|
+
packageJson.dependencies = sortRecordEntries(packageJson.dependencies);
|
|
29
|
+
packageJson.devDependencies = sortRecordEntries(packageJson.devDependencies);
|
|
30
|
+
packageJson.scripts = sortRecordEntries(packageJson.scripts);
|
|
31
|
+
|
|
32
|
+
return packageJson;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function readPackageJson(projectPath) {
|
|
36
|
+
const packageJsonPath = resolve(projectPath, 'package.json');
|
|
37
|
+
const content = await readFile(packageJsonPath, 'utf8');
|
|
38
|
+
|
|
39
|
+
return JSON.parse(content);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function writePackageJson(projectPath, packageJson) {
|
|
43
|
+
const packageJsonPath = resolve(projectPath, 'package.json');
|
|
44
|
+
|
|
45
|
+
await writeFile(
|
|
46
|
+
packageJsonPath,
|
|
47
|
+
`${JSON.stringify(normalizePackageJson(packageJson), null, 4)}\n`,
|
|
48
|
+
'utf8',
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function updatePackageJson(projectPath, updater) {
|
|
53
|
+
const packageJson = await readPackageJson(projectPath);
|
|
54
|
+
|
|
55
|
+
await updater(packageJson);
|
|
56
|
+
|
|
57
|
+
await writePackageJson(projectPath, packageJson);
|
|
58
|
+
|
|
59
|
+
return packageJson;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export async function patchPackageJson(projectPath, patch) {
|
|
63
|
+
return updatePackageJson(projectPath, (packageJson) => {
|
|
64
|
+
packageJson.dependencies = mergeRecordEntries(
|
|
65
|
+
packageJson.dependencies,
|
|
66
|
+
patch.dependencies,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
packageJson.devDependencies = mergeRecordEntries(
|
|
70
|
+
packageJson.devDependencies,
|
|
71
|
+
patch.devDependencies,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
packageJson.scripts = mergeRecordEntries(
|
|
75
|
+
packageJson.scripts,
|
|
76
|
+
patch.scripts,
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export async function addDependencies(projectPath, dependenciesToAdd) {
|
|
82
|
+
return patchPackageJson(projectPath, {
|
|
83
|
+
dependencies: dependenciesToAdd,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export async function addDevDependencies(projectPath, dependenciesToAdd) {
|
|
88
|
+
return patchPackageJson(projectPath, {
|
|
89
|
+
devDependencies: dependenciesToAdd,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export async function addScripts(projectPath, scriptsToAdd) {
|
|
94
|
+
return patchPackageJson(projectPath, {
|
|
95
|
+
scripts: scriptsToAdd,
|
|
96
|
+
});
|
|
73
97
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export const allowedPackageManagers = ['npm', 'pnpm', 'yarn'];
|
|
2
|
-
|
|
3
|
-
export function getInstallCommand(packageManager) {
|
|
4
|
-
if (packageManager === 'yarn') {
|
|
5
|
-
return {
|
|
6
|
-
command: 'yarn',
|
|
7
|
-
args: [],
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
command: packageManager,
|
|
13
|
-
args: ['install'],
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function getRunScriptCommand(packageManager, scriptName) {
|
|
18
|
-
if (packageManager === 'npm') {
|
|
19
|
-
return `npm run ${scriptName}`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return `${packageManager} ${scriptName}`;
|
|
1
|
+
export const allowedPackageManagers = ['npm', 'pnpm', 'yarn'];
|
|
2
|
+
|
|
3
|
+
export function getInstallCommand(packageManager) {
|
|
4
|
+
if (packageManager === 'yarn') {
|
|
5
|
+
return {
|
|
6
|
+
command: 'yarn',
|
|
7
|
+
args: [],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
command: packageManager,
|
|
13
|
+
args: ['install'],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getRunScriptCommand(packageManager, scriptName) {
|
|
18
|
+
if (packageManager === 'npm') {
|
|
19
|
+
return `npm run ${scriptName}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return `${packageManager} ${scriptName}`;
|
|
23
23
|
}
|