@depup/nestjs__cli 12.0.1-depup.0 → 12.0.5-depup.0
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/README.md +3 -3
- package/actions/new.action.js +15 -3
- package/changes.json +2 -2
- package/lib/compiler/defaults/swc-defaults.d.ts +14 -0
- package/lib/compiler/defaults/swc-defaults.js +47 -4
- package/lib/compiler/swc/swc-compiler.js +34 -4
- package/lib/ui/messages.d.ts +3 -0
- package/lib/ui/messages.js +4 -1
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/nestjs__cli
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@nestjs/cli](https://www.npmjs.com/package/@nestjs/cli) @ 12.0.
|
|
17
|
-
| Processed | 2026-09-
|
|
16
|
+
| Original | [@nestjs/cli](https://www.npmjs.com/package/@nestjs/cli) @ 12.0.5 |
|
|
17
|
+
| Processed | 2026-09-22 |
|
|
18
18
|
| Smoke test | failed |
|
|
19
19
|
| Deps updated | 2 |
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ npm install @depup/nestjs__cli
|
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| @nestjs/schematics | ^12.0.0 | ^12.0.
|
|
25
|
+
| @nestjs/schematics | ^12.0.0 | ^12.0.4 |
|
|
26
26
|
| typescript | ~6.0.2 | ^7.0.2 |
|
|
27
27
|
|
|
28
28
|
---
|
package/actions/new.action.js
CHANGED
|
@@ -26,6 +26,9 @@ export class NewAction extends AbstractAction {
|
|
|
26
26
|
await initializeGitRepository(projectDirectory);
|
|
27
27
|
await createGitIgnoreFile(projectDirectory);
|
|
28
28
|
}
|
|
29
|
+
if (context.observe) {
|
|
30
|
+
printObservabilityNextSteps();
|
|
31
|
+
}
|
|
29
32
|
printCollective();
|
|
30
33
|
}
|
|
31
34
|
process.exit(0);
|
|
@@ -100,14 +103,15 @@ const installPackages = async (context, installDirectory) => {
|
|
|
100
103
|
}
|
|
101
104
|
};
|
|
102
105
|
const askForObservability = async () => {
|
|
103
|
-
//
|
|
104
|
-
//
|
|
106
|
+
// The prompt below defaults to yes, but that only holds where someone is
|
|
107
|
+
// there to say no. Without a TTY (CI, piped input, `execSync`) nobody
|
|
108
|
+
// consented to the extra dependency, so stay off rather than block or assume.
|
|
105
109
|
if (!isInteractive()) {
|
|
106
110
|
return false;
|
|
107
111
|
}
|
|
108
112
|
return (await confirm({
|
|
109
113
|
message: MESSAGES.OBSERVABILITY_QUESTION,
|
|
110
|
-
default:
|
|
114
|
+
default: true,
|
|
111
115
|
}).catch(gracefullyExitOnPromptError));
|
|
112
116
|
};
|
|
113
117
|
const askForPackageManager = async () => {
|
|
@@ -143,6 +147,14 @@ const createGitIgnoreFile = (dir, content) => {
|
|
|
143
147
|
}
|
|
144
148
|
return fs.promises.writeFile(filePath, fileContent);
|
|
145
149
|
};
|
|
150
|
+
const printObservabilityNextSteps = () => {
|
|
151
|
+
console.info();
|
|
152
|
+
console.info(MESSAGES.OBSERVABILITY_NEXT_STEPS);
|
|
153
|
+
console.info();
|
|
154
|
+
console.info(ansis.underline(MESSAGES.OBSERVABILITY_SIGN_UP_URL));
|
|
155
|
+
console.info(ansis.gray(MESSAGES.OBSERVABILITY_KEYS_HINT));
|
|
156
|
+
console.info();
|
|
157
|
+
};
|
|
146
158
|
const printCollective = () => {
|
|
147
159
|
const dim = print('dim');
|
|
148
160
|
const yellow = print('yellow');
|
package/changes.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"bumped": {
|
|
3
3
|
"@nestjs/schematics": {
|
|
4
4
|
"from": "^12.0.0",
|
|
5
|
-
"to": "^12.0.
|
|
5
|
+
"to": "^12.0.4"
|
|
6
6
|
},
|
|
7
7
|
"typescript": {
|
|
8
8
|
"from": "~6.0.2",
|
|
9
9
|
"to": "^7.0.2"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
"timestamp": "2026-09-
|
|
12
|
+
"timestamp": "2026-09-22T16:11:07.853Z",
|
|
13
13
|
"totalUpdated": 2
|
|
14
14
|
}
|
|
@@ -5,8 +5,15 @@ export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, config
|
|
|
5
5
|
sourceMaps: string | boolean | undefined;
|
|
6
6
|
module: {
|
|
7
7
|
type: string;
|
|
8
|
+
resolveFully: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
type: string;
|
|
11
|
+
resolveFully?: undefined;
|
|
8
12
|
};
|
|
9
13
|
jsc: {
|
|
14
|
+
experimental?: {
|
|
15
|
+
keepImportAttributes: boolean;
|
|
16
|
+
} | undefined;
|
|
10
17
|
target: string;
|
|
11
18
|
parser: {
|
|
12
19
|
syntax: string;
|
|
@@ -62,3 +69,10 @@ export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, config
|
|
|
62
69
|
stripLeadingPaths: boolean;
|
|
63
70
|
};
|
|
64
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Picks the module format tsc would emit for the project's `.ts` files: ES
|
|
74
|
+
* modules when the package is `"type": "module"`, unless the tsconfig pins an
|
|
75
|
+
* older, non-ES module kind (e.g. `"module": "commonjs"`). Projects without
|
|
76
|
+
* `"type": "module"` keep CommonJS output.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveSwcModuleType(tsOptions?: ts.CompilerOptions, esmPackage?: boolean): 'es6' | 'commonjs';
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { isEsmProject } from '../../utils/is-esm-project.js';
|
|
1
3
|
export const swcDefaultsFactory = (tsOptions, configuration, tsConfigExclude = []) => {
|
|
2
4
|
const builderOptions = typeof configuration?.compilerOptions?.builder !== 'string'
|
|
3
5
|
? configuration?.compilerOptions?.builder?.options
|
|
4
6
|
: {};
|
|
7
|
+
const esm = resolveSwcModuleType(tsOptions) === 'es6';
|
|
5
8
|
return {
|
|
6
9
|
swcOptions: {
|
|
7
10
|
sourceMaps: tsOptions?.sourceMap || (tsOptions?.inlineSourceMap && 'inline'),
|
|
8
|
-
module:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
module: esm
|
|
12
|
+
? {
|
|
13
|
+
type: 'es6',
|
|
14
|
+
// Node's ESM resolver requires full specifiers, so give the ones
|
|
15
|
+
// swc rewrites from "paths" (and any extensionless relative ones)
|
|
16
|
+
// the extension of the emitted file, or "/index.js" for directories.
|
|
17
|
+
resolveFully: true,
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
type: 'commonjs',
|
|
21
|
+
},
|
|
11
22
|
jsc: {
|
|
12
23
|
target: 'es2021',
|
|
13
24
|
parser: {
|
|
@@ -21,8 +32,11 @@ export const swcDefaultsFactory = (tsOptions, configuration, tsConfigExclude = [
|
|
|
21
32
|
useDefineForClassFields: false,
|
|
22
33
|
},
|
|
23
34
|
keepClassNames: true,
|
|
24
|
-
baseUrl: tsOptions
|
|
35
|
+
baseUrl: resolveBaseUrl(tsOptions),
|
|
25
36
|
paths: tsOptions?.paths,
|
|
37
|
+
// swc drops import attributes by default, but Node needs
|
|
38
|
+
// `with { type: 'json' }` to import JSON from ES modules.
|
|
39
|
+
...(esm && { experimental: { keepImportAttributes: true } }),
|
|
26
40
|
},
|
|
27
41
|
minify: false,
|
|
28
42
|
swcrc: true,
|
|
@@ -42,6 +56,35 @@ export const swcDefaultsFactory = (tsOptions, configuration, tsConfigExclude = [
|
|
|
42
56
|
},
|
|
43
57
|
};
|
|
44
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Picks the module format tsc would emit for the project's `.ts` files: ES
|
|
61
|
+
* modules when the package is `"type": "module"`, unless the tsconfig pins an
|
|
62
|
+
* older, non-ES module kind (e.g. `"module": "commonjs"`). Projects without
|
|
63
|
+
* `"type": "module"` keep CommonJS output.
|
|
64
|
+
*/
|
|
65
|
+
export function resolveSwcModuleType(tsOptions, esmPackage = isEsmProject()) {
|
|
66
|
+
if (!esmPackage) {
|
|
67
|
+
return 'commonjs';
|
|
68
|
+
}
|
|
69
|
+
const moduleKind = tsOptions?.module;
|
|
70
|
+
if (moduleKind !== undefined && moduleKind < ts.ModuleKind.ES2015) {
|
|
71
|
+
return 'commonjs';
|
|
72
|
+
}
|
|
73
|
+
return 'es6';
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Without "baseUrl" (deprecated as of TypeScript 6), tsc resolves "paths"
|
|
77
|
+
* relative to the directory of the tsconfig that declares them, which the
|
|
78
|
+
* TypeScript parser exposes as "pathsBasePath". swc has no such fallback and
|
|
79
|
+
* panics when "paths" is set without "jsc.baseUrl", so pass that directory.
|
|
80
|
+
*/
|
|
81
|
+
function resolveBaseUrl(tsOptions) {
|
|
82
|
+
if (tsOptions?.baseUrl || !tsOptions?.paths) {
|
|
83
|
+
return tsOptions?.baseUrl;
|
|
84
|
+
}
|
|
85
|
+
const pathsBasePath = tsOptions.pathsBasePath;
|
|
86
|
+
return typeof pathsBasePath === 'string' ? pathsBasePath : undefined;
|
|
87
|
+
}
|
|
45
88
|
/**
|
|
46
89
|
* Mirrors tsc's output layout: tsc flattens the source directory out of the
|
|
47
90
|
* output when its (effective) rootDir is the source root, so swc must strip
|
|
@@ -2,6 +2,7 @@ import { cyan } from 'ansis';
|
|
|
2
2
|
import { fork, spawnSync } from 'child_process';
|
|
3
3
|
import { readFileSync } from 'fs';
|
|
4
4
|
import { stat } from 'fs/promises';
|
|
5
|
+
import { parse as parseJsonc, printParseErrorCode, } from 'jsonc-parser';
|
|
5
6
|
import { minimatch } from 'minimatch';
|
|
6
7
|
import { createRequire } from 'module';
|
|
7
8
|
import * as path from 'path';
|
|
@@ -186,17 +187,46 @@ export class SwcCompiler extends BaseCompiler {
|
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
getSwcRcFileContentIfExists(swcrcFilePath) {
|
|
190
|
+
const isCustomPath = swcrcFilePath !== undefined;
|
|
191
|
+
const resolvedPath = join(process.cwd(), swcrcFilePath ?? '.swcrc');
|
|
192
|
+
let content;
|
|
189
193
|
try {
|
|
190
|
-
|
|
194
|
+
content = readFileSync(resolvedPath, 'utf8');
|
|
191
195
|
}
|
|
192
|
-
catch {
|
|
193
|
-
|
|
196
|
+
catch (err) {
|
|
197
|
+
// Only treat ENOENT on the default `.swcrc` as "no user overrides to
|
|
198
|
+
// merge". Any other read error (EACCES, EISDIR, …) or a missing
|
|
199
|
+
// user-specified `swcrcPath` is a fatal misconfiguration.
|
|
200
|
+
const isMissing = err?.code === 'ENOENT';
|
|
201
|
+
if (isCustomPath || !isMissing) {
|
|
194
202
|
console.error(ERROR_PREFIX +
|
|
195
|
-
` Failed to load "${swcrcFilePath}". Please, check if the file exists and is
|
|
203
|
+
` Failed to load "${swcrcFilePath ?? '.swcrc'}". Please, check if the file exists and is readable.`);
|
|
196
204
|
process.exit(1);
|
|
197
205
|
}
|
|
198
206
|
return {};
|
|
199
207
|
}
|
|
208
|
+
// SWC strips a leading UTF-8 BOM before parsing
|
|
209
|
+
// (`s.trim_start_matches('\u{feff}')`), so match that here — otherwise
|
|
210
|
+
// `jsonc-parser` fails with `InvalidSymbol` on files SWC accepts.
|
|
211
|
+
const stripped = content.replace(/^/, '');
|
|
212
|
+
// .swcrc is JSON-with-comments in SWC itself, which uses jsonc_parser
|
|
213
|
+
// with `allow_comments` + `allow_trailing_commas` enabled (see swc's
|
|
214
|
+
// `parse_swcrc` in crates/swc/src/lib.rs). Match that here so we don't
|
|
215
|
+
// silently reject a valid `.swcrc` that carries `//` / `/* */` comments
|
|
216
|
+
// or a trailing comma.
|
|
217
|
+
const errors = [];
|
|
218
|
+
const parsed = parseJsonc(stripped, errors, { allowTrailingComma: true });
|
|
219
|
+
if (errors.length > 0) {
|
|
220
|
+
const first = errors[0];
|
|
221
|
+
const before = stripped.slice(0, first.offset).split('\n');
|
|
222
|
+
const position = `${before.length}:${before[before.length - 1].length + 1}`;
|
|
223
|
+
console.error(ERROR_PREFIX +
|
|
224
|
+
` Failed to parse "${swcrcFilePath ?? '.swcrc'}": ` +
|
|
225
|
+
`${printParseErrorCode(first.error)} at ${position}. ` +
|
|
226
|
+
`The file must be valid JSON with comments (JSONC).`);
|
|
227
|
+
process.exit(1);
|
|
228
|
+
}
|
|
229
|
+
return parsed ?? {};
|
|
200
230
|
}
|
|
201
231
|
deepMerge(target, source) {
|
|
202
232
|
if (typeof target !== 'object' ||
|
package/lib/ui/messages.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ export declare const MESSAGES: {
|
|
|
24
24
|
UPGRADE_IN_PROGRESS: string;
|
|
25
25
|
UPGRADE_GLOBAL_CLI_HINT: string;
|
|
26
26
|
OBSERVABILITY_QUESTION: string;
|
|
27
|
+
OBSERVABILITY_NEXT_STEPS: string;
|
|
28
|
+
OBSERVABILITY_SIGN_UP_URL: string;
|
|
29
|
+
OBSERVABILITY_KEYS_HINT: string;
|
|
27
30
|
MAU_INSTALLATION_QUESTION: (name: string) => string;
|
|
28
31
|
MAU_INSTALLATION_IN_PROGRESS: (name: string) => string;
|
|
29
32
|
MAU_INSTALLATION_DECLINED: (name: string, command: string) => string;
|
package/lib/ui/messages.js
CHANGED
|
@@ -27,7 +27,10 @@ export const MESSAGES = {
|
|
|
27
27
|
LIBRARY_INSTALLATION_STARTS: 'Starting library setup...',
|
|
28
28
|
UPGRADE_IN_PROGRESS: `${EMOJIS.ROCKET} Upgrading your project to NestJS v12...`,
|
|
29
29
|
UPGRADE_GLOBAL_CLI_HINT: 'Only the local @nestjs/cli was updated. To update a globally installed CLI, run: npm i -g @nestjs/cli@latest',
|
|
30
|
-
OBSERVABILITY_QUESTION: 'Would you like to
|
|
30
|
+
OBSERVABILITY_QUESTION: 'Would you like to set up @nestjs/observe (distributed tracing, auto-correlated logs, metrics and alarms - free for 300k events/month, https://observe.nestjs.com)?',
|
|
31
|
+
OBSERVABILITY_NEXT_STEPS: `${EMOJIS.SPARKLES} @nestjs/observe is wired up. Create a free account to get your credentials:`,
|
|
32
|
+
OBSERVABILITY_SIGN_UP_URL: 'https://observe.nestjs.com',
|
|
33
|
+
OBSERVABILITY_KEYS_HINT: 'Then paste the app key and secret into ObserveModule.forRoot() in your AppModule.',
|
|
31
34
|
MAU_INSTALLATION_QUESTION: (name) => `The ${name} package is required to deploy. Would you like to install it now?`,
|
|
32
35
|
MAU_INSTALLATION_IN_PROGRESS: (name) => `Installing ${name}... ${EMOJIS.COFFEE}`,
|
|
33
36
|
MAU_INSTALLATION_DECLINED: (name, command) => `Cannot deploy without ${name}. Install it with:\n\n ${command}\n`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/nestjs__cli",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.5-depup.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli) (with updated dependencies)",
|
|
6
6
|
"engines": {
|
|
@@ -39,11 +39,12 @@
|
|
|
39
39
|
"@angular-devkit/schematics": "22.1.8",
|
|
40
40
|
"@angular-devkit/schematics-cli": "22.1.8",
|
|
41
41
|
"@inquirer/prompts": "8.7.2",
|
|
42
|
-
"@nestjs/schematics": "^12.0.
|
|
42
|
+
"@nestjs/schematics": "^12.0.4",
|
|
43
43
|
"ansis": "4.4.0",
|
|
44
44
|
"chokidar": "5.0.0",
|
|
45
45
|
"cli-table3": "0.6.5",
|
|
46
46
|
"commander": "15.0.0",
|
|
47
|
+
"jsonc-parser": "3.3.1",
|
|
47
48
|
"minimatch": "10.2.6",
|
|
48
49
|
"node-emoji": "2.2.0",
|
|
49
50
|
"ora": "9.4.1",
|
|
@@ -51,12 +52,12 @@
|
|
|
51
52
|
"typescript": "^7.0.2"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@commitlint/cli": "21.2.
|
|
55
|
-
"@commitlint/config-angular": "21.2.
|
|
55
|
+
"@commitlint/cli": "21.2.3",
|
|
56
|
+
"@commitlint/config-angular": "21.2.3",
|
|
56
57
|
"@rspack/core": "^2.0.0",
|
|
57
58
|
"@swc/cli": "0.8.1",
|
|
58
59
|
"@swc/core": "1.16.2",
|
|
59
|
-
"@types/node": "25.9.
|
|
60
|
+
"@types/node": "25.9.8",
|
|
60
61
|
"@types/webpack-node-externals": "3.0.4",
|
|
61
62
|
"delete-empty": "3.0.0",
|
|
62
63
|
"fork-ts-checker-webpack-plugin": "9.1.0",
|
|
@@ -64,14 +65,14 @@
|
|
|
64
65
|
"gulp-clean": "0.4.0",
|
|
65
66
|
"husky": "9.1.7",
|
|
66
67
|
"lint-staged": "17.5.1",
|
|
67
|
-
"oxlint": "1.
|
|
68
|
-
"prettier": "3.9.
|
|
69
|
-
"release-it": "21.0
|
|
68
|
+
"oxlint": "1.85.0",
|
|
69
|
+
"prettier": "3.9.8",
|
|
70
|
+
"release-it": "21.1.0",
|
|
70
71
|
"ts-loader": "9.6.2",
|
|
71
72
|
"tsconfig-paths-webpack-plugin": "4.2.0",
|
|
72
73
|
"vite": "8.3.0",
|
|
73
|
-
"vitest": "5.0.
|
|
74
|
-
"webpack": "5.111.
|
|
74
|
+
"vitest": "5.0.1",
|
|
75
|
+
"webpack": "5.111.1",
|
|
75
76
|
"webpack-node-externals": "3.0.0"
|
|
76
77
|
},
|
|
77
78
|
"lint-staged": {
|
|
@@ -125,7 +126,7 @@
|
|
|
125
126
|
"changes": {
|
|
126
127
|
"@nestjs/schematics": {
|
|
127
128
|
"from": "^12.0.0",
|
|
128
|
-
"to": "^12.0.
|
|
129
|
+
"to": "^12.0.4"
|
|
129
130
|
},
|
|
130
131
|
"typescript": {
|
|
131
132
|
"from": "~6.0.2",
|
|
@@ -134,8 +135,8 @@
|
|
|
134
135
|
},
|
|
135
136
|
"depsUpdated": 2,
|
|
136
137
|
"originalPackage": "@nestjs/cli",
|
|
137
|
-
"originalVersion": "12.0.
|
|
138
|
-
"processedAt": "2026-09-
|
|
138
|
+
"originalVersion": "12.0.5",
|
|
139
|
+
"processedAt": "2026-09-22T16:11:27.400Z",
|
|
139
140
|
"smokeTest": "failed"
|
|
140
141
|
}
|
|
141
142
|
}
|