@lark-apaas/coding-template-nestjs-react-fullstack 0.1.36-alpha.20260904154046 → 0.1.36-alpha.20260904234124

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/coding-template-nestjs-react-fullstack",
3
- "version": "0.1.36-alpha.20260904154046",
3
+ "version": "0.1.36-alpha.20260904234124",
4
4
  "description": "NestJS + React fullstack template for miaoda coding",
5
5
  "type": "module",
6
6
  "files": [
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "scripts": {
12
12
  "dev": "./scripts/dev.sh",
13
- "dev:server": "NODE_ENV=development nest start --watch",
13
+ "dev:server": "NODE_ENV=development node scripts/nest-type-check.cjs",
14
14
  "dev:client": "NODE_ENV=development vite --config vite.config.ts",
15
15
  "gen:db-schema": "npx -y @lark-apaas/db-schema-sync@latest --output server/database/schema.ts --export-custom-types",
16
16
  "gen:openapi": "echo 'UNSUPPORTED, SKIP'",
@@ -5,7 +5,6 @@ const fs = require('fs');
5
5
  const path = require('path');
6
6
  const { spawn, execSync } = require('child_process');
7
7
  const readline = require('readline');
8
- const { buildNestServerArgs } = require('./nest-type-check.cjs');
9
8
 
10
9
  // ── Project root ──────────────────────────────────────────────────────────────
11
10
  const PROJECT_ROOT = path.resolve(__dirname, '..');
@@ -268,7 +267,7 @@ async function main() {
268
267
  const serverPromise = startProcess({
269
268
  name: 'server',
270
269
  command: 'npm',
271
- args: buildNestServerArgs({ projectRoot: PROJECT_ROOT, env: process.env }),
270
+ args: ['run', 'dev:server'],
272
271
  cleanupPort: SERVER_PORT,
273
272
  });
274
273
 
@@ -2,25 +2,26 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const { spawn } = require('child_process');
5
6
 
6
7
  const TYPE_CHECK_ENV = 'MIAODA_NEST_TYPE_CHECK_ENABLED';
7
8
  const DISABLED_CONFIG_RELATIVE_PATH = 'logs/nest-cli.type-check-disabled.json';
8
9
 
9
10
  /**
10
- * Build the npm arguments used to launch Nest in development.
11
+ * Build the Nest CLI arguments used to launch the development server.
11
12
  *
12
13
  * Missing or malformed values deliberately preserve the project's existing
13
14
  * nest-cli.json behavior. The platform injects an exact true/false value;
14
15
  * exact true forces the checker on, while exact false writes a narrow runtime
15
16
  * config override so the checked-in project config is never mutated.
16
17
  */
17
- function buildNestServerArgs({ projectRoot, env = process.env }) {
18
+ function buildNestCliArgs({ projectRoot, env = process.env }) {
18
19
  const enabled = env[TYPE_CHECK_ENV];
19
20
  if (enabled === 'true') {
20
- return ['run', 'dev:server', '--', '--type-check'];
21
+ return ['start', '--watch', '--type-check'];
21
22
  }
22
23
  if (enabled !== 'false') {
23
- return ['run', 'dev:server'];
24
+ return ['start', '--watch'];
24
25
  }
25
26
 
26
27
  const sourcePath = path.join(projectRoot, 'nest-cli.json');
@@ -47,7 +48,38 @@ function buildNestServerArgs({ projectRoot, env = process.env }) {
47
48
  );
48
49
  fs.renameSync(temporaryPath, runtimePath);
49
50
 
50
- return ['run', 'dev:server', '--', '--config', DISABLED_CONFIG_RELATIVE_PATH];
51
+ return ['start', '--watch', '--config', DISABLED_CONFIG_RELATIVE_PATH];
51
52
  }
52
53
 
53
- module.exports = { buildNestServerArgs };
54
+ function runNestServer({ projectRoot = path.resolve(__dirname, '..'), env = process.env } = {}) {
55
+ const executable = path.join(
56
+ projectRoot,
57
+ 'node_modules',
58
+ '.bin',
59
+ process.platform === 'win32' ? 'nest.cmd' : 'nest',
60
+ );
61
+ const child = spawn(executable, buildNestCliArgs({ projectRoot, env }), {
62
+ cwd: projectRoot,
63
+ env,
64
+ stdio: 'inherit',
65
+ });
66
+
67
+ child.once('error', (error) => {
68
+ console.error(`[nest-type-check] failed to start Nest CLI: ${error.message}`);
69
+ process.exitCode = 1;
70
+ });
71
+ child.once('exit', (code, signal) => {
72
+ if (signal) {
73
+ process.kill(process.pid, signal);
74
+ return;
75
+ }
76
+ process.exitCode = code ?? 1;
77
+ });
78
+ return child;
79
+ }
80
+
81
+ if (require.main === module) {
82
+ runNestServer();
83
+ }
84
+
85
+ module.exports = { buildNestCliArgs, runNestServer };