@smoothbricks/nx-plugin 0.2.0 → 0.2.1

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 CHANGED
@@ -91,4 +91,4 @@ The generator rewrites `package.json` so `nx.targets.test` uses:
91
91
  - `cwd: "{projectRoot}"`
92
92
  - `timeoutMs: 600000`
93
93
  - `killAfterMs: 10000`
94
- - package script alias `nx run <project>:test --tui=false --outputStyle=stream`
94
+ - package script alias `nx run <project>:test --outputStyle=stream`
@@ -91,7 +91,7 @@ export function checkBoundedTestTargetPolicy(packageJson, options) {
91
91
  return packageJson.scripts?.test === boundedTestScriptAlias(options.projectName);
92
92
  }
93
93
  export function boundedTestScriptAlias(projectName) {
94
- return `nx run ${projectName}:test --tui=false --outputStyle=stream`;
94
+ return `nx run ${projectName}:test --outputStyle=stream`;
95
95
  }
96
96
  export function resolveTestCommand(packageJson, defaultCommand = 'bun test', projectJson) {
97
97
  const commandFromProjectTarget = resolveTargetCommand(projectJson?.targets?.test);
@@ -84,7 +84,7 @@ function buildPackageJson(schema, packageName, projectRoot, rootPkg) {
84
84
  },
85
85
  files: ['dist', 'src', '!**/*.tsbuildinfo'],
86
86
  scripts: {
87
- test: `nx run ${schema.name}:test --tui=false --outputStyle=stream`,
87
+ test: `nx run ${schema.name}:test --outputStyle=stream`,
88
88
  },
89
89
  dependencies: {
90
90
  tslib: '^2.8.1',
@@ -10,7 +10,7 @@ export interface PackageTargetPolicyOptions {
10
10
  }
11
11
  export declare const BUILD_OUTPUT_DEPENDENCIES: string[];
12
12
  export declare function packageNxProjectName(pkg: Record<string, unknown>): string | null;
13
- export declare function nxRunAlias(projectName: string, targetName: string, continuous: boolean): string;
13
+ export declare function nxRunAlias(projectName: string, targetName: string, continuous: boolean, command?: string | null): string;
14
14
  /**
15
15
  * Check package target policy using an Nx Tree.
16
16
  * Uses `getProjects()` for project discovery instead of manual filesystem walking.
@@ -1 +1 @@
1
- {"version":3,"file":"package-target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AE,CAqBlH;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,0BAA+B,GAAG,OAAO,CA4B1G;AAiID,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACpC,aAAa,EAAE,CAEjB;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,EACnC,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAO,GACtD,OAAO,CAMT;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,aAAa,EAAE,CAqBhH;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,OAAO,CA4BxG"}
@@ -211,13 +211,19 @@ function parseNxRunAlias(command) {
211
211
  }
212
212
  return { projectName: match[1], targetName: match[2] };
213
213
  }
214
- export function nxRunAlias(projectName, targetName, continuous) {
214
+ export function nxRunAlias(projectName, targetName, continuous, command) {
215
215
  if (targetName === 'test') {
216
216
  return boundedTestScriptAlias(projectName);
217
217
  }
218
- const flags = continuous || targetName === 'test' ? ' --tui=false --outputStyle=stream' : '';
218
+ const flags = continuous ? ` --outputStyle=${nxRunOutputStyle(command)}` : '';
219
219
  return `nx run ${projectName}:${targetName}${flags}`;
220
220
  }
221
+ function nxRunOutputStyle(command) {
222
+ if (command && /(?:^|\s)(?:astro|vite)\s+dev(?:\s|$)/.test(command)) {
223
+ return 'dynamic-legacy';
224
+ }
225
+ return 'stream';
226
+ }
221
227
  function isContinuousTarget(targetName, command) {
222
228
  return (/(?:^|:|-)(?:dev|serve|preview|watch)(?:$|:|-)/.test(targetName) ||
223
229
  /(?:^|\s)(?:dev|serve|preview|--watch|-w)(?:\s|$)/.test(command));
@@ -536,7 +542,11 @@ function validatePackageScriptPolicy(pkg, packagePath, workspaceNames, options =
536
542
  });
537
543
  continue;
538
544
  }
539
- const expectedAlias = nxRunAlias(projectName, rewrite.targetName, rewrite.continuous);
545
+ const target = targets ? recordProperty(targets, rewrite.targetName) : null;
546
+ const targetOptions = target ? recordProperty(target, 'options') : null;
547
+ const command = targetOptions ? stringProperty(targetOptions, 'command') : null;
548
+ const rewriteCommand = 'command' in rewrite ? rewrite.command : null;
549
+ const expectedAlias = nxRunAlias(projectName, rewrite.targetName, rewrite.continuous, command ?? rewriteCommand);
540
550
  if (rawCommand !== expectedAlias) {
541
551
  issues.push({
542
552
  path: packagePath,
@@ -544,7 +554,6 @@ function validatePackageScriptPolicy(pkg, packagePath, workspaceNames, options =
544
554
  });
545
555
  continue;
546
556
  }
547
- const target = targets ? recordProperty(targets, rewrite.targetName) : null;
548
557
  if (!target &&
549
558
  rewrite.targetName !== scriptName &&
550
559
  targetExistsInResolvedProject(rewrite.targetName, options.resolvedTargets)) {
@@ -556,8 +565,6 @@ function validatePackageScriptPolicy(pkg, packagePath, workspaceNames, options =
556
565
  if (rewrite.targetName === 'test') {
557
566
  continue;
558
567
  }
559
- const targetOptions = target ? recordProperty(target, 'options') : null;
560
- const command = targetOptions ? stringProperty(targetOptions, 'command') : null;
561
568
  if (!target || stringProperty(target, 'executor') !== 'nx:run-commands' || !targetOptions || !command) {
562
569
  issues.push({
563
570
  path: packagePath,
@@ -830,7 +837,7 @@ function applyPackageScriptPolicyForPkg(pkg, _packagePath, workspaceNames, optio
830
837
  continue;
831
838
  }
832
839
  const targetName = rewrite.targetName;
833
- const alias = nxRunAlias(projectName, targetName, rewrite.continuous);
840
+ const alias = nxRunAlias(projectName, targetName, rewrite.continuous, rewrite.command);
834
841
  if (targetName === 'test') {
835
842
  continue;
836
843
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothbricks/nx-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./loader.js",
@@ -53,7 +53,7 @@
53
53
  "generators": "./generators.json",
54
54
  "executors": "./executors.json",
55
55
  "scripts": {
56
- "test": "nx run nx-plugin:test --tui=false --outputStyle=stream"
56
+ "test": "nx run nx-plugin:test --outputStyle=stream"
57
57
  },
58
58
  "nx": {
59
59
  "targets": {
@@ -44,7 +44,7 @@ describe('bounded test target policy', () => {
44
44
  killAfterMs: BOUNDED_TEST_KILL_AFTER_MS,
45
45
  },
46
46
  });
47
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
47
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
48
48
  });
49
49
 
50
50
  it('uses a direct test script when no target command exists', () => {
@@ -63,7 +63,7 @@ describe('bounded test target policy', () => {
63
63
  killAfterMs: BOUNDED_TEST_KILL_AFTER_MS,
64
64
  },
65
65
  });
66
- expect(packageJson.scripts?.test).toBe('nx run @scope/example:test --tui=false --outputStyle=stream');
66
+ expect(packageJson.scripts?.test).toBe('nx run @scope/example:test --outputStyle=stream');
67
67
  });
68
68
 
69
69
  it('normalizes project.json targets while reading package test scripts', () => {
@@ -104,7 +104,7 @@ describe('bounded test target policy', () => {
104
104
  executor: 'nx:run-commands',
105
105
  options: { command: 'bun test --package-target' },
106
106
  });
107
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
107
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
108
108
  });
109
109
 
110
110
  it('creates project.json test targets from package test scripts', () => {
@@ -127,7 +127,7 @@ describe('bounded test target policy', () => {
127
127
  },
128
128
  });
129
129
  expect(packageJson.nx).toBeUndefined();
130
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
130
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
131
131
  });
132
132
 
133
133
  it('requires bounded targets in project.json when project config exists', () => {
@@ -184,7 +184,7 @@ describe('bounded test target policy', () => {
184
184
  expect(applyWorkspaceBoundedTestTargetPolicy(root)).toBe(true);
185
185
 
186
186
  const app = JSON.parse(await readFile(join(root, 'packages/app/package.json'), 'utf8'));
187
- expect(app.scripts.test).toBe('nx run app:test --tui=false --outputStyle=stream');
187
+ expect(app.scripts.test).toBe('nx run app:test --outputStyle=stream');
188
188
  expect(app.nx.targets.test).toEqual({
189
189
  executor: BOUNDED_TEST_EXECUTOR,
190
190
  options: {
@@ -233,7 +233,7 @@ describe('bounded test target policy', () => {
233
233
 
234
234
  const appPackage = JSON.parse(await readFile(join(root, 'packages/app/package.json'), 'utf8'));
235
235
  const appProject = JSON.parse(await readFile(join(root, 'packages/app/project.json'), 'utf8'));
236
- expect(appPackage.scripts.test).toBe('nx run app:test --tui=false --outputStyle=stream');
236
+ expect(appPackage.scripts.test).toBe('nx run app:test --outputStyle=stream');
237
237
  expect(appPackage.nx).toBeUndefined();
238
238
  expect(appProject.targets.test).toEqual({
239
239
  executor: BOUNDED_TEST_EXECUTOR,
@@ -134,7 +134,7 @@ export function checkBoundedTestTargetPolicy(
134
134
  }
135
135
 
136
136
  export function boundedTestScriptAlias(projectName: string): string {
137
- return `nx run ${projectName}:test --tui=false --outputStyle=stream`;
137
+ return `nx run ${projectName}:test --outputStyle=stream`;
138
138
  }
139
139
 
140
140
  export function resolveTestCommand(
@@ -36,7 +36,7 @@ describe('bounded-test-targets generator', () => {
36
36
  await generator(tree, { project: '@scope/example' });
37
37
 
38
38
  const packageJson = readJson(tree, 'packages/example/package.json');
39
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
39
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
40
40
  expect(packageJson.nx?.targets?.test).toEqual({
41
41
  executor: BOUNDED_TEST_EXECUTOR,
42
42
  dependsOn: ['typecheck-tests', '^build'],
@@ -60,7 +60,7 @@ describe('bounded-test-targets generator', () => {
60
60
  await generator(tree, { project: 'packages/example' });
61
61
 
62
62
  const packageJson = readJson(tree, 'packages/example/package.json');
63
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
63
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
64
64
  expect(packageJson.nx?.targets?.test).toEqual({
65
65
  executor: BOUNDED_TEST_EXECUTOR,
66
66
  options: {
@@ -101,7 +101,7 @@ describe('bounded-test-targets generator', () => {
101
101
 
102
102
  const packageJson = readJson(tree, 'packages/example/package.json');
103
103
  const projectJson = readJson(tree, 'packages/example/project.json');
104
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
104
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
105
105
  expect(packageJson.nx?.targets?.test).toEqual({
106
106
  executor: 'nx:run-commands',
107
107
  options: { command: 'bun test --package-target' },
@@ -67,7 +67,7 @@ describe('bun-test-tracing generator', () => {
67
67
  );
68
68
 
69
69
  const packageJson = readJson(tree, 'packages/example/package.json');
70
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
70
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
71
71
  expect(packageJson.nx?.targets?.test).toEqual({
72
72
  executor: '@smoothbricks/nx-plugin:bounded-exec',
73
73
  dependsOn: ['typecheck-tests', '^build'],
@@ -198,7 +198,7 @@ describe('bun-test-tracing generator', () => {
198
198
  expect(bunfig).toContain('@smoothbricks/lmao/bun/trace-preload');
199
199
 
200
200
  const packageJson = readJson(tree, 'packages/example/package.json');
201
- expect(packageJson.scripts?.test).toBe('nx run example:test --tui=false --outputStyle=stream');
201
+ expect(packageJson.scripts?.test).toBe('nx run example:test --outputStyle=stream');
202
202
 
203
203
  const tsconfigTest = readJson(tree, 'packages/example/tsconfig.test.json') as {
204
204
  extends?: string;
@@ -50,7 +50,7 @@ describe('create-package generator', () => {
50
50
  });
51
51
  expect(pkg.dependencies).toEqual({ tslib: '^2.8.1' });
52
52
  expect(pkg.devDependencies).toEqual({ '@smoothbricks/validation': 'workspace:*' });
53
- expect(pkg.scripts?.test).toBe('nx run duration:test --tui=false --outputStyle=stream');
53
+ expect(pkg.scripts?.test).toBe('nx run duration:test --outputStyle=stream');
54
54
  expect(pkg.nx?.name).toBe('duration');
55
55
  expect(pkg.nx?.targets?.lint).toEqual({});
56
56
  expect(pkg.nx?.targets?.test?.executor).toBe('@smoothbricks/nx-plugin:bounded-exec');
@@ -111,7 +111,7 @@ function buildPackageJson(
111
111
  },
112
112
  files: ['dist', 'src', '!**/*.tsbuildinfo'],
113
113
  scripts: {
114
- test: `nx run ${schema.name}:test --tui=false --outputStyle=stream`,
114
+ test: `nx run ${schema.name}:test --outputStyle=stream`,
115
115
  },
116
116
  dependencies: {
117
117
  tslib: '^2.8.1',
@@ -209,8 +209,8 @@ describe('package target policy', () => {
209
209
  expect(applyPackageTargetPolicy(root)).toBe(true);
210
210
 
211
211
  const web = JSON.parse(await readFile(join(root, 'packages/web/package.json'), 'utf8'));
212
- // dev script should become an Nx alias with streaming flags
213
- expect(web.scripts.dev).toBe('nx run web:dev --tui=false --outputStyle=stream');
212
+ // Vite/Astro dev servers render best with dynamic legacy output.
213
+ expect(web.scripts.dev).toBe('nx run web:dev --outputStyle=dynamic-legacy');
214
214
  // build script should become an Nx alias without streaming flags
215
215
  expect(web.scripts.build).toBe('nx run web:build');
216
216
  // nx.targets.dev should be created with continuous flag
@@ -237,7 +237,7 @@ describe('package target policy', () => {
237
237
  name: '@scope/app',
238
238
  dependencies: { '@scope/lib': 'workspace:*' },
239
239
  scripts: {
240
- dev: 'nx run app:dev --tui=false --outputStyle=stream',
240
+ dev: 'nx run app:dev --outputStyle=stream',
241
241
  },
242
242
  nx: {
243
243
  name: 'app',
@@ -415,7 +415,14 @@ describe('per-package applyPackageTargets', () => {
415
415
 
416
416
  describe('nxRunAlias', () => {
417
417
  it('generates streaming flags for continuous targets', () => {
418
- expect(nxRunAlias('app', 'dev', true)).toBe('nx run app:dev --tui=false --outputStyle=stream');
418
+ expect(nxRunAlias('app', 'dev', true)).toBe('nx run app:dev --outputStyle=stream');
419
+ });
420
+
421
+ it('uses dynamic legacy output for Astro and Vite dev targets', () => {
422
+ expect(nxRunAlias('app', 'dev', true, 'astro dev')).toBe('nx run app:dev --outputStyle=dynamic-legacy');
423
+ expect(nxRunAlias('app', 'serve', true, 'vite dev --host 0.0.0.0')).toBe(
424
+ 'nx run app:serve --outputStyle=dynamic-legacy',
425
+ );
419
426
  });
420
427
 
421
428
  it('generates plain alias for non-continuous targets', () => {
@@ -423,7 +430,7 @@ describe('nxRunAlias', () => {
423
430
  });
424
431
 
425
432
  it('delegates test targets to boundedTestScriptAlias', () => {
426
- expect(nxRunAlias('app', 'test', false)).toBe('nx run app:test --tui=false --outputStyle=stream');
433
+ expect(nxRunAlias('app', 'test', false)).toBe('nx run app:test --outputStyle=stream');
427
434
  });
428
435
  });
429
436
 
@@ -569,7 +576,7 @@ describe('checkPackageTargetPolicyTree', () => {
569
576
  name: '@scope/app',
570
577
  dependencies: { '@scope/lib': 'workspace:*' },
571
578
  scripts: {
572
- dev: 'nx run app:dev --tui=false --outputStyle=stream',
579
+ dev: 'nx run app:dev --outputStyle=stream',
573
580
  },
574
581
  nx: {
575
582
  name: 'app',
@@ -723,7 +730,7 @@ describe('applyPackageTargetPolicyTree', () => {
723
730
  expect(applyPackageTargetPolicyTree(tree)).toBe(true);
724
731
 
725
732
  const web = readJson(tree, 'packages/web/package.json');
726
- expect(web.scripts.dev).toBe('nx run web:dev --tui=false --outputStyle=stream');
733
+ expect(web.scripts.dev).toBe('nx run web:dev --outputStyle=dynamic-legacy');
727
734
  expect(web.scripts.build).toBe('nx run web:build');
728
735
  expect(web.nx.targets.dev.continuous).toBe(true);
729
736
  expect(web.nx.targets.dev.executor).toBe('nx:run-commands');
@@ -291,14 +291,26 @@ function parseNxRunAlias(command: string): { projectName: string; targetName: st
291
291
  return { projectName: match[1], targetName: match[2] };
292
292
  }
293
293
 
294
- export function nxRunAlias(projectName: string, targetName: string, continuous: boolean): string {
294
+ export function nxRunAlias(
295
+ projectName: string,
296
+ targetName: string,
297
+ continuous: boolean,
298
+ command?: string | null,
299
+ ): string {
295
300
  if (targetName === 'test') {
296
301
  return boundedTestScriptAlias(projectName);
297
302
  }
298
- const flags = continuous || targetName === 'test' ? ' --tui=false --outputStyle=stream' : '';
303
+ const flags = continuous ? ` --outputStyle=${nxRunOutputStyle(command)}` : '';
299
304
  return `nx run ${projectName}:${targetName}${flags}`;
300
305
  }
301
306
 
307
+ function nxRunOutputStyle(command?: string | null): 'stream' | 'dynamic-legacy' {
308
+ if (command && /(?:^|\s)(?:astro|vite)\s+dev(?:\s|$)/.test(command)) {
309
+ return 'dynamic-legacy';
310
+ }
311
+ return 'stream';
312
+ }
313
+
302
314
  function isContinuousTarget(targetName: string, command: string): boolean {
303
315
  return (
304
316
  /(?:^|:|-)(?:dev|serve|preview|watch)(?:$|:|-)/.test(targetName) ||
@@ -677,7 +689,11 @@ function validatePackageScriptPolicy(
677
689
  });
678
690
  continue;
679
691
  }
680
- const expectedAlias = nxRunAlias(projectName, rewrite.targetName, rewrite.continuous);
692
+ const target = targets ? recordProperty(targets, rewrite.targetName) : null;
693
+ const targetOptions = target ? recordProperty(target, 'options') : null;
694
+ const command = targetOptions ? stringProperty(targetOptions, 'command') : null;
695
+ const rewriteCommand = 'command' in rewrite ? rewrite.command : null;
696
+ const expectedAlias = nxRunAlias(projectName, rewrite.targetName, rewrite.continuous, command ?? rewriteCommand);
681
697
  if (rawCommand !== expectedAlias) {
682
698
  issues.push({
683
699
  path: packagePath,
@@ -685,7 +701,6 @@ function validatePackageScriptPolicy(
685
701
  });
686
702
  continue;
687
703
  }
688
- const target = targets ? recordProperty(targets, rewrite.targetName) : null;
689
704
  if (
690
705
  !target &&
691
706
  rewrite.targetName !== scriptName &&
@@ -699,8 +714,6 @@ function validatePackageScriptPolicy(
699
714
  if (rewrite.targetName === 'test') {
700
715
  continue;
701
716
  }
702
- const targetOptions = target ? recordProperty(target, 'options') : null;
703
- const command = targetOptions ? stringProperty(targetOptions, 'command') : null;
704
717
  if (!target || stringProperty(target, 'executor') !== 'nx:run-commands' || !targetOptions || !command) {
705
718
  issues.push({
706
719
  path: packagePath,
@@ -1005,7 +1018,7 @@ function applyPackageScriptPolicyForPkg(
1005
1018
  continue;
1006
1019
  }
1007
1020
  const targetName = rewrite.targetName;
1008
- const alias = nxRunAlias(projectName, targetName, rewrite.continuous);
1021
+ const alias = nxRunAlias(projectName, targetName, rewrite.continuous, rewrite.command);
1009
1022
  if (targetName === 'test') {
1010
1023
  continue;
1011
1024
  }