@lark-apaas/coding-template-nestjs-react-fullstack 0.1.73-beta.0 → 0.1.73

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.
@@ -18,17 +18,17 @@
18
18
  "build:server": "NODE_ENV=production nest build",
19
19
  "build:client": "NODE_ENV=production vite build --config vite.config.ts",
20
20
  "start": "NODE_ENV=production node main.js",
21
+ "eslint": "eslint . --quiet",
21
22
  "stylelint": "stylelint client/src/**/*.css --quiet",
22
23
  "type:check": "concurrently -n \"server,client\" -c \"blue,green\" \"npm run type:check:server\" \"npm run type:check:client\"",
23
- "type:check:client": "node node_modules/typescript-native/bin/tsc --noEmit --project tsconfig.app.json",
24
- "type:check:server": "node node_modules/typescript-native/bin/tsc --noEmit --project tsconfig.node.json",
24
+ "type:check:client": "tsc --noEmit --project tsconfig.app.json",
25
+ "type:check:server": "tsc --noEmit --project tsconfig.node.json",
25
26
  "lint": "node ./scripts/lint.js",
26
27
  "precommit": "node scripts/hooks/run-precommit.js",
27
- "upgrade": "npx -y @lark-apaas/fullstack-cli sync --disable-gen-openapi",
28
- "oxlint": "oxlint . --quiet"
28
+ "upgrade": "npx -y @lark-apaas/fullstack-cli sync --disable-gen-openapi"
29
29
  },
30
30
  "dependencies": {
31
- "@lark-apaas/fullstack-nestjs-core": "^1.1.80",
31
+ "@lark-apaas/fullstack-nestjs-core": "^1.1.81",
32
32
  "@larksuiteoapi/node-sdk": "^1.76.0",
33
33
  "@nestjs/axios": "^4.0.1",
34
34
  "@nestjs/cache-manager": "^3.1.3",
@@ -53,9 +53,9 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@hookform/resolvers": "^5.2.2",
56
- "@lark-apaas/client-toolkit": "^1.2.85",
57
- "@lark-apaas/coding-preset-vite-react": "^1.0.33",
58
- "@lark-apaas/fullstack-presets": "1.1.27",
56
+ "@lark-apaas/client-toolkit": "^1.2.86",
57
+ "@lark-apaas/coding-preset-vite-react": "^1.0.34",
58
+ "@lark-apaas/fullstack-presets": "^1.1.28",
59
59
  "@nestjs/cli": "^10.4.9",
60
60
  "@radix-ui/react-accordion": "^1.2.12",
61
61
  "@radix-ui/react-alert-dialog": "^1.1.15",
@@ -102,6 +102,7 @@
102
102
  "echarts": "^6.1.0",
103
103
  "echarts-for-react": "~3.0.2",
104
104
  "embla-carousel-react": "^8.6.0",
105
+ "eslint": "^9.35.0",
105
106
  "framer-motion": "^12.38.0",
106
107
  "gsap": "^3.13.0",
107
108
  "input-otp": "^1.4.2",
@@ -129,12 +130,11 @@
129
130
  "tailwindcss": "^4.1.13",
130
131
  "tw-animate-css": "^1.3.8",
131
132
  "typescript": "^5.9.2",
133
+ "typescript-eslint": "^8.44.0",
132
134
  "uuid": "11.0.5",
133
135
  "vaul": "^1.1.2",
134
136
  "vite": "^8",
135
- "zod": "^4.3.6",
136
- "oxlint": "1.93.0",
137
- "typescript-native": "npm:typescript@7.0.2"
137
+ "zod": "^4.3.6"
138
138
  },
139
139
  "overrides": {
140
140
  "dayjs": "^1.11.15",
@@ -145,7 +145,7 @@
145
145
  "stylelint": "^17.3.0"
146
146
  },
147
147
  "engines": {
148
- "node": ">=22.18.0",
148
+ "node": ">=22.0.0",
149
149
  "npm": ">=10.0.0"
150
150
  }
151
151
  }
@@ -10,45 +10,19 @@ function getBinName(name) {
10
10
  return process.platform === 'win32' ? `${name}.cmd` : name;
11
11
  }
12
12
 
