create-hsi-app 0.1.1 → 0.1.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/bin/create-hsi-app.mjs +20 -9
- package/package.json +2 -2
package/bin/create-hsi-app.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { basename, join, resolve } from 'node:path';
|
|
11
11
|
|
|
12
12
|
const templateRepo = 'https://github.com/Hsiii/frontend-template.git';
|
|
13
|
-
const defaultAppName = 'my-
|
|
13
|
+
const defaultAppName = 'my-app';
|
|
14
14
|
const targetArg = process.argv[2] ?? defaultAppName;
|
|
15
15
|
const targetPath = resolve(targetArg);
|
|
16
16
|
const appName = toPackageName(basename(targetPath));
|
|
@@ -52,6 +52,9 @@ function updatePackageJson() {
|
|
|
52
52
|
packageJson.version = '0.1.0';
|
|
53
53
|
delete packageJson.repository;
|
|
54
54
|
delete packageJson.publishConfig;
|
|
55
|
+
delete packageJson.scripts['check:create'];
|
|
56
|
+
packageJson.scripts.check =
|
|
57
|
+
'bun run typecheck && bun run lint && bun run format:check && bun run build';
|
|
55
58
|
|
|
56
59
|
writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 4)}\n`);
|
|
57
60
|
}
|
|
@@ -64,7 +67,7 @@ function updateBunLock() {
|
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
const lock = readFileSync(lockPath, 'utf8').replace(
|
|
67
|
-
'"name": "
|
|
70
|
+
'"name": "frontend-template"',
|
|
68
71
|
`"name": "${appName}"`
|
|
69
72
|
);
|
|
70
73
|
|
|
@@ -72,18 +75,26 @@ function updateBunLock() {
|
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
function updateAppText() {
|
|
75
|
-
replaceInFile(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
replaceInFile(
|
|
79
|
+
join(targetPath, 'index.html'),
|
|
80
|
+
'<title>Frontend Template</title>',
|
|
81
|
+
{
|
|
82
|
+
with: `<title>${appName}</title>`,
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
replaceInFile(
|
|
86
|
+
join(targetPath, 'src/components/App.tsx'),
|
|
87
|
+
'>Frontend Template<',
|
|
88
|
+
{
|
|
89
|
+
with: `>${appName}<`,
|
|
90
|
+
}
|
|
91
|
+
);
|
|
81
92
|
}
|
|
82
93
|
|
|
83
94
|
function writeAppReadme() {
|
|
84
95
|
const readme = `# ${appName}
|
|
85
96
|
|
|
86
|
-
Created from the
|
|
97
|
+
Created from the frontend template.
|
|
87
98
|
|
|
88
99
|
## Install
|
|
89
100
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-hsi-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Create a new app from the
|
|
5
|
+
"description": "Create a new app from the frontend template.",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-hsi-app": "bin/create-hsi-app.mjs"
|
|
8
8
|
},
|