@lark-apaas/coding-template-nestjs-react-fullstack 0.1.73 → 0.1.75

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,14 +18,14 @@
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",
22
21
  "stylelint": "stylelint client/src/**/*.css --quiet",
23
22
  "type:check": "concurrently -n \"server,client\" -c \"blue,green\" \"npm run type:check:server\" \"npm run type:check:client\"",
24
- "type:check:client": "tsc --noEmit --project tsconfig.app.json",
25
- "type:check:server": "tsc --noEmit --project tsconfig.node.json",
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",
26
25
  "lint": "node ./scripts/lint.js",
27
26
  "precommit": "node scripts/hooks/run-precommit.js",
28
- "upgrade": "npx -y @lark-apaas/fullstack-cli sync --disable-gen-openapi"
27
+ "upgrade": "npx -y @lark-apaas/fullstack-cli sync --disable-gen-openapi",
28
+ "oxlint": "oxlint . --quiet"
29
29
  },
30
30
  "dependencies": {
31
31
  "@lark-apaas/fullstack-nestjs-core": "^1.1.81",
@@ -102,7 +102,6 @@
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",
106
105
  "framer-motion": "^12.38.0",
107
106
  "gsap": "^3.13.0",
108
107
  "input-otp": "^1.4.2",
@@ -130,11 +129,12 @@
130
129
  "tailwindcss": "^4.1.13",
131
130
  "tw-animate-css": "^1.3.8",
132
131
  "typescript": "^5.9.2",
133
- "typescript-eslint": "^8.44.0",
134
132
  "uuid": "11.0.5",
135
133
  "vaul": "^1.1.2",
136
134
  "vite": "^8",
137
- "zod": "^4.3.6"
135
+ "zod": "^4.3.6",
136
+ "oxlint": "1.93.0",
137
+ "typescript-native": "npm:typescript@7.0.2"
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.0.0",
148
+ "node": ">=22.18.0",
149
149
  "npm": ">=10.0.0"
150
150
  }
151
151
  }
