create-hsi-app 0.1.1 → 0.1.4

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.
@@ -10,7 +10,8 @@ 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-hsi-app';
13
+ const templateTag = 'v0.1.4';
14
+ const defaultAppName = 'my-app';
14
15
  const targetArg = process.argv[2] ?? defaultAppName;
15
16
  const targetPath = resolve(targetArg);
16
17
  const appName = toPackageName(basename(targetPath));
@@ -19,7 +20,17 @@ if (existsSync(targetPath) && readdirSync(targetPath).length > 0) {
19
20
  fail(`Target directory is not empty: ${targetPath}`);
20
21
  }
21
22
 
22
- run('git', ['clone', '--depth', '1', templateRepo, targetPath]);
23
+ run('git', [
24
+ '-c',
25
+ 'advice.detachedHead=false',
26
+ 'clone',
27
+ '--branch',
28
+ templateTag,
29
+ '--depth',
30
+ '1',
31
+ templateRepo,
32
+ targetPath,
33
+ ]);
23
34
 
24
35
  rmSync(join(targetPath, '.git'), { force: true, recursive: true });
25
36
  rmSync(join(targetPath, '.github'), { force: true, recursive: true });
@@ -52,6 +63,9 @@ function updatePackageJson() {
52
63
  packageJson.version = '0.1.0';
53
64
  delete packageJson.repository;
54
65
  delete packageJson.publishConfig;
66
+ delete packageJson.scripts['check:create'];
67
+ packageJson.scripts.check =
68
+ 'bun run typecheck && bun run lint && bun run format:check && bun run build';
55
69
 
56
70
  writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 4)}\n`);
57
71
  }
@@ -64,7 +78,7 @@ function updateBunLock() {
64
78
  }
65
79
 
66
80
  const lock = readFileSync(lockPath, 'utf8').replace(
67
- '"name": "@hsiii/hsi-app"',
81
+ '"name": "frontend-template"',
68
82
  `"name": "${appName}"`
69
83
  );
70
84
 
@@ -72,18 +86,26 @@ function updateBunLock() {
72
86
  }
73
87
 
74
88
  function updateAppText() {
75
- replaceInFile(join(targetPath, 'index.html'), '<title>hsi-app</title>', {
76
- with: `<title>${appName}</title>`,
77
- });
78
- replaceInFile(join(targetPath, 'src/components/App.tsx'), '>hsi-app<', {
79
- with: `>${appName}<`,
80
- });
89
+ replaceInFile(
90
+ join(targetPath, 'index.html'),
91
+ '<title>Frontend Template</title>',
92
+ {
93
+ with: `<title>${appName}</title>`,
94
+ }
95
+ );
96
+ replaceInFile(
97
+ join(targetPath, 'src/components/App.tsx'),
98
+ '>Frontend Template<',
99
+ {
100
+ with: `>${appName}<`,
101
+ }
102
+ );
81
103
  }
82
104
 
83
105
  function writeAppReadme() {
84
106
  const readme = `# ${appName}
85
107
 
86
- Created from the hsi-app frontend template.
108
+ Created from the frontend template.
87
109
 
88
110
  ## Install
89
111
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "create-hsi-app",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
- "description": "Create a new app from the hsi-app frontend template.",
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
  },