@lark-apaas/coding-template-nestjs-react-fullstack 0.1.36-alpha.20260904234124 → 0.1.36-alpha.20260906092334
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
package/template/nest-cli.json
CHANGED
package/template/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "./scripts/dev.sh",
|
|
13
|
-
"dev:server": "NODE_ENV=development
|
|
13
|
+
"dev:server": "NODE_ENV=development nest start --watch",
|
|
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'",
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { spawn } = require('child_process');
|
|
6
|
-
|
|
7
|
-
const TYPE_CHECK_ENV = 'MIAODA_NEST_TYPE_CHECK_ENABLED';
|
|
8
|
-
const DISABLED_CONFIG_RELATIVE_PATH = 'logs/nest-cli.type-check-disabled.json';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Build the Nest CLI arguments used to launch the development server.
|
|
12
|
-
*
|
|
13
|
-
* Missing or malformed values deliberately preserve the project's existing
|
|
14
|
-
* nest-cli.json behavior. The platform injects an exact true/false value;
|
|
15
|
-
* exact true forces the checker on, while exact false writes a narrow runtime
|
|
16
|
-
* config override so the checked-in project config is never mutated.
|
|
17
|
-
*/
|
|
18
|
-
function buildNestCliArgs({ projectRoot, env = process.env }) {
|
|
19
|
-
const enabled = env[TYPE_CHECK_ENV];
|
|
20
|
-
if (enabled === 'true') {
|
|
21
|
-
return ['start', '--watch', '--type-check'];
|
|
22
|
-
}
|
|
23
|
-
if (enabled !== 'false') {
|
|
24
|
-
return ['start', '--watch'];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const sourcePath = path.join(projectRoot, 'nest-cli.json');
|
|
28
|
-
const sourceConfig = JSON.parse(fs.readFileSync(sourcePath, 'utf8'));
|
|
29
|
-
const runtimeConfig = {
|
|
30
|
-
...sourceConfig,
|
|
31
|
-
compilerOptions: {
|
|
32
|
-
...(sourceConfig.compilerOptions || {}),
|
|
33
|
-
typeCheck: false,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const runtimePath = path.join(
|
|
37
|
-
projectRoot,
|
|
38
|
-
...DISABLED_CONFIG_RELATIVE_PATH.split('/'),
|
|
39
|
-
);
|
|
40
|
-
fs.mkdirSync(path.dirname(runtimePath), { recursive: true });
|
|
41
|
-
const temporaryPath = `${runtimePath}.${process.pid}.tmp`;
|
|
42
|
-
fs.writeFileSync(
|
|
43
|
-
temporaryPath,
|
|
44
|
-
`${JSON.stringify(runtimeConfig, null, 2)}\n`,
|
|
45
|
-
{
|
|
46
|
-
mode: 0o600,
|
|
47
|
-
},
|
|
48
|
-
);
|
|
49
|
-
fs.renameSync(temporaryPath, runtimePath);
|
|
50
|
-
|
|
51
|
-
return ['start', '--watch', '--config', DISABLED_CONFIG_RELATIVE_PATH];
|
|
52
|
-
}
|
|
53
|
-
|
|
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 };
|