13
- function getLinter() {
14
- const pkg = JSON.parse(
15
- fs.readFileSync(path.join(cwd, 'package.json'), 'utf8')
16
- );
17
- // 优先沿用已有 eslint 入口,避免对照脚本意外切换检查器。
18
- const script =
19
- pkg.scripts?.oxlint && !pkg.scripts?.eslint ? 'oxlint' : 'eslint';
20
- const engine = /\boxlint\b/.test(pkg.scripts?.[script] || '')
21
- ? 'oxlint'
22
- : script;
23
- return { script, engine };
24
- }
25
-
26
13
  function runCommand(command, args) {
27
- return new Promise(resolve => {
14
+ return new Promise((resolve) => {
28
15
  const child = spawn(command, args, {
29
16
  cwd,
30
17
  stdio: 'inherit',
31
18
  shell: false,
32
19
  });
33
20
 
34
- child.on('close', code => resolve(code || 0));
21
+ child.on('close', (code) => resolve(code || 0));
35
22
  child.on('error', () => resolve(1));
36
23
  });
37
24
  }
38
25
 
39
- // 串行依次执行每个任务,全部跑完后再聚合退出码:
40
- // 降低并发资源占用、让各任务输出按顺序清晰可读,同时保留“一次暴露所有 lint 问题”的行为。
41
- async function runTasksSerially(taskSpecs) {
42
- let exitCode = 0;
43
- for (const [command, args] of taskSpecs) {
44
- const code = await runCommand(command, args);
45
- if (code !== 0) {
46
- exitCode = 1;
47
- }
48
- }
49
- return exitCode;
50
- }
51
-
52
26
  function normalizeProjectFile(filePath) {
53
27
  const absolutePath = path.isAbsolute(filePath)
54
28
  ? filePath
@@ -77,7 +51,7 @@ function parseFilesArg(argv) {
77
51
  return argv.slice(filesIndex + 1).filter(Boolean);
78
52
  }
79
53
 
80
- function isLintTarget(filePath) {
54
+ function isEslintTarget(filePath) {
81
55
  return /\.(c|m)?(j|t)sx?$/.test(filePath);
82
56
  }
83
57
 
@@ -117,32 +91,25 @@ function canRunStylelint() {
117
91
 
118
92
  if (!pkg.scripts || !pkg.scripts.stylelint) return false;
119
93
 
120
- return STYLELINT_CONFIG_FILES.some(file =>
121
- fs.existsSync(path.join(cwd, file))
122
- );
94
+ return STYLELINT_CONFIG_FILES.some(file => fs.existsSync(path.join(cwd, file)));
123
95
  }
124
96
 
125
97
  async function runDefaultLint() {
126
- const { script: lintScript } = getLinter();
127
- const taskSpecs = [
128
- [getBinName('npm'), ['run', lintScript]],
129
- [getBinName('npm'), ['run', 'type:check']],
130
- ];
98
+ const commands = ['npm run eslint', 'npm run type:check'];
131
99
 
132
100
  if (canRunStylelint()) {
133
- taskSpecs.push([getBinName('npm'), ['run', 'stylelint']]);
101
+ commands.push('npm run stylelint');
134
102
  } else {
135
- console.warn(
136
- '[lint] Skip stylelint: missing scripts.stylelint or stylelint config'
137
- );
103
+ console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
138
104
  }
139
105
 
140
- process.exit(await runTasksSerially(taskSpecs));
106
+ const code = await runCommand(getBinName('npx'), ['concurrently', ...commands]);
107
+ process.exit(code);
141
108
  }
142
109
 
143
110
  async function runSelectiveLint(inputFiles) {
144
111
  const normalizedFiles = Array.from(
145
- new Set(inputFiles.map(normalizeProjectFile).filter(Boolean))
112
+ new Set(inputFiles.map(normalizeProjectFile).filter(Boolean)),
146
113
  );
147
114
 
148
115
  if (normalizedFiles.length === 0) {
@@ -150,7 +117,7 @@ async function runSelectiveLint(inputFiles) {
150
117
  process.exit(0);
151
118
  }
152
119
 
153
- const lintFiles = normalizedFiles.filter(isLintTarget);
120
+ const eslintFiles = normalizedFiles.filter(isEslintTarget);
154
121
  const stylelintFiles = normalizedFiles.filter(isStylelintTarget);
155
122
  const typeCheckFiles = normalizedFiles.filter(isTypeCheckTarget);
156
123
 
@@ -168,38 +135,33 @@ async function runSelectiveLint(inputFiles) {
168
135
  }
169
136
  }
170
137
 
171
- const taskSpecs = [];
138
+ const tasks = [];
172
139
 
173
- if (lintFiles.length > 0) {
174
- const { engine: lintEngine } = getLinter();
175
- taskSpecs.push([getBinName('npx'), [lintEngine, '--quiet', ...lintFiles]]);
140
+ if (eslintFiles.length > 0) {
141
+ tasks.push(runCommand(getBinName('npx'), ['eslint', '--quiet', ...eslintFiles]));
176
142
  }
177
143
 
178
144
  if (stylelintFiles.length > 0 && !canRunStylelint()) {
179
- console.warn(
180
- '[lint] Skip stylelint: missing scripts.stylelint or stylelint config'
181
- );
145
+ console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
182
146
  } else if (stylelintFiles.length > 0) {
183
- taskSpecs.push([
184
- getBinName('npx'),
185
- ['stylelint', '--quiet', ...stylelintFiles],
186
- ]);
147
+ tasks.push(runCommand(getBinName('npx'), ['stylelint', '--quiet', ...stylelintFiles]));
187
148
  }
188
149
 
189
150
  if (clientTypeFiles.length > 0) {
190
- taskSpecs.push([getBinName('npm'), ['run', 'type:check:client']]);
151
+ tasks.push(runCommand(getBinName('npm'), ['run', 'type:check:client']));
191
152
  }
192
153
 
193
154
  if (serverTypeFiles.length > 0) {
194
- taskSpecs.push([getBinName('npm'), ['run', 'type:check:server']]);
155
+ tasks.push(runCommand(getBinName('npm'), ['run', 'type:check:server']));
195
156
  }
196
157
 
197
- if (taskSpecs.length === 0) {
158
+ if (tasks.length === 0) {
198
159
  console.log('[lint] No supported files matched for lint');
199
160
  process.exit(0);
200
161
  }
201
162
 
202
- process.exit(await runTasksSerially(taskSpecs));
163
+ const results = await Promise.all(tasks);
164
+ process.exit(results.some(code => code !== 0) ? 1 : 0);
203
165
  }
204
166
 
205
167
  async function main() {
@@ -217,7 +179,7 @@ async function main() {
217
179
  await runSelectiveLint(files);
218
180
  }
219
181
 
220
- main().catch(error => {
182
+ main().catch((error) => {
221
183
  const message = error instanceof Error ? error.message : String(error);
222
184
  console.error(`[lint] Failed to run lint: ${message}`);
223
185
  process.exit(1);