@@ -10,19 +10,45 @@ 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
+
13
26
  function runCommand(command, args) {
14
- return new Promise((resolve) => {
27
+ return new Promise(resolve => {
15
28
  const child = spawn(command, args, {
16
29
  cwd,
17
30
  stdio: 'inherit',
18
31
  shell: false,
19
32
  });
20
33
 
21
- child.on('close', (code) => resolve(code || 0));
34
+ child.on('close', code => resolve(code || 0));
22
35
  child.on('error', () => resolve(1));
23
36
  });
24
37
  }
25
38
 
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
+
26
52
  function normalizeProjectFile(filePath) {
27
53
  const absolutePath = path.isAbsolute(filePath)
28
54
  ? filePath
@@ -51,7 +77,7 @@ function parseFilesArg(argv) {
51
77
  return argv.slice(filesIndex + 1).filter(Boolean);
52
78
  }
53
79
 
54
- function isEslintTarget(filePath) {
80
+ function isLintTarget(filePath) {
55
81
  return /\.(c|m)?(j|t)sx?$/.test(filePath);
56
82
  }
57
83
 
@@ -91,25 +117,32 @@ function canRunStylelint() {
91
117
 
92
118
  if (!pkg.scripts || !pkg.scripts.stylelint) return false;
93
119
 
94
- return STYLELINT_CONFIG_FILES.some(file => fs.existsSync(path.join(cwd, file)));
120
+ return STYLELINT_CONFIG_FILES.some(file =>
121
+ fs.existsSync(path.join(cwd, file))
122
+ );
95
123
  }
96
124
 
97
125
  async function runDefaultLint() {
98
- const commands = ['npm run eslint', 'npm run type:check'];
126
+ const { script: lintScript } = getLinter();
127
+ const taskSpecs = [
128
+ [getBinName('npm'), ['run', lintScript]],
129
+ [getBinName('npm'), ['run', 'type:check']],
130
+ ];
99
131
 
100
132
  if (canRunStylelint()) {
101
- commands.push('npm run stylelint');
133
+ taskSpecs.push([getBinName('npm'), ['run', 'stylelint']]);
102
134
  } else {
103
- console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
135
+ console.warn(
136
+ '[lint] Skip stylelint: missing scripts.stylelint or stylelint config'
137
+ );
104
138
  }
105
139
 
106
- const code = await runCommand(getBinName('npx'), ['concurrently', ...commands]);
107
- process.exit(code);
140
+ process.exit(await runTasksSerially(taskSpecs));
108
141
  }
109
142
 
110
143
  async function runSelectiveLint(inputFiles) {
111
144
  const normalizedFiles = Array.from(
112
- new Set(inputFiles.map(normalizeProjectFile).filter(Boolean)),
145
+ new Set(inputFiles.map(normalizeProjectFile).filter(Boolean))
113
146
  );
114
147
 
115
148
  if (normalizedFiles.length === 0) {
@@ -117,7 +150,7 @@ async function runSelectiveLint(inputFiles) {
117
150
  process.exit(0);
118
151
  }
119
152
 
120
- const eslintFiles = normalizedFiles.filter(isEslintTarget);
153
+ const lintFiles = normalizedFiles.filter(isLintTarget);
121
154
  const stylelintFiles = normalizedFiles.filter(isStylelintTarget);
122
155
  const typeCheckFiles = normalizedFiles.filter(isTypeCheckTarget);
123
156
 
@@ -135,33 +168,38 @@ async function runSelectiveLint(inputFiles) {
135
168
  }
136
169
  }
137
170
 
138
- const tasks = [];
171
+ const taskSpecs = [];
139
172
 
140
- if (eslintFiles.length > 0) {
141
- tasks.push(runCommand(getBinName('npx'), ['eslint', '--quiet', ...eslintFiles]));
173
+ if (lintFiles.length > 0) {
174
+ const { engine: lintEngine } = getLinter();
175
+ taskSpecs.push([getBinName('npx'), [lintEngine, '--quiet', ...lintFiles]]);
142
176
  }
143
177
 
144
178
  if (stylelintFiles.length > 0 && !canRunStylelint()) {
145
- console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
179
+ console.warn(
180
+ '[lint] Skip stylelint: missing scripts.stylelint or stylelint config'
181
+ );
146
182
  } else if (stylelintFiles.length > 0) {
147
- tasks.push(runCommand(getBinName('npx'), ['stylelint', '--quiet', ...stylelintFiles]));
183
+ taskSpecs.push([
184
+ getBinName('npx'),
185
+ ['stylelint', '--quiet', ...stylelintFiles],
186
+ ]);
148
187
  }
149
188
 
150
189
  if (clientTypeFiles.length > 0) {
151
- tasks.push(runCommand(getBinName('npm'), ['run', 'type:check:client']));
190
+ taskSpecs.push([getBinName('npm'), ['run', 'type:check:client']]);
152
191
  }
153
192
 
154
193
  if (serverTypeFiles.length > 0) {
155
- tasks.push(runCommand(getBinName('npm'), ['run', 'type:check:server']));
194
+ taskSpecs.push([getBinName('npm'), ['run', 'type:check:server']]);
156
195
  }
157
196
 
158
- if (tasks.length === 0) {
197
+ if (taskSpecs.length === 0) {
159
198
  console.log('[lint] No supported files matched for lint');
160
199
  process.exit(0);
161
200
  }
162
201
 
163
- const results = await Promise.all(tasks);
164
- process.exit(results.some(code => code !== 0) ? 1 : 0);
202
+ process.exit(await runTasksSerially(taskSpecs));
165
203
  }
166
204
 
167
205
  async function main() {
@@ -179,7 +217,7 @@ async function main() {
179
217
  await runSelectiveLint(files);
180
218
  }
181
219
 
182
- main().catch((error) => {
220
+ main().catch(error => {
183
221
  const message = error instanceof Error ? error.message : String(error);
184
222
  console.error(`[lint] Failed to run lint: ${message}`);
185
223
  process.exit(1);
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "extends": "@lark-apaas/fullstack-presets/lib/simple/tsconfig/tsconfig.app.json",
3
3
  "compilerOptions": {
4
- "baseUrl": "./",
5
4
  "paths": {
6
- "@client/*": ["client/*"],
7
- "@shared/*": ["shared/*"],
5
+ "@client/*": ["./client/*"],
6
+ "@shared/*": ["./shared/*"],
8
7
  "@/*": ["./client/src/*"],
9
- "@lark-apaas/client-toolkit/tools/*": ["node_modules/@lark-apaas/client-toolkit/lib/apis/tools/*"]
8
+ "@lark-apaas/client-toolkit/tools/*": [
9
+ "./node_modules/@lark-apaas/client-toolkit/lib/apis/tools/*"
10
+ ]
10
11
  },
11
12
  "incremental": true,
13
+ "composite": true,
14
+ "tsBuildInfoFile": "./.cache/tsconfig.app.tsbuildinfo",
15
+ "types": ["node", "react", "react-dom", "styled-jsx"]
12
16
  },
13
- "include": [
14
- "client/**/*",
15
- "shared/**/*"
16
- ],
17
+ "include": ["client/**/*", "shared/**/*"],
17
18
  "exclude": [
18
19
  "node_modules",
19
20
  "dist",
@@ -1,8 +1,11 @@
1
1
  {
2
- "extends": "./tsconfig.app.json",
2
+ "files": [],
3
3
  "references": [
4
+ {
5
+ "path": "./tsconfig.app.json"
6
+ },
4
7
  {
5
8
  "path": "./tsconfig.node.json"
6
9
  }
7
10
  ]
8
- }
11
+ }
@@ -1,18 +1,29 @@
1
1
  {
2
2
  "extends": "@lark-apaas/fullstack-presets/lib/simple/tsconfig/tsconfig.node.json",
3
3
  "compilerOptions": {
4
- "baseUrl": "./",
5
4
  "outDir": "./dist",
6
5
  "preserveWatchOutput": true,
7
6
  "paths": {
8
- "@server/*": ["server/*"],
9
- "@shared/*": ["shared/*"],
10
- }
7
+ "@server/*": ["./server/*"],
8
+ "@shared/*": ["./shared/*"]
9
+ },
10
+ "module": "Preserve",
11
+ "moduleResolution": "Bundler",
12
+ "allowSyntheticDefaultImports": true,
13
+ "noEmit": true,
14
+ "tsBuildInfoFile": "./.cache/tsconfig.node.tsbuildinfo"
11
15
  },
12
16
  "watchOptions": {
13
17
  "excludeDirectories": ["node_modules/**"]
14
18
  },
15
19
  "include": ["server/**/*", "shared/**/*.ts"],
16
- // MCP UI 是独立浏览器工程,不使用服务端的 TypeScript 配置。
17
- "exclude": ["server/mcp/ui", "node_modules", "dist", "client", "source_package", "**/*.spec.ts", "**/*.e2e-spec.ts"],
20
+ "exclude": [
21
+ "server/mcp/ui",
22
+ "node_modules",
23
+ "dist",
24
+ "client",
25
+ "source_package",
26
+ "**/*.spec.ts",
27
+ "**/*.e2e-spec.ts"
28
+ ]
18
29
  }
@@ -1,66 +0,0 @@
1
- const tseslint = require('typescript-eslint');
2
- const { eslintPresetsOfSimple } = require('@lark-apaas/fullstack-presets');
3
-
4
- module.exports = tseslint.config(
5
- {
6
- ignores: [
7
- 'dist',
8
- 'dist-server',
9
- 'node_modules',
10
- 'source_package',
11
- 'coverage/**',
12
- 'logs/**',
13
- 'tmp/**',
14
- 'temp/**',
15
- '.playwright-cli/**',
16
- '.agent/**',
17
- 'client/src/api/gen',
18
- '**/*.d.ts',
19
- '**/*.js.map',
20
- ],
21
- },
22
- // Client configuration
23
- {
24
- files: ['client/**/*.{ts,tsx}', 'shared/**/*.{ts,tsx}'],
25
- extends: [
26
- ...eslintPresetsOfSimple.client,
27
- ],
28
- languageOptions: {
29
- parserOptions: {
30
- project: './tsconfig.app.json',
31
- },
32
- },
33
- settings: {
34
- 'import/resolver': {
35
- alias: {
36
- map: [
37
- ['@', './client/src'],
38
- ['@client', './client'],
39
- ['@shared', './shared'],
40
- ],
41
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
42
- },
43
- },
44
- },
45
- },
46
- // Server configuration
47
- {
48
- files: ['server/**/*.{ts,tsx}', 'shared/**/*.{ts,tsx}'],
49
- extends: [
50
- ...eslintPresetsOfSimple.server,
51
- ],
52
- languageOptions: {
53
- parserOptions: {
54
- project: './tsconfig.node.json',
55
- }
56
- },
57
- settings: {
58
- 'import/resolver': {
59
- alias: {
60
- map: [['@server', './server'], ['@shared', './shared']],
61
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
62
- },
63
- }
64
- }
65
- },
66
- );