@simplysm/sd-cli 13.0.69 → 13.0.71
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 +10 -957
- package/dist/builders/BaseBuilder.d.ts +23 -23
- package/dist/builders/BaseBuilder.d.ts.map +1 -1
- package/dist/builders/BaseBuilder.js +15 -15
- package/dist/builders/DtsBuilder.d.ts +4 -4
- package/dist/builders/DtsBuilder.js +1 -1
- package/dist/builders/LibraryBuilder.d.ts +3 -3
- package/dist/builders/types.d.ts +10 -10
- package/dist/capacitor/capacitor.d.ts +36 -36
- package/dist/capacitor/capacitor.js +63 -63
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/add-client.d.ts +8 -8
- package/dist/commands/add-client.js +15 -15
- package/dist/commands/add-client.js.map +1 -1
- package/dist/commands/add-server.d.ts +9 -9
- package/dist/commands/add-server.js +13 -13
- package/dist/commands/add-server.js.map +1 -1
- package/dist/commands/build.d.ts +9 -9
- package/dist/commands/check.js +3 -3
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dev.d.ts +9 -9
- package/dist/commands/device.d.ts +9 -9
- package/dist/commands/device.d.ts.map +1 -1
- package/dist/commands/device.js +17 -17
- package/dist/commands/device.js.map +1 -1
- package/dist/commands/init.d.ts +6 -6
- package/dist/commands/init.js +12 -12
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/lint.d.ts +23 -23
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +25 -25
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/publish.d.ts +13 -13
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +61 -61
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/replace-deps.d.ts +3 -3
- package/dist/commands/replace-deps.d.ts.map +1 -1
- package/dist/commands/replace-deps.js +1 -1
- package/dist/commands/replace-deps.js.map +1 -1
- package/dist/commands/typecheck.d.ts +20 -20
- package/dist/commands/typecheck.d.ts.map +1 -1
- package/dist/commands/typecheck.js +20 -20
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/commands/watch.d.ts +7 -7
- package/dist/electron/electron.d.ts +27 -27
- package/dist/electron/electron.js +32 -32
- package/dist/electron/electron.js.map +1 -1
- package/dist/infra/ResultCollector.d.ts +9 -9
- package/dist/infra/ResultCollector.js +5 -5
- package/dist/infra/SignalHandler.d.ts +7 -7
- package/dist/infra/SignalHandler.js +4 -4
- package/dist/infra/WorkerManager.d.ts +14 -14
- package/dist/infra/WorkerManager.js +11 -11
- package/dist/orchestrators/BuildOrchestrator.d.ts +19 -19
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +26 -26
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevOrchestrator.d.ts +25 -25
- package/dist/orchestrators/DevOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/DevOrchestrator.js +30 -30
- package/dist/orchestrators/DevOrchestrator.js.map +1 -1
- package/dist/orchestrators/WatchOrchestrator.d.ts +13 -13
- package/dist/orchestrators/WatchOrchestrator.js +17 -17
- package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
- package/dist/sd-cli-entry.d.ts +2 -2
- package/dist/sd-cli-entry.js +38 -38
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.d.ts +2 -2
- package/dist/sd-cli.js +1 -1
- package/dist/sd-cli.js.map +1 -1
- package/dist/sd-config.types.d.ts +84 -84
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/utils/build-env.d.ts +1 -1
- package/dist/utils/config-editor.d.ts +5 -5
- package/dist/utils/config-editor.js +2 -2
- package/dist/utils/config-editor.js.map +1 -1
- package/dist/utils/copy-public.d.ts +9 -9
- package/dist/utils/copy-src.d.ts +9 -9
- package/dist/utils/esbuild-config.d.ts +30 -30
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/output-utils.d.ts +6 -6
- package/dist/utils/package-utils.d.ts +6 -6
- package/dist/utils/package-utils.js +1 -1
- package/dist/utils/package-utils.js.map +1 -1
- package/dist/utils/rebuild-manager.js +3 -3
- package/dist/utils/rebuild-manager.js.map +1 -1
- package/dist/utils/replace-deps.d.ts +25 -25
- package/dist/utils/replace-deps.js +3 -3
- package/dist/utils/replace-deps.js.map +1 -1
- package/dist/utils/sd-config.d.ts +3 -3
- package/dist/utils/sd-config.js +3 -3
- package/dist/utils/sd-config.js.map +1 -1
- package/dist/utils/tailwind-config-deps.d.ts +3 -3
- package/dist/utils/template.d.ts +8 -8
- package/dist/utils/tsconfig.d.ts +16 -16
- package/dist/utils/tsconfig.js +2 -2
- package/dist/utils/tsconfig.js.map +1 -1
- package/dist/utils/typecheck-serialization.d.ts +8 -8
- package/dist/utils/vite-config.d.ts +8 -8
- package/dist/utils/vite-config.d.ts.map +1 -1
- package/dist/utils/vite-config.js +3 -3
- package/dist/utils/worker-events.d.ts +12 -12
- package/dist/utils/worker-events.d.ts.map +1 -1
- package/dist/utils/worker-utils.d.ts +3 -3
- package/dist/utils/worker-utils.js +2 -2
- package/dist/utils/worker-utils.js.map +1 -1
- package/dist/workers/client.worker.d.ts +14 -14
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +1 -1
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/dts.worker.d.ts +13 -13
- package/dist/workers/dts.worker.d.ts.map +1 -1
- package/dist/workers/dts.worker.js +3 -3
- package/dist/workers/dts.worker.js.map +1 -1
- package/dist/workers/library.worker.d.ts +12 -12
- package/dist/workers/library.worker.js +1 -1
- package/dist/workers/library.worker.js.map +1 -1
- package/dist/workers/lint.worker.d.ts +1 -1
- package/dist/workers/server-runtime.worker.d.ts +6 -6
- package/dist/workers/server-runtime.worker.js +6 -6
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/dist/workers/server.worker.d.ts +20 -20
- package/dist/workers/server.worker.d.ts.map +1 -1
- package/dist/workers/server.worker.js +6 -6
- package/dist/workers/server.worker.js.map +1 -1
- package/package.json +8 -7
- package/src/builders/BaseBuilder.ts +33 -33
- package/src/builders/DtsBuilder.ts +5 -5
- package/src/builders/LibraryBuilder.ts +9 -9
- package/src/builders/types.ts +10 -10
- package/src/capacitor/capacitor.ts +119 -119
- package/src/commands/add-client.ts +31 -31
- package/src/commands/add-server.ts +34 -34
- package/src/commands/build.ts +9 -9
- package/src/commands/check.ts +5 -5
- package/src/commands/dev.ts +9 -9
- package/src/commands/device.ts +30 -30
- package/src/commands/init.ts +25 -25
- package/src/commands/lint.ts +64 -64
- package/src/commands/publish.ts +139 -139
- package/src/commands/replace-deps.ts +4 -4
- package/src/commands/typecheck.ts +74 -74
- package/src/commands/watch.ts +7 -7
- package/src/electron/electron.ts +51 -51
- package/src/infra/ResultCollector.ts +9 -9
- package/src/infra/SignalHandler.ts +7 -7
- package/src/infra/WorkerManager.ts +14 -14
- package/src/orchestrators/BuildOrchestrator.ts +76 -76
- package/src/orchestrators/DevOrchestrator.ts +88 -88
- package/src/orchestrators/WatchOrchestrator.ts +39 -39
- package/src/sd-cli-entry.ts +43 -43
- package/src/sd-cli.ts +15 -15
- package/src/sd-config.types.ts +85 -85
- package/src/utils/build-env.ts +1 -1
- package/src/utils/config-editor.ts +19 -19
- package/src/utils/copy-public.ts +17 -17
- package/src/utils/copy-src.ts +11 -11
- package/src/utils/esbuild-config.ts +33 -33
- package/src/utils/output-utils.ts +11 -11
- package/src/utils/package-utils.ts +12 -12
- package/src/utils/rebuild-manager.ts +3 -3
- package/src/utils/replace-deps.ts +361 -361
- package/src/utils/sd-config.ts +44 -44
- package/src/utils/tailwind-config-deps.ts +98 -98
- package/src/utils/template.ts +56 -56
- package/src/utils/tsconfig.ts +127 -127
- package/src/utils/typecheck-serialization.ts +86 -86
- package/src/utils/vite-config.ts +341 -341
- package/src/utils/worker-events.ts +16 -16
- package/src/utils/worker-utils.ts +45 -45
- package/src/workers/client.worker.ts +34 -34
- package/src/workers/dts.worker.ts +467 -467
- package/src/workers/library.worker.ts +314 -314
- package/src/workers/lint.worker.ts +16 -16
- package/src/workers/server-runtime.worker.ts +157 -157
- package/src/workers/server.worker.ts +572 -572
- package/templates/add-client/__CLIENT__/package.json.hbs +1 -1
- package/templates/add-server/__SERVER__/package.json.hbs +2 -2
- package/templates/init/package.json.hbs +3 -3
- package/tests/config-editor.spec.ts +160 -0
- package/tests/copy-src.spec.ts +50 -0
- package/tests/get-compiler-options-for-package.spec.ts +139 -0
- package/tests/get-package-source-files.spec.ts +181 -0
- package/tests/get-types-from-package-json.spec.ts +107 -0
- package/tests/infra/ResultCollector.spec.ts +39 -0
- package/tests/infra/SignalHandler.spec.ts +38 -0
- package/tests/infra/WorkerManager.spec.ts +97 -0
- package/tests/load-ignore-patterns.spec.ts +188 -0
- package/tests/load-sd-config.spec.ts +137 -0
- package/tests/package-utils.spec.ts +188 -0
- package/tests/parse-root-tsconfig.spec.ts +89 -0
- package/tests/replace-deps.spec.ts +308 -0
- package/tests/run-lint.spec.ts +415 -0
- package/tests/run-typecheck.spec.ts +653 -0
- package/tests/run-watch.spec.ts +75 -0
- package/tests/sd-cli.spec.ts +330 -0
- package/tests/tailwind-config-deps.spec.ts +30 -0
- package/tests/template.spec.ts +70 -0
- package/tests/utils/rebuild-manager.spec.ts +43 -0
- package/tests/write-changed-output-files.spec.ts +97 -0
|
@@ -7,11 +7,11 @@ import { solidPlugin } from "esbuild-plugin-solid";
|
|
|
7
7
|
import type { TypecheckEnv } from "./tsconfig";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Write only changed files from esbuild outputFiles to disk
|
|
11
11
|
*
|
|
12
|
-
* - .js
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
12
|
+
* - .js files: Add .js extension to ESM relative import paths before comparing
|
|
13
|
+
* - Other files (.js.map etc): Compare original content as-is
|
|
14
|
+
* - Skip writing if content matches existing file to preserve timestamps
|
|
15
15
|
*/
|
|
16
16
|
export async function writeChangedOutputFiles(outputFiles: esbuild.OutputFile[]): Promise<boolean> {
|
|
17
17
|
let hasChanges = false;
|
|
@@ -43,9 +43,9 @@ export async function writeChangedOutputFiles(outputFiles: esbuild.OutputFile[])
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* - bundle: false (
|
|
48
|
-
* - platform:
|
|
46
|
+
* esbuild options for Library build
|
|
47
|
+
* - bundle: false (transpile individual files)
|
|
48
|
+
* - platform: node or browser depending on target
|
|
49
49
|
*/
|
|
50
50
|
export interface LibraryEsbuildOptions {
|
|
51
51
|
pkgDir: string;
|
|
@@ -55,20 +55,20 @@ export interface LibraryEsbuildOptions {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
* - bundle: true (
|
|
58
|
+
* esbuild options for Server build
|
|
59
|
+
* - bundle: true (single bundle with all dependencies)
|
|
60
60
|
*/
|
|
61
61
|
export interface ServerEsbuildOptions {
|
|
62
62
|
pkgDir: string;
|
|
63
63
|
entryPoints: string[];
|
|
64
64
|
compilerOptions: Record<string, unknown>;
|
|
65
65
|
env?: Record<string, string>;
|
|
66
|
-
/**
|
|
66
|
+
/** External modules to exclude from bundle */
|
|
67
67
|
external?: string[];
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Detect solid-js dependency in package.json
|
|
72
72
|
*/
|
|
73
73
|
function hasSolidDependency(pkgDir: string): boolean {
|
|
74
74
|
const pkgJson = JSON.parse(readFileSync(path.join(pkgDir, "package.json"), "utf-8")) as PkgJson;
|
|
@@ -77,12 +77,12 @@ function hasSolidDependency(pkgDir: string): boolean {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* Create esbuild config for Library build
|
|
81
81
|
*
|
|
82
|
-
* node/browser/neutral
|
|
83
|
-
* - bundle: false (
|
|
84
|
-
* - platform: target
|
|
85
|
-
* - target: node
|
|
82
|
+
* Used to build library packages with node/browser/neutral targets
|
|
83
|
+
* - bundle: false (transpile each file individually)
|
|
84
|
+
* - platform: node if target is node, otherwise browser
|
|
85
|
+
* - target: node20 if target is node, otherwise chrome84
|
|
86
86
|
*/
|
|
87
87
|
export function createLibraryEsbuildOptions(options: LibraryEsbuildOptions): esbuild.BuildOptions {
|
|
88
88
|
const plugins: esbuild.Plugin[] = [];
|
|
@@ -110,13 +110,13 @@ export function createLibraryEsbuildOptions(options: LibraryEsbuildOptions): esb
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* Create esbuild config for Server build
|
|
114
114
|
*
|
|
115
|
-
*
|
|
116
|
-
* - bundle: true (
|
|
117
|
-
* - minify: true (
|
|
118
|
-
* - banner: CJS
|
|
119
|
-
* - env
|
|
115
|
+
* Used for server package builds
|
|
116
|
+
* - bundle: true (single bundle with all dependencies)
|
|
117
|
+
* - minify: true (minify for code protection)
|
|
118
|
+
* - banner: createRequire shim for CJS package require() support
|
|
119
|
+
* - Replace env with define option (process.env.KEY format)
|
|
120
120
|
*/
|
|
121
121
|
export function createServerEsbuildOptions(options: ServerEsbuildOptions): esbuild.BuildOptions {
|
|
122
122
|
const define: Record<string, string> = {};
|
|
@@ -147,10 +147,10 @@ export function createServerEsbuildOptions(options: ServerEsbuildOptions): esbui
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
*
|
|
150
|
+
* Extract TypecheckEnv from build target
|
|
151
151
|
*
|
|
152
|
-
*
|
|
153
|
-
* (neutral
|
|
152
|
+
* Neutral is treated as browser for builds.
|
|
153
|
+
* (neutral packages are Node/browser universal, but we treat as browser for build)
|
|
154
154
|
*/
|
|
155
155
|
export function getTypecheckEnvFromTarget(target: "node" | "browser" | "neutral"): TypecheckEnv {
|
|
156
156
|
return target === "node" ? "node" : "browser";
|
|
@@ -165,10 +165,10 @@ interface PkgJson {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* Collect uninstalled optional peer deps from dependency tree
|
|
169
169
|
*
|
|
170
|
-
*
|
|
171
|
-
* esbuild
|
|
170
|
+
* For server builds (bundle: true), specify uninstalled optional peer dependencies
|
|
171
|
+
* as esbuild externals to prevent build failures
|
|
172
172
|
*/
|
|
173
173
|
export function collectUninstalledOptionalPeerDeps(pkgDir: string): string[] {
|
|
174
174
|
const external = new Set<string>();
|
|
@@ -227,10 +227,10 @@ function scanOptionalPeerDeps(
|
|
|
227
227
|
//#region Native Module Externals
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
|
-
*
|
|
230
|
+
* Collect native modules with binding.gyp from dependencies
|
|
231
231
|
*
|
|
232
|
-
* node-gyp
|
|
233
|
-
*
|
|
232
|
+
* Native modules built with node-gyp cannot be bundled by esbuild,
|
|
233
|
+
* so they must be specified as externals.
|
|
234
234
|
*/
|
|
235
235
|
export function collectNativeModuleExternals(pkgDir: string): string[] {
|
|
236
236
|
const external = new Set<string>();
|
|
@@ -264,12 +264,12 @@ function scanNativeModules(
|
|
|
264
264
|
|
|
265
265
|
const depDir = path.dirname(pkgJsonPath);
|
|
266
266
|
|
|
267
|
-
//
|
|
267
|
+
// Detect native modules by checking for binding.gyp
|
|
268
268
|
if (existsSync(path.join(depDir, "binding.gyp"))) {
|
|
269
269
|
external.add(pkgName);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
//
|
|
272
|
+
// Recursively traverse sub-dependencies
|
|
273
273
|
const depPkgJson = JSON.parse(readFileSync(pkgJsonPath, "utf-8")) as PkgJson;
|
|
274
274
|
for (const dep of Object.keys(depPkgJson.dependencies ?? {})) {
|
|
275
275
|
scanNativeModules(dep, depDir, external, visited);
|
|
@@ -2,7 +2,7 @@ import { consola } from "consola";
|
|
|
2
2
|
import type { BuildResult } from "../infra/ResultCollector";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Format build warning/error messages
|
|
6
6
|
*/
|
|
7
7
|
export function formatBuildMessages(name: string, label: string, messages: string[]): string {
|
|
8
8
|
const lines: string[] = [`${name} (${label})`];
|
|
@@ -15,8 +15,8 @@ export function formatBuildMessages(name: string, label: string, messages: strin
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param results
|
|
18
|
+
* Print only errors
|
|
19
|
+
* @param results Build result status per package
|
|
20
20
|
*/
|
|
21
21
|
export function printErrors(results: Map<string, BuildResult>): void {
|
|
22
22
|
for (const result of results.values()) {
|
|
@@ -32,34 +32,34 @@ export function printErrors(results: Map<string, BuildResult>): void {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param results
|
|
37
|
-
* @param serverClientsMap
|
|
35
|
+
* Print server URLs only
|
|
36
|
+
* @param results Build result status per package
|
|
37
|
+
* @param serverClientsMap List of connected clients per server
|
|
38
38
|
*/
|
|
39
39
|
export function printServers(
|
|
40
40
|
results: Map<string, BuildResult>,
|
|
41
41
|
serverClientsMap?: Map<string, string[]>,
|
|
42
42
|
): void {
|
|
43
|
-
//
|
|
43
|
+
// Collect server info
|
|
44
44
|
const servers = [...results.values()].filter((r) => r.status === "running" && r.port != null);
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// Print server info (add blank line before if present)
|
|
47
47
|
if (servers.length > 0) {
|
|
48
48
|
process.stdout.write("\n");
|
|
49
49
|
for (const server of servers) {
|
|
50
50
|
if (server.target === "server") {
|
|
51
|
-
//
|
|
51
|
+
// If server has connected clients, print only client URLs
|
|
52
52
|
const clients = serverClientsMap?.get(server.name) ?? [];
|
|
53
53
|
if (clients.length > 0) {
|
|
54
54
|
for (const clientName of clients) {
|
|
55
55
|
consola.info(`[server] http://localhost:${server.port}/${clientName}/`);
|
|
56
56
|
}
|
|
57
57
|
} else {
|
|
58
|
-
//
|
|
58
|
+
// If no connected clients, print server root URL
|
|
59
59
|
consola.info(`[server] http://localhost:${server.port}/`);
|
|
60
60
|
}
|
|
61
61
|
} else {
|
|
62
|
-
//
|
|
62
|
+
// Standalone client: print with name included
|
|
63
63
|
consola.info(`[server] http://localhost:${server.port}/${server.name}/`);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -3,13 +3,13 @@ import fs from "fs";
|
|
|
3
3
|
import type { SdPackageConfig } from "../sd-config.types";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* import.meta.dirname
|
|
6
|
+
* Walk up from import.meta.dirname to find package.json and return package root
|
|
7
7
|
*/
|
|
8
8
|
export function findPackageRoot(startDir: string): string {
|
|
9
9
|
let dir = startDir;
|
|
10
10
|
while (!fs.existsSync(path.join(dir, "package.json"))) {
|
|
11
11
|
const parent = path.dirname(dir);
|
|
12
|
-
if (parent === dir) throw new Error("package.json
|
|
12
|
+
if (parent === dir) throw new Error("package.json not found");
|
|
13
13
|
dir = parent;
|
|
14
14
|
}
|
|
15
15
|
return dir;
|
|
@@ -55,7 +55,7 @@ export function collectDeps(
|
|
|
55
55
|
if (visited.has(dep)) continue;
|
|
56
56
|
visited.add(dep);
|
|
57
57
|
|
|
58
|
-
// workspace package
|
|
58
|
+
// Check for workspace package
|
|
59
59
|
if (workspaceScope != null && dep.startsWith(workspaceScope + "/")) {
|
|
60
60
|
const dirName = dep.slice(workspaceScope.length + 1);
|
|
61
61
|
const depDir = path.join(cwd, "packages", dirName);
|
|
@@ -66,7 +66,7 @@ export function collectDeps(
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
// replaceDeps pattern
|
|
69
|
+
// Check replaceDeps pattern
|
|
70
70
|
const matched = replaceDepsPatterns.find((p) => p.regex.test(dep));
|
|
71
71
|
if (matched != null) {
|
|
72
72
|
replaceDeps.push(dep);
|
|
@@ -84,11 +84,11 @@ export function collectDeps(
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @param packages
|
|
89
|
-
* @param targets
|
|
90
|
-
* @returns
|
|
91
|
-
* @internal
|
|
87
|
+
* Filter packages config by targets (excluding scripts target)
|
|
88
|
+
* @param packages Package config map
|
|
89
|
+
* @param targets List of package names to filter. If empty array, return all packages except scripts
|
|
90
|
+
* @returns Filtered package config map
|
|
91
|
+
* @internal exported for testing
|
|
92
92
|
*/
|
|
93
93
|
export function filterPackagesByTargets(
|
|
94
94
|
packages: Record<string, SdPackageConfig | undefined>,
|
|
@@ -99,16 +99,16 @@ export function filterPackagesByTargets(
|
|
|
99
99
|
for (const [name, config] of Object.entries(packages)) {
|
|
100
100
|
if (config == null) continue;
|
|
101
101
|
|
|
102
|
-
// scripts
|
|
102
|
+
// Exclude scripts target from watch/dev targets
|
|
103
103
|
if (config.target === "scripts") continue;
|
|
104
104
|
|
|
105
|
-
// targets
|
|
105
|
+
// If targets is empty, include all packages
|
|
106
106
|
if (targets.length === 0) {
|
|
107
107
|
result[name] = config;
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
//
|
|
111
|
+
// Filter only packages included in targets
|
|
112
112
|
if (targets.includes(name)) {
|
|
113
113
|
result[name] = config;
|
|
114
114
|
}
|
|
@@ -45,18 +45,18 @@ export class RebuildManager extends EventEmitter<RebuildManagerEvents> {
|
|
|
45
45
|
|
|
46
46
|
const tasks = Array.from(batchBuilds.entries());
|
|
47
47
|
const titles = tasks.map(([, { title }]) => title).join(", ");
|
|
48
|
-
this._logger.start(
|
|
48
|
+
this._logger.start(`Rebuilding... (${titles})`);
|
|
49
49
|
|
|
50
50
|
const results = await Promise.allSettled(tasks.map(([, { promise }]) => promise));
|
|
51
51
|
|
|
52
52
|
const failed = results.filter((r): r is PromiseRejectedResult => r.status === "rejected");
|
|
53
53
|
if (failed.length > 0) {
|
|
54
54
|
for (const result of failed) {
|
|
55
|
-
this._logger.error("
|
|
55
|
+
this._logger.error("Error during rebuild", { error: String(result.reason) });
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
this._logger.success(
|
|
59
|
+
this._logger.success(`Rebuild completed (${titles})`);
|
|
60
60
|
|
|
61
61
|
this.emit("batchComplete");
|
|
62
62
|
|