@smoothbricks/nx-plugin 0.4.17 → 0.4.18
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 +12 -11
- package/dist/ensure-built.d.ts +7 -4
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +77 -17
- package/dist/executors/typescript-emit/executor.d.ts +1 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +3 -8
- package/dist/index.js +10 -8
- package/dist/managed-files/files.d.ts +6 -0
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +11 -0
- package/executors.json +1 -1
- package/managed/raw/patches/ttsc@0.30.4.patch +2255 -0
- package/managed/raw/tooling/direnv/devenv.smoo.nix +14 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +3 -4
- package/package.json +5 -5
- package/src/ensure-built.test.ts +41 -5
- package/src/ensure-built.ts +127 -43
- package/src/executors/typescript-emit/executor.test.ts +64 -115
- package/src/executors/typescript-emit/executor.ts +4 -9
- package/src/executors/typescript-emit/schema.json +1 -1
- package/src/index.test.ts +4 -4
- package/src/index.ts +9 -8
- package/src/managed-files/files.ts +12 -0
package/README.md
CHANGED
|
@@ -270,6 +270,10 @@ through the inferred `typecheck-tests` target, not through `tsc --build`.
|
|
|
270
270
|
hashes. A full hit returns without running tasks or printing output. A miss runs the task graph through Nx's in-process
|
|
271
271
|
runner with streaming output; only a workspace with the daemon disabled falls back to its checkout-local `nx` CLI.
|
|
272
272
|
|
|
273
|
+
Before hashing, it compares a native snapshot of the workspace with the daemon's file table. A write the daemon's
|
|
274
|
+
watcher has not delivered yet counts as a miss unless every changed path is a declared output of a task in the graph, so
|
|
275
|
+
a build's own artifacts never turn the next call noisy, and an edit made moments before the call never hits stale.
|
|
276
|
+
|
|
273
277
|
```typescript
|
|
274
278
|
import { ensureBuilt } from '@smoothbricks/nx-plugin/ensure-built';
|
|
275
279
|
|
|
@@ -342,17 +346,14 @@ The generator rewrites `package.json` so `nx.targets.test` uses:
|
|
|
342
346
|
|
|
343
347
|
## Managed workspace files
|
|
344
348
|
|
|
345
|
-
`nx generate @smoothbricks/nx-plugin:managed-files` stages the same managed files as
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
for `nx sync` and `nx sync:check`.
|
|
349
|
+
`nx generate @smoothbricks/nx-plugin:managed-files` stages the same managed files as `smoo monorepo update`, without
|
|
350
|
+
installing packages or resolving secrets. Use Nx `--dry-run` to inspect the changes. The workspace defaults register
|
|
351
|
+
this generator for `nx sync` and `nx sync:check`.
|
|
349
352
|
|
|
350
|
-
The plugin owns the packaged templates, pure rendering and content-preservation
|
|
351
|
-
|
|
352
|
-
resolved project graph for inferred targets. The CLI only supplies the filesystem
|
|
353
|
+
The plugin owns the packaged templates, pure rendering and content-preservation functions. The generator reads workspace
|
|
354
|
+
files through Nx `Tree` and uses Nx's resolved project graph for inferred targets. The CLI only supplies the filesystem
|
|
353
355
|
and process boundary. There is no separate serialized change plan.
|
|
354
356
|
|
|
355
|
-
Files with a `# smoo-local` tail or `# smoo-local-begin` / `# smoo-local-end` blocks
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
generator does not remove a repository-owned file when a capability is disabled.
|
|
357
|
+
Files with a `# smoo-local` tail or `# smoo-local-begin` / `# smoo-local-end` blocks retain those sections. Matching
|
|
358
|
+
source symlinks are preserved; conflicting local blocks and broken or external links are reported instead of
|
|
359
|
+
overwritten. The generator does not remove a repository-owned file when a capability is disabled.
|
package/dist/ensure-built.d.ts
CHANGED
|
@@ -34,6 +34,9 @@ export type MissReason = {
|
|
|
34
34
|
} | {
|
|
35
35
|
readonly kind: 'stale-outputs';
|
|
36
36
|
readonly taskId: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'stale-inputs';
|
|
39
|
+
readonly taskId: string;
|
|
37
40
|
} | {
|
|
38
41
|
readonly kind: 'cache-disabled';
|
|
39
42
|
readonly taskId: string;
|
|
@@ -108,10 +111,10 @@ export declare function firstStaleOutputs(tasks: readonly Task[], matches: reado
|
|
|
108
111
|
* when they already are.
|
|
109
112
|
*
|
|
110
113
|
* "Already built" is the hot path, because a checkout-local CLI wrapper pays it
|
|
111
|
-
* on every invocation. So it never spawns the `nx` CLI:
|
|
112
|
-
* task hashes and
|
|
113
|
-
*
|
|
114
|
-
*
|
|
114
|
+
* on every invocation. So it never spawns the `nx` CLI: a native filesystem
|
|
115
|
+
* snapshot refreshes the daemon's inputs, the task hashes and on-disk output
|
|
116
|
+
* verification are daemon round-trips, and the cache lookup is a local SQLite
|
|
117
|
+
* read. Nx's task runner is only invoked once something needs running.
|
|
115
118
|
*
|
|
116
119
|
* With the daemon disabled there is no probe to make — hashing would have to
|
|
117
120
|
* build the project graph in this process, and no service holds the recorded
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-built.d.ts","sourceRoot":"","sources":["../src/ensure-built.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensure-built.d.ts","sourceRoot":"","sources":["../src/ensure-built.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,EAAa,MAAM,0BAA0B,CAAC;AAmDhE;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;I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CAAC;CAC5B;AAOD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAWvE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAmBvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5C,UAAU,GAAG,IAAI,CAmBnB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,OAAO,EAAE,GAAG,UAAU,GAAG,IAAI,CAOxG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmCzF;AA6XD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,KAAK,MAAM,GACtD,iBAAiB,CAQnB"}
|
package/dist/ensure-built.js
CHANGED
|
@@ -36,6 +36,8 @@ export function describeMiss(reason) {
|
|
|
36
36
|
return `${reason.taskId} last failed with exit code ${reason.code}`;
|
|
37
37
|
case 'stale-outputs':
|
|
38
38
|
return `${reason.taskId} outputs are missing or modified on disk`;
|
|
39
|
+
case 'stale-inputs':
|
|
40
|
+
return `${reason.taskId} inputs changed since the Nx daemon last looked`;
|
|
39
41
|
case 'cache-disabled':
|
|
40
42
|
return `the Nx cache is disabled, so ${reason.taskId} must run`;
|
|
41
43
|
case 'no-daemon':
|
|
@@ -91,10 +93,10 @@ export function firstStaleOutputs(tasks, matches) {
|
|
|
91
93
|
* when they already are.
|
|
92
94
|
*
|
|
93
95
|
* "Already built" is the hot path, because a checkout-local CLI wrapper pays it
|
|
94
|
-
* on every invocation. So it never spawns the `nx` CLI:
|
|
95
|
-
* task hashes and
|
|
96
|
-
*
|
|
97
|
-
*
|
|
96
|
+
* on every invocation. So it never spawns the `nx` CLI: a native filesystem
|
|
97
|
+
* snapshot refreshes the daemon's inputs, the task hashes and on-disk output
|
|
98
|
+
* verification are daemon round-trips, and the cache lookup is a local SQLite
|
|
99
|
+
* read. Nx's task runner is only invoked once something needs running.
|
|
98
100
|
*
|
|
99
101
|
* With the daemon disabled there is no probe to make — hashing would have to
|
|
100
102
|
* build the project graph in this process, and no service holds the recorded
|
|
@@ -167,6 +169,7 @@ async function ensureBuiltInWorkspace(workspaceRoot, selector, onMiss) {
|
|
|
167
169
|
const { readNxJson } = requireNx('nx/src/config/nx-json');
|
|
168
170
|
const { splitArgsIntoNxArgsAndOverrides } = requireNx('nx/src/utils/command-line-utils');
|
|
169
171
|
const { setEnvVarsBasedOnArgs } = requireNx('nx/src/tasks-runner/run-command');
|
|
172
|
+
const { createTaskGraph } = requireNx('nx/src/tasks-runner/create-task-graph');
|
|
170
173
|
const hooks = requireNx('nx/src/project-graph/plugins/tasks-execution-hooks');
|
|
171
174
|
const nxJson = readNxJson();
|
|
172
175
|
// Reproduce `nx run <selector> --outputStyle=<style>` exactly. Task hashes
|
|
@@ -179,6 +182,13 @@ async function ensureBuiltInWorkspace(workspaceRoot, selector, onMiss) {
|
|
|
179
182
|
// reads through each task's environment. It has to happen before hashing or
|
|
180
183
|
// the probe keys differently from the CLI.
|
|
181
184
|
setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles);
|
|
185
|
+
performance.mark('ensureBuilt:graph:start');
|
|
186
|
+
const { projectGraph } = await daemonClient.getProjectGraphAndSourceMaps();
|
|
187
|
+
requireProject(projectGraph, selector.project);
|
|
188
|
+
const taskGraph = createTaskGraph(projectGraph, {}, [selector.project], [selector.target], selector.configuration, overrides, false);
|
|
189
|
+
const tasks = Object.values(taskGraph.tasks);
|
|
190
|
+
performance.measure('ensureBuilt:graph', 'ensureBuilt:graph:start');
|
|
191
|
+
const inputsChanged = await refreshWorkspaceContext(workspaceRoot, tasks, requireNx);
|
|
182
192
|
const runId = randomUUID();
|
|
183
193
|
const startTime = Date.now();
|
|
184
194
|
// Plugin `preTasksExecution` hooks inject environment variables, and declared
|
|
@@ -193,14 +203,17 @@ async function ensureBuiltInWorkspace(workspaceRoot, selector, onMiss) {
|
|
|
193
203
|
});
|
|
194
204
|
performance.mark('ensureBuilt:probe:start');
|
|
195
205
|
let reason;
|
|
206
|
+
const selectorTaskId = selector.configuration === undefined
|
|
207
|
+
? `${selector.project}:${selector.target}`
|
|
208
|
+
: `${selector.project}:${selector.target}:${selector.configuration}`;
|
|
196
209
|
if (process.env.NX_SKIP_NX_CACHE === 'true' || process.env.NX_DISABLE_NX_CACHE === 'true') {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
reason = { kind: '
|
|
210
|
+
reason = { kind: 'cache-disabled', taskId: selectorTaskId };
|
|
211
|
+
}
|
|
212
|
+
else if (inputsChanged) {
|
|
213
|
+
reason = { kind: 'stale-inputs', taskId: selectorTaskId };
|
|
201
214
|
}
|
|
202
215
|
else {
|
|
203
|
-
reason = await probe(nxJson, nxArgs,
|
|
216
|
+
reason = await probe(nxJson, nxArgs, projectGraph, taskGraph, tasks, requireNx);
|
|
204
217
|
}
|
|
205
218
|
performance.measure('ensureBuilt:probe', 'ensureBuilt:probe:start');
|
|
206
219
|
const outcome = reason === null
|
|
@@ -241,21 +254,68 @@ function bindWorkspaceRoot(workspaceRoot, requireNx) {
|
|
|
241
254
|
throw new Error(`ensureBuilt: Nx is already bound to workspace root ${boundRoot}, cannot switch to ${workspaceRoot}`);
|
|
242
255
|
}
|
|
243
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* The daemon drains delivered watcher events before serving its graph, but an
|
|
259
|
+
* OS event can still be in flight after a write has completed. Its graph and
|
|
260
|
+
* hashes can then agree with each other while both describe yesterday's files.
|
|
261
|
+
* Take Nx's native, ignore-aware disk snapshot and compare it with the
|
|
262
|
+
* daemon's file table; its metadata cache reuses unchanged file hashes.
|
|
263
|
+
*
|
|
264
|
+
* Any difference is handed to the daemon so its next graph is current, but
|
|
265
|
+
* that only schedules a recomputation, and a probe meanwhile would hash
|
|
266
|
+
* against the file map it already has. So the caller does not probe: if any
|
|
267
|
+
* differing path is not a declared output of a task in the graph, this
|
|
268
|
+
* returns true and the target is run, which lets Nx's own runner wait for the
|
|
269
|
+
* recomputation. Output paths are exempt because a build's own writes are the
|
|
270
|
+
* commonest thing to reach here before the watcher does, and treating them as
|
|
271
|
+
* a miss would make every hit after a build replay the cached log.
|
|
272
|
+
*/
|
|
273
|
+
async function refreshWorkspaceContext(workspaceRoot, tasks, requireNx) {
|
|
274
|
+
const { daemonClient } = requireNx('nx/src/daemon/client/client');
|
|
275
|
+
const { WorkspaceContext, matchOutputPaths } = requireNx('nx/src/native');
|
|
276
|
+
const { workspaceDataDirectoryForWorkspace } = requireNx('nx/src/utils/cache-directory');
|
|
277
|
+
performance.mark('ensureBuilt:inputs:start');
|
|
278
|
+
const previousFiles = await daemonClient.getWorkspaceContextFileData();
|
|
279
|
+
const previousHashes = new Map();
|
|
280
|
+
for (const { file, hash } of previousFiles) {
|
|
281
|
+
previousHashes.set(file, hash);
|
|
282
|
+
}
|
|
283
|
+
// A context is a snapshot, not a watcher. Do not reuse one across calls.
|
|
284
|
+
const context = new WorkspaceContext(workspaceRoot, workspaceDataDirectoryForWorkspace(workspaceRoot));
|
|
285
|
+
const createdFiles = [];
|
|
286
|
+
const updatedFiles = [];
|
|
287
|
+
for (const { file, hash } of context.allFileData()) {
|
|
288
|
+
const previousHash = previousHashes.get(file);
|
|
289
|
+
if (previousHash === undefined) {
|
|
290
|
+
createdFiles.push(file);
|
|
291
|
+
}
|
|
292
|
+
else if (previousHash !== hash) {
|
|
293
|
+
updatedFiles.push(file);
|
|
294
|
+
}
|
|
295
|
+
previousHashes.delete(file);
|
|
296
|
+
}
|
|
297
|
+
const deletedFiles = [...previousHashes.keys()];
|
|
298
|
+
const changed = [...createdFiles, ...updatedFiles, ...deletedFiles];
|
|
299
|
+
let inputsChanged = false;
|
|
300
|
+
if (changed.length > 0) {
|
|
301
|
+
await daemonClient.updateWorkspaceContext(createdFiles, updatedFiles, deletedFiles);
|
|
302
|
+
// The same matcher the task runner uses to collect outputs, over the union
|
|
303
|
+
// of every task's declared outputs. A negation declared by one task then
|
|
304
|
+
// also excludes another task's output, which errs toward a miss.
|
|
305
|
+
const outputs = tasks.flatMap((task) => task.outputs);
|
|
306
|
+
inputsChanged = matchOutputPaths(outputs, changed).includes(false);
|
|
307
|
+
}
|
|
308
|
+
performance.measure('ensureBuilt:inputs', 'ensureBuilt:inputs:start');
|
|
309
|
+
return inputsChanged;
|
|
310
|
+
}
|
|
244
311
|
/** `null` when the target is already built; otherwise the first reason it is not. */
|
|
245
|
-
async function probe(nxJson, nxArgs,
|
|
312
|
+
async function probe(nxJson, nxArgs, projectGraph, taskGraph, tasks, requireNx) {
|
|
246
313
|
const { daemonClient } = requireNx('nx/src/daemon/client/client');
|
|
247
|
-
const { createTaskGraph } = requireNx('nx/src/tasks-runner/create-task-graph');
|
|
248
314
|
const { DaemonBasedTaskHasher } = requireNx('nx/src/hasher/task-hasher');
|
|
249
315
|
const { getTaskDetails, hashTasks } = requireNx('nx/src/hasher/hash-task');
|
|
250
316
|
const { getTaskSpecificEnv } = requireNx('nx/src/tasks-runner/task-env');
|
|
251
317
|
const { getCache } = requireNx('nx/src/tasks-runner/cache');
|
|
252
318
|
const { getRunnerOptions } = requireNx('nx/src/tasks-runner/run-command');
|
|
253
|
-
performance.mark('ensureBuilt:graph:start');
|
|
254
|
-
const { projectGraph } = await daemonClient.getProjectGraphAndSourceMaps();
|
|
255
|
-
requireProject(projectGraph, selector.project);
|
|
256
|
-
const taskGraph = createTaskGraph(projectGraph, {}, [selector.project], [selector.target], selector.configuration, overrides, false);
|
|
257
|
-
const tasks = Object.values(taskGraph.tasks);
|
|
258
|
-
performance.measure('ensureBuilt:graph', 'ensureBuilt:graph:start');
|
|
259
319
|
// `isCloudDefault: false` because these options are only read here by the
|
|
260
320
|
// hasher, which looks at `selectivelyHashTsConfig`; the cloud credentials the
|
|
261
321
|
// flag would add belong to the cloud runner, and the run path calls Nx's own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/typescript-emit/executor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/typescript-emit/executor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAElF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAE/B;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAkC/B"}
|
|
@@ -16,8 +16,8 @@ export async function runTypeScriptEmit(options, context, runner) {
|
|
|
16
16
|
extends: `./${basename(tsConfigPath)}`,
|
|
17
17
|
compilerOptions: {
|
|
18
18
|
composite: false,
|
|
19
|
-
declaration:
|
|
20
|
-
declarationMap:
|
|
19
|
+
declaration: true,
|
|
20
|
+
declarationMap: true,
|
|
21
21
|
emitDeclarationOnly: false,
|
|
22
22
|
incremental: false,
|
|
23
23
|
},
|
|
@@ -34,12 +34,7 @@ export async function runTypeScriptEmit(options, context, runner) {
|
|
|
34
34
|
return { success: false };
|
|
35
35
|
}
|
|
36
36
|
await makePackageBinsExecutable(cwd, options.executableOutputs ?? []);
|
|
37
|
-
|
|
38
|
-
command: 'tsc',
|
|
39
|
-
args: ['-p', overlayPath, '--emitDeclarationOnly', '--declaration', '--declarationMap'],
|
|
40
|
-
cwd,
|
|
41
|
-
});
|
|
42
|
-
return { success: declarationsSucceeded };
|
|
37
|
+
return { success: true };
|
|
43
38
|
}
|
|
44
39
|
finally {
|
|
45
40
|
await rm(overlayPath, { force: true });
|
package/dist/index.js
CHANGED
|
@@ -835,10 +835,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
835
835
|
// Build every JavaScript output lane before resolving package exports, without pulling
|
|
836
836
|
// unrelated Wasm, N-API, native, or web outputs onto the compiler critical path.
|
|
837
837
|
//
|
|
838
|
-
//
|
|
839
|
-
// generated implementation identifiers are not valid declaration inputs.
|
|
840
|
-
// The executor gives ttsc a JS-only overlay and emits declarations from the
|
|
841
|
-
// original project with native tsc.
|
|
838
|
+
// One transformer-aware compiler emits JavaScript and declarations.
|
|
842
839
|
targets['tsc-js'] = {
|
|
843
840
|
executor: '@smoothbricks/nx-plugin:typescript-emit',
|
|
844
841
|
cache: true,
|
|
@@ -858,7 +855,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
858
855
|
outputs: [],
|
|
859
856
|
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
|
|
860
857
|
options: {
|
|
861
|
-
command: '
|
|
858
|
+
command: 'ttsc -p tsconfig.lib.json --noEmit',
|
|
862
859
|
cwd: projectRoot,
|
|
863
860
|
},
|
|
864
861
|
};
|
|
@@ -870,7 +867,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
870
867
|
inputs: [selfDefault, dependencyProduction, ...checkInputs, '{projectRoot}/tsconfig.test.json'],
|
|
871
868
|
dependsOn: ['typecheck'],
|
|
872
869
|
options: {
|
|
873
|
-
command: '
|
|
870
|
+
command: 'ttsc -p tsconfig.test.json --noEmit',
|
|
874
871
|
cwd: projectRoot,
|
|
875
872
|
},
|
|
876
873
|
};
|
|
@@ -878,7 +875,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
878
875
|
executor: 'nx:run-commands',
|
|
879
876
|
continuous: true,
|
|
880
877
|
options: {
|
|
881
|
-
command: '
|
|
878
|
+
command: 'ttsc -p tsconfig.test.json --noEmit --watch',
|
|
882
879
|
cwd: projectRoot,
|
|
883
880
|
},
|
|
884
881
|
};
|
|
@@ -1127,11 +1124,16 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1127
1124
|
}
|
|
1128
1125
|
}
|
|
1129
1126
|
}
|
|
1130
|
-
if ('test' in declaredTargets && targets.test === undefined) {
|
|
1127
|
+
if (('test' in declaredTargets || typeof packageJson.scripts?.test === 'string') && targets.test === undefined) {
|
|
1131
1128
|
targets.test = {
|
|
1132
1129
|
dependsOn: ['^build', 'build'],
|
|
1133
1130
|
};
|
|
1134
1131
|
}
|
|
1132
|
+
for (const name of Object.keys(declaredTargets)) {
|
|
1133
|
+
if (name === 'test' || !isTestRunnerTargetName(name) || targets[name] !== undefined)
|
|
1134
|
+
continue;
|
|
1135
|
+
targets[name] = { dependsOn: ['^build', 'build'] };
|
|
1136
|
+
}
|
|
1135
1137
|
// Every `cargoFrozen` command needs a registry cache holding the whole locked
|
|
1136
1138
|
// graph, and offline cargo checks that at RESOLUTION — so a dev-dependency no
|
|
1137
1139
|
// build ever downloaded takes down `cargo --frozen build` just as surely as
|
|
@@ -40,6 +40,12 @@ export interface ManagedFileContext {
|
|
|
40
40
|
*/
|
|
41
41
|
crossTestArchives: CiCrossTestArchive[];
|
|
42
42
|
}
|
|
43
|
+
/** Temporary upstream compiler repairs distributed to smoo-managed Bun workspaces. */
|
|
44
|
+
export declare const managedTtscPatch: {
|
|
45
|
+
readonly version: '0.30.4';
|
|
46
|
+
readonly key: 'ttsc@0.30.4';
|
|
47
|
+
readonly path: 'patches/ttsc@0.30.4.patch';
|
|
48
|
+
};
|
|
43
49
|
export declare const managedFileTargetsForTest: {
|
|
44
50
|
target: string;
|
|
45
51
|
executable: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/managed-files/files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,kBAAkB,EAAmD,MAAM,kBAAkB,CAAC;AAI5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAa7C,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,uBAAuB,EAAE,OAAO,CAAC;IACjC,0BAA0B,EAAE,OAAO,CAAC;IACpC,qBAAqB,EAAE,OAAO,CA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D,kGAAkG;IAClG,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IACjD,uGAAuG;IACvG,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC;;;;OAIG;IACH,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;CACzC;AAED,sFAAsF;AACtF,eAAO,MAAM,gBAAgB;aAC3B,OAAO,EAAE,QAAQ;aACjB,GAAG,EAAE,aAAa;aAClB,IAAI,EAAE,2BAA2B;CACzB,CAAC;AAmJX,eAAO,MAAM,yBAAyB;;;GAAyE,CAAC;AAchH,qFAAqF;AACrF,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAElF;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,EAAE,CAM7E;AAED,+GAA+G;AAC/G,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,aAAa,GAAG,kBAAkB,EAC1C,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAMR"}
|
|
@@ -5,7 +5,18 @@ import { privateNpmReadTokenJobEnv, renderCiWorkflowYaml } from './ci-workflow.j
|
|
|
5
5
|
import { renderRunsOnLine } from './github-runs-on.js';
|
|
6
6
|
import { renderPrPreviewCleanupWorkflowYaml } from './pr-preview-cleanup-workflow.js';
|
|
7
7
|
import { renderPublishWorkflowYaml } from './publish-workflow.js';
|
|
8
|
+
/** Temporary upstream compiler repairs distributed to smoo-managed Bun workspaces. */
|
|
9
|
+
export const managedTtscPatch = {
|
|
10
|
+
version: '0.30.4',
|
|
11
|
+
key: 'ttsc@0.30.4',
|
|
12
|
+
path: 'patches/ttsc@0.30.4.patch',
|
|
13
|
+
};
|
|
8
14
|
const managedFiles = [
|
|
15
|
+
{
|
|
16
|
+
kind: 'raw',
|
|
17
|
+
source: managedTtscPatch.path,
|
|
18
|
+
target: managedTtscPatch.path,
|
|
19
|
+
},
|
|
9
20
|
{
|
|
10
21
|
kind: 'raw',
|
|
11
22
|
source: 'envrc',
|
package/executors.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"typescript-emit": {
|
|
9
9
|
"implementation": "./dist/executors/typescript-emit/executor.js",
|
|
10
10
|
"schema": "./src/executors/typescript-emit/schema.json",
|
|
11
|
-
"description": "Emit transformed JavaScript
|
|
11
|
+
"description": "Emit transformed JavaScript and declarations together with ttsc"
|
|
12
12
|
},
|
|
13
13
|
"clean-outputs": {
|
|
14
14
|
"implementation": "./dist/executors/clean-outputs/executor.js",
|