nx 22.6.0 → 22.6.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.
Files changed (141) hide show
  1. package/bin/nx.js +13 -8
  2. package/package.json +11 -12
  3. package/src/adapter/ngcli-adapter.d.ts +8 -5
  4. package/src/adapter/ngcli-adapter.d.ts.map +1 -1
  5. package/src/adapter/ngcli-adapter.js +29 -15
  6. package/src/ai/clone-ai-config-repo.d.ts.map +1 -1
  7. package/src/ai/clone-ai-config-repo.js +2 -0
  8. package/src/command-line/add/add.js +1 -1
  9. package/src/command-line/examples.d.ts +7 -0
  10. package/src/command-line/examples.d.ts.map +1 -1
  11. package/src/command-line/examples.js +29 -1
  12. package/src/command-line/exec/exec.js +3 -3
  13. package/src/command-line/format/format.js +3 -3
  14. package/src/command-line/generate/generate.d.ts.map +1 -1
  15. package/src/command-line/generate/generate.js +1 -1
  16. package/src/command-line/graph/graph.js +1 -1
  17. package/src/command-line/init/command-object.js +1 -21
  18. package/src/command-line/init/configure-plugins.js +1 -1
  19. package/src/command-line/init/implementation/angular/integrated-workspace.js +1 -1
  20. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -2
  21. package/src/command-line/init/implementation/deduce-default-base.js +5 -5
  22. package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +2 -2
  23. package/src/command-line/init/implementation/dot-nx/nxw.js +1 -1
  24. package/src/command-line/init/implementation/utils.d.ts +1 -2
  25. package/src/command-line/init/implementation/utils.d.ts.map +1 -1
  26. package/src/command-line/init/implementation/utils.js +1 -15
  27. package/src/command-line/init/init-v1.d.ts +0 -3
  28. package/src/command-line/init/init-v1.d.ts.map +1 -1
  29. package/src/command-line/init/init-v1.js +1 -27
  30. package/src/command-line/init/init-v2.d.ts +0 -1
  31. package/src/command-line/init/init-v2.d.ts.map +1 -1
  32. package/src/command-line/init/init-v2.js +7 -35
  33. package/src/command-line/mcp/mcp.d.ts.map +1 -1
  34. package/src/command-line/mcp/mcp.js +2 -0
  35. package/src/command-line/migrate/migrate-ui-api.d.ts.map +1 -1
  36. package/src/command-line/migrate/migrate-ui-api.js +13 -0
  37. package/src/command-line/migrate/migrate.d.ts.map +1 -1
  38. package/src/command-line/migrate/migrate.js +16 -14
  39. package/src/command-line/migrate/run-migration-process.js +2 -0
  40. package/src/command-line/nx-cloud/connect/view-logs.js +1 -1
  41. package/src/command-line/nx-commands.js +65 -65
  42. package/src/command-line/release/config/version-plans.js +1 -1
  43. package/src/command-line/release/utils/exec-command.js +1 -1
  44. package/src/command-line/release/utils/launch-editor.js +2 -2
  45. package/src/command-line/release/utils/remote-release-clients/github.d.ts.map +1 -1
  46. package/src/command-line/release/utils/remote-release-clients/github.js +2 -1
  47. package/src/command-line/release/utils/remote-release-clients/gitlab.d.ts.map +1 -1
  48. package/src/command-line/release/utils/remote-release-clients/gitlab.js +1 -0
  49. package/src/command-line/release/version/release-group-processor.d.ts.map +1 -1
  50. package/src/command-line/release/version/release-group-processor.js +2 -4
  51. package/src/command-line/release/version.js +1 -1
  52. package/src/command-line/run/run.d.ts.map +1 -1
  53. package/src/command-line/run/run.js +2 -2
  54. package/src/command-line/watch/watch.js +1 -1
  55. package/src/core/graph/main.js +1 -1
  56. package/src/daemon/client/client.d.ts +1 -1
  57. package/src/daemon/client/client.d.ts.map +1 -1
  58. package/src/daemon/client/client.js +3 -2
  59. package/src/daemon/client/generate-help-output.js +1 -1
  60. package/src/daemon/server/handle-configure-ai-agents.js +11 -4
  61. package/src/daemon/server/handle-hash-tasks.d.ts +1 -0
  62. package/src/daemon/server/handle-hash-tasks.d.ts.map +1 -1
  63. package/src/daemon/server/handle-hash-tasks.js +1 -1
  64. package/src/daemon/server/shutdown-utils.js +1 -1
  65. package/src/executors/run-commands/run-commands.impl.d.ts.map +1 -1
  66. package/src/executors/run-commands/run-commands.impl.js +60 -7
  67. package/src/executors/run-commands/running-tasks.d.ts.map +1 -1
  68. package/src/executors/run-commands/running-tasks.js +1 -5
  69. package/src/executors/run-script/run-script.impl.js +1 -1
  70. package/src/hasher/native-task-hasher-impl.d.ts +2 -2
  71. package/src/hasher/native-task-hasher-impl.d.ts.map +1 -1
  72. package/src/hasher/native-task-hasher-impl.js +6 -6
  73. package/src/hasher/task-hasher.d.ts +4 -4
  74. package/src/hasher/task-hasher.d.ts.map +1 -1
  75. package/src/hasher/task-hasher.js +9 -6
  76. package/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  77. package/src/native/nx.wasm32-wasi.wasm +0 -0
  78. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
  79. package/src/plugins/js/lock-file/bun-parser.js +1 -1
  80. package/src/plugins/js/lock-file/lock-file.d.ts.map +1 -1
  81. package/src/plugins/js/lock-file/lock-file.js +3 -1
  82. package/src/project-graph/file-utils.d.ts.map +1 -1
  83. package/src/project-graph/file-utils.js +4 -2
  84. package/src/tasks-runner/cache.js +1 -1
  85. package/src/tasks-runner/task-orchestrator.d.ts +4 -2
  86. package/src/tasks-runner/task-orchestrator.d.ts.map +1 -1
  87. package/src/tasks-runner/task-orchestrator.js +59 -32
  88. package/src/utils/ab-testing.js +1 -1
  89. package/src/utils/analytics-prompt.d.ts.map +1 -1
  90. package/src/utils/analytics-prompt.js +2 -0
  91. package/src/utils/child-process.d.ts.map +1 -1
  92. package/src/utils/child-process.js +1 -2
  93. package/src/utils/command-line-utils.js +3 -3
  94. package/src/utils/default-base.js +1 -1
  95. package/src/utils/git-utils.d.ts.map +1 -1
  96. package/src/utils/git-utils.index-filter.js +2 -2
  97. package/src/utils/git-utils.js +6 -5
  98. package/src/utils/git-utils.tree-filter.js +1 -1
  99. package/src/utils/machine-id-cache.d.ts.map +1 -1
  100. package/src/utils/machine-id-cache.js +72 -2
  101. package/src/utils/package-manager.d.ts.map +1 -1
  102. package/src/utils/package-manager.js +8 -13
  103. package/src/utils/require-nx-key.js +1 -1
  104. package/src/utils/serialize-overrides-into-command-line.d.ts.map +1 -1
  105. package/src/utils/serialize-overrides-into-command-line.js +3 -4
  106. package/src/utils/shell-quoting.d.ts +11 -0
  107. package/src/utils/shell-quoting.d.ts.map +1 -0
  108. package/src/utils/shell-quoting.js +41 -0
  109. package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.d.ts +0 -2
  110. package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.d.ts.map +0 -1
  111. package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.js +0 -21
  112. package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.d.ts +0 -2
  113. package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.d.ts.map +0 -1
  114. package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +0 -20
  115. package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.d.ts +0 -2
  116. package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.d.ts.map +0 -1
  117. package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.js +0 -17
  118. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.d.ts +0 -2
  119. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.d.ts.map +0 -1
  120. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +0 -20
  121. package/src/command-line/init/implementation/react/clean-up-files.d.ts +0 -2
  122. package/src/command-line/init/implementation/react/clean-up-files.d.ts.map +0 -1
  123. package/src/command-line/init/implementation/react/clean-up-files.js +0 -30
  124. package/src/command-line/init/implementation/react/index.d.ts +0 -5
  125. package/src/command-line/init/implementation/react/index.d.ts.map +0 -1
  126. package/src/command-line/init/implementation/react/index.js +0 -77
  127. package/src/command-line/init/implementation/react/read-name-from-package-json.d.ts +0 -2
  128. package/src/command-line/init/implementation/react/read-name-from-package-json.d.ts.map +0 -1
  129. package/src/command-line/init/implementation/react/read-name-from-package-json.js +0 -16
  130. package/src/command-line/init/implementation/react/rename-js-to-jsx.d.ts +0 -2
  131. package/src/command-line/init/implementation/react/rename-js-to-jsx.d.ts.map +0 -1
  132. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +0 -22
  133. package/src/command-line/init/implementation/react/tsconfig-setup.d.ts +0 -2
  134. package/src/command-line/init/implementation/react/tsconfig-setup.d.ts.map +0 -1
  135. package/src/command-line/init/implementation/react/tsconfig-setup.js +0 -108
  136. package/src/command-line/init/implementation/react/write-vite-config.d.ts +0 -2
  137. package/src/command-line/init/implementation/react/write-vite-config.d.ts.map +0 -1
  138. package/src/command-line/init/implementation/react/write-vite-config.js +0 -53
  139. package/src/command-line/init/implementation/react/write-vite-index-html.d.ts +0 -2
  140. package/src/command-line/init/implementation/react/write-vite-index-html.d.ts.map +0 -1
  141. package/src/command-line/init/implementation/react/write-vite-index-html.js +0 -24
@@ -64,7 +64,8 @@ class TaskOrchestrator {
64
64
  this.runningRunCommandsTasks = new Map();
65
65
  this.runningDiscreteTasks = new Map();
66
66
  this.discreteTaskExitHandled = new Map();
67
- this.cleanupDone = false;
67
+ this.continuousTaskExitHandled = new Map();
68
+ this.cleanupPromise = null;
68
69
  }
69
70
  async init() {
70
71
  this.setupSignalHandlers();
@@ -144,16 +145,7 @@ class TaskOrchestrator {
144
145
  if (task.continuous) {
145
146
  const runningTask = await this.startContinuousTask(task, groupId);
146
147
  if (this.initializingTaskIds.has(task.id)) {
147
- await new Promise((res) => {
148
- runningTask.onExit((code) => {
149
- if (!this.tuiEnabled) {
150
- if (code > 128) {
151
- process.exit(code);
152
- }
153
- }
154
- res();
155
- });
156
- });
148
+ await this.continuousTaskExitHandled.get(task.id);
157
149
  }
158
150
  }
159
151
  else {
@@ -609,7 +601,12 @@ class TaskOrchestrator {
609
601
  groupId,
610
602
  ownsRunningTasksService: false,
611
603
  });
612
- this.registerContinuousTaskExitHandler(runningTask, task, groupId, false);
604
+ this.continuousTaskExitHandled.set(task.id, new Promise((resolve) => {
605
+ runningTask.onExit(async (code) => {
606
+ await this.handleContinuousTaskExit(code, task, groupId, false);
607
+ resolve();
608
+ });
609
+ }));
613
610
  // task is already running by another process, we schedule the next tasks
614
611
  // and release the threads
615
612
  await this.scheduleNextTasksAndReleaseThreads();
@@ -635,7 +632,12 @@ class TaskOrchestrator {
635
632
  groupId,
636
633
  ownsRunningTasksService: true,
637
634
  });
638
- this.registerContinuousTaskExitHandler(childProcess, task, groupId, true);
635
+ this.continuousTaskExitHandled.set(task.id, new Promise((resolve) => {
636
+ childProcess.onExit(async (code) => {
637
+ await this.handleContinuousTaskExit(code, task, groupId, true);
638
+ resolve();
639
+ });
640
+ }));
639
641
  await this.scheduleNextTasksAndReleaseThreads();
640
642
  return childProcess;
641
643
  }
@@ -821,22 +823,20 @@ class TaskOrchestrator {
821
823
  }
822
824
  }
823
825
  // endregion utils
824
- registerContinuousTaskExitHandler(runningTask, task, groupId, ownsRunningTasksService) {
825
- runningTask.onExit(async (code) => {
826
- // If cleanup already completed this task, nothing left to do
827
- if (this.completedTasks[task.id] !== undefined) {
828
- return;
829
- }
830
- const stoppingReason = this.runningContinuousTasks.get(task.id)?.stoppingReason;
831
- if (stoppingReason || exit_codes_1.EXPECTED_TERMINATION_SIGNALS.has(code)) {
832
- const reason = stoppingReason === 'fulfilled' ? 'fulfilled' : 'interrupted';
833
- await this.completeContinuousTask(task, groupId, ownsRunningTasksService, reason);
834
- }
835
- else {
836
- console.error(`Task "${task.id}" is continuous but exited with code ${code}`);
837
- await this.completeContinuousTask(task, groupId, ownsRunningTasksService, 'crashed');
838
- }
839
- });
826
+ async handleContinuousTaskExit(code, task, groupId, ownsRunningTasksService) {
827
+ // If cleanup already completed this task, nothing left to do
828
+ if (this.completedTasks[task.id] !== undefined) {
829
+ return;
830
+ }
831
+ const stoppingReason = this.runningContinuousTasks.get(task.id)?.stoppingReason;
832
+ if (stoppingReason || exit_codes_1.EXPECTED_TERMINATION_SIGNALS.has(code)) {
833
+ const reason = stoppingReason === 'fulfilled' ? 'fulfilled' : 'interrupted';
834
+ await this.completeContinuousTask(task, groupId, ownsRunningTasksService, reason);
835
+ }
836
+ else {
837
+ console.error(`Task "${task.id}" is continuous but exited with code ${code}`);
838
+ await this.completeContinuousTask(task, groupId, ownsRunningTasksService, 'crashed');
839
+ }
840
840
  }
841
841
  async completeContinuousTask(task, groupId, ownsRunningTasksService, reason) {
842
842
  if (this.completedTasks[task.id] !== undefined)
@@ -863,10 +863,13 @@ class TaskOrchestrator {
863
863
  }
864
864
  }
865
865
  async cleanup() {
866
- if (this.cleanupDone) {
867
- return;
866
+ if (this.cleanupPromise) {
867
+ return this.cleanupPromise;
868
868
  }
869
- this.cleanupDone = true;
869
+ this.cleanupPromise = this.performCleanup();
870
+ return this.cleanupPromise;
871
+ }
872
+ async performCleanup() {
870
873
  // Mark all running tasks for intentional stop
871
874
  const reason = this.stopRequested ? 'interrupted' : 'fulfilled';
872
875
  for (const entry of this.runningContinuousTasks.values()) {
@@ -916,6 +919,28 @@ class TaskOrchestrator {
916
919
  setupSignalHandlers() {
917
920
  process.once('SIGINT', () => {
918
921
  this.stopRequested = true;
922
+ if (!this.tuiEnabled) {
923
+ // Synchronously remove DB entries before async cleanup to prevent
924
+ // new nx processes from seeing stale "Waiting for ..." messages.
925
+ // This replicates the cleanup that process.exit() + Rust Drop
926
+ // previously provided.
927
+ for (const [taskId, { ownsRunningTasksService }] of this
928
+ .runningContinuousTasks) {
929
+ if (ownsRunningTasksService) {
930
+ this.runningTasksService?.removeRunningTask(taskId);
931
+ }
932
+ }
933
+ // Silence output — pnpm (and similar wrappers) may exit before nx
934
+ // finishes cleanup, returning the shell prompt. Any output after
935
+ // that point would appear after the prompt.
936
+ const noop = (_chunk, _encoding, callback) => {
937
+ if (callback)
938
+ callback();
939
+ return true;
940
+ };
941
+ process.stdout.write = noop;
942
+ process.stderr.write = noop;
943
+ }
919
944
  this.cleanup().finally(() => {
920
945
  if (this.resolveStopPromise) {
921
946
  this.resolveStopPromise();
@@ -926,6 +951,7 @@ class TaskOrchestrator {
926
951
  });
927
952
  });
928
953
  process.once('SIGTERM', () => {
954
+ this.stopRequested = true;
929
955
  this.cleanup().finally(() => {
930
956
  if (this.resolveStopPromise) {
931
957
  this.resolveStopPromise();
@@ -933,6 +959,7 @@ class TaskOrchestrator {
933
959
  });
934
960
  });
935
961
  process.once('SIGHUP', () => {
962
+ this.stopRequested = true;
936
963
  this.cleanup().finally(() => {
937
964
  if (this.resolveStopPromise) {
938
965
  this.resolveStopPromise();
@@ -99,7 +99,7 @@ function shouldRecordStats() {
99
99
  try {
100
100
  const stdout = (0, node_child_process_1.execSync)(pmc.getRegistryUrl, {
101
101
  encoding: 'utf-8',
102
- windowsHide: false,
102
+ windowsHide: true,
103
103
  });
104
104
  const url = new URL(stdout.trim());
105
105
  // don't record stats when testing locally
@@ -1 +1 @@
1
- {"version":3,"file":"analytics-prompt.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/analytics-prompt.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BlE;AAED,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,OAAO,CAAC,CAuBrE;AAwBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA4C/D"}
1
+ {"version":3,"file":"analytics-prompt.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/analytics-prompt.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BlE;AAED,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,OAAO,CAAC,CAuBrE;AAwBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA8C/D"}
@@ -105,6 +105,7 @@ function generateWorkspaceId(cwd) {
105
105
  const remoteUrl = (0, child_process_1.execSync)('git remote get-url origin', {
106
106
  stdio: 'pipe',
107
107
  cwd: root,
108
+ windowsHide: true,
108
109
  })
109
110
  .toString()
110
111
  .trim();
@@ -120,6 +121,7 @@ function generateWorkspaceId(cwd) {
120
121
  const firstCommit = (0, child_process_1.execSync)('git rev-list --max-parents=0 HEAD', {
121
122
  stdio: 'pipe',
122
123
  cwd: root,
124
+ windowsHide: true,
123
125
  })
124
126
  .toString()
125
127
  .trim()
@@ -1 +1 @@
1
- {"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAGL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,mBAAmB,CACjC,qBAAqB,CAAC,EAAE,sBAAsB,EAC9C,GAAG,GAAE,MAAsB,GAC1B,MAAM,CAeR;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;CAChD,QAYF;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,WAAW,GAAG;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;CAChD,GACA,OAAO,CAAC,IAAI,CAAC,CA4Bf;AAED,qBAAa,gBAAgB;IAKf,OAAO,CAAC,YAAY;IAJhC,OAAO,UAAQ;IAEf,aAAa,QAAM;gBAEC,YAAY,EAAE,YAAY;IAU9C,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAI9C,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAInD,IAAI,IAAI,IAAI;CAYb"}
1
+ {"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/child-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAGL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,mBAAmB,CACjC,qBAAqB,CAAC,EAAE,sBAAsB,EAC9C,GAAG,GAAE,MAAsB,GAC1B,MAAM,CAeR;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;CAChD,QAYF;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,WAAW,GAAG;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;CAChD,GACA,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED,qBAAa,gBAAgB;IAKf,OAAO,CAAC,YAAY;IAJhC,OAAO,UAAQ;IAEf,aAAa,QAAM;gBAEC,YAAY,EAAE,YAAY;IAU9C,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAI9C,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAInD,IAAI,IAAI,IAAI;CAYb"}
@@ -38,12 +38,11 @@ function runNxSync(cmd, options) {
38
38
  async function runNxAsync(cmd, options) {
39
39
  options ??= {};
40
40
  options.cwd ??= process.cwd();
41
- options.windowsHide ??= true;
42
41
  let { silent, packageManagerCommand, ...execSyncOptions } = options;
43
42
  silent ??= true;
44
43
  const baseCmd = getRunNxBaseCommand(packageManagerCommand, execSyncOptions.cwd);
45
44
  return new Promise((resolve, reject) => {
46
- const child = (0, child_process_1.exec)(`${baseCmd} ${cmd}`, options, (error, stdout, stderr) => {
45
+ const child = (0, child_process_1.exec)(`${baseCmd} ${cmd}`, { ...execSyncOptions, windowsHide: true }, (error, stdout, stderr) => {
47
46
  if (error) {
48
47
  reject(stderr || stdout || error.message);
49
48
  }
@@ -202,7 +202,7 @@ function getMergeBase(base, head = 'HEAD') {
202
202
  maxBuffer: file_utils_1.TEN_MEGABYTES,
203
203
  cwd: workspace_root_1.workspaceRoot,
204
204
  stdio: 'pipe',
205
- windowsHide: false,
205
+ windowsHide: true,
206
206
  })
207
207
  .toString()
208
208
  .trim();
@@ -213,7 +213,7 @@ function getMergeBase(base, head = 'HEAD') {
213
213
  maxBuffer: file_utils_1.TEN_MEGABYTES,
214
214
  cwd: workspace_root_1.workspaceRoot,
215
215
  stdio: 'pipe',
216
- windowsHide: false,
216
+ windowsHide: true,
217
217
  })
218
218
  .toString()
219
219
  .trim();
@@ -231,7 +231,7 @@ function parseGitOutput(command) {
231
231
  maxBuffer: file_utils_1.TEN_MEGABYTES,
232
232
  cwd: workspace_root_1.workspaceRoot,
233
233
  stdio: 'pipe',
234
- windowsHide: false,
234
+ windowsHide: true,
235
235
  })
236
236
  .toString('utf-8')
237
237
  .split('\n')
@@ -6,7 +6,7 @@ function deduceDefaultBase() {
6
6
  const nxDefaultBase = 'main';
7
7
  try {
8
8
  return ((0, child_process_1.execSync)('git config --get init.defaultBranch', {
9
- windowsHide: false,
9
+ windowsHide: true,
10
10
  })
11
11
  .toString()
12
12
  .trim() || nxDefaultBase);
@@ -1 +1 @@
1
- {"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/git-utils.ts"],"names":[],"mappings":"AAeA,wBAAsB,iBAAi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,EAAE,OAAO,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd;IASG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAMtC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAIpC,MAAM,CAAC,OAAO,EAAE,MAAM;IAGtB,WAAW;IAIX,eAAe,CAAC,IAAI,EAAE,MAAM;IAI5B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAItC,sBAAsB;IAWtB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAkB9C,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAkC1E,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,QAAQ;CAYjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAmDnE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CA+CzE;AAED,wBAAgB,aAAa,CAC3B,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CA4Bf;AAED,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWpE"}
@@ -9,10 +9,10 @@ try {
9
9
  const { execSync } = require('child_process');
10
10
  // NOTE: Using env vars because Windows PowerShell has its own handling of quotes (") messes up quotes in args, even if escaped.
11
11
  const src = process.env.NX_IMPORT_SOURCE;
12
- execSync('git read-tree --empty', { stdio: 'inherit', windowsHide: false });
12
+ execSync('git read-tree --empty', { stdio: 'inherit', windowsHide: true });
13
13
  execSync(`git reset ${process.env.GIT_COMMIT} -- "${src}"`, {
14
14
  stdio: 'inherit',
15
- windowsHide: false,
15
+ windowsHide: true,
16
16
  });
17
17
  }
18
18
  catch (error) {
@@ -11,7 +11,7 @@ const path_1 = require("path");
11
11
  const logger_1 = require("./logger");
12
12
  function execAsync(command, execOptions) {
13
13
  return new Promise((res, rej) => {
14
- (0, child_process_1.exec)(command, execOptions, (err, stdout, stderr) => {
14
+ (0, child_process_1.exec)(command, { ...execOptions, windowsHide: true }, (err, stdout, stderr) => {
15
15
  if (err) {
16
16
  return rej(err);
17
17
  }
@@ -36,7 +36,7 @@ class GitRepository {
36
36
  getGitRootPath(cwd) {
37
37
  return (0, child_process_1.execSync)('git rev-parse --show-toplevel', {
38
38
  cwd,
39
- windowsHide: false,
39
+ windowsHide: true,
40
40
  })
41
41
  .toString()
42
42
  .trim();
@@ -215,7 +215,7 @@ function getVcsRemoteInfo(directory) {
215
215
  try {
216
216
  const gitRemote = (0, child_process_1.execSync)('git remote -v', {
217
217
  stdio: 'pipe',
218
- windowsHide: false,
218
+ windowsHide: true,
219
219
  cwd: directory,
220
220
  })
221
221
  .toString()
@@ -259,13 +259,14 @@ function commitChanges(commitMessage, directory) {
259
259
  encoding: 'utf8',
260
260
  stdio: 'pipe',
261
261
  cwd: directory,
262
+ windowsHide: true,
262
263
  });
263
264
  (0, child_process_1.execSync)('git commit --no-verify -F -', {
264
265
  encoding: 'utf8',
265
266
  stdio: 'pipe',
266
267
  input: commitMessage,
267
268
  cwd: directory,
268
- windowsHide: false,
269
+ windowsHide: true,
269
270
  });
270
271
  }
271
272
  catch (err) {
@@ -287,7 +288,7 @@ function getLatestCommitSha(directory) {
287
288
  return (0, child_process_1.execSync)('git rev-parse HEAD', {
288
289
  encoding: 'utf8',
289
290
  stdio: 'pipe',
290
- windowsHide: false,
291
+ windowsHide: true,
291
292
  cwd: directory,
292
293
  }).trim();
293
294
  }
@@ -15,7 +15,7 @@ try {
15
15
  const src = process.env.NX_IMPORT_SOURCE;
16
16
  const dest = process.env.NX_IMPORT_DESTINATION;
17
17
  const files = execSync(`git ls-files -z ${src}`, {
18
- windowsHide: false,
18
+ windowsHide: true,
19
19
  })
20
20
  .toString()
21
21
  .trim()
@@ -1 +1 @@
1
- {"version":3,"file":"machine-id-cache.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/machine-id-cache.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAY3D"}
1
+ {"version":3,"file":"machine-id-cache.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/machine-id-cache.ts"],"names":[],"mappings":"AAmFA;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAY3D"}
@@ -1,8 +1,78 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCurrentMachineId = getCurrentMachineId;
4
- const node_machine_id_1 = require("node-machine-id");
4
+ const child_process_1 = require("child_process");
5
+ const crypto_1 = require("crypto");
5
6
  let _cachedMachineId = null;
7
+ /**
8
+ * Returns the platform-specific command to retrieve the machine GUID.
9
+ */
10
+ function getMachineIdCommand() {
11
+ switch (process.platform) {
12
+ case 'darwin':
13
+ return 'ioreg -rd1 -c IOPlatformExpertDevice';
14
+ case 'win32': {
15
+ const regPath = process.arch === 'ia32' &&
16
+ process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')
17
+ ? '%windir%\\sysnative\\cmd.exe /c %windir%\\System32'
18
+ : '%windir%\\System32';
19
+ return (`${regPath}\\REG.exe ` +
20
+ 'QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography ' +
21
+ '/v MachineGuid');
22
+ }
23
+ case 'linux':
24
+ return '( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :';
25
+ case 'freebsd':
26
+ return 'kenv -q smbios.system.uuid || sysctl -n kern.hostuuid';
27
+ default:
28
+ throw new Error(`Unsupported platform: ${process.platform}`);
29
+ }
30
+ }
31
+ /**
32
+ * Parses the raw command output into a clean machine GUID string.
33
+ */
34
+ function parseCommandOutput(raw) {
35
+ switch (process.platform) {
36
+ case 'darwin':
37
+ return raw
38
+ .split('IOPlatformUUID')[1]
39
+ .split('\n')[0]
40
+ .replace(/=|\s+|"/gi, '')
41
+ .toLowerCase();
42
+ case 'win32':
43
+ return raw
44
+ .toString()
45
+ .split('REG_SZ')[1]
46
+ .replace(/\r+|\n+|\s+/gi, '')
47
+ .toLowerCase();
48
+ case 'linux':
49
+ case 'freebsd':
50
+ return raw
51
+ .toString()
52
+ .replace(/\r+|\n+|\s+/gi, '')
53
+ .toLowerCase();
54
+ default:
55
+ throw new Error(`Unsupported platform: ${process.platform}`);
56
+ }
57
+ }
58
+ function hashId(guid) {
59
+ return (0, crypto_1.createHash)('sha256').update(guid).digest('hex');
60
+ }
61
+ /**
62
+ * Retrieves the machine ID by executing a platform-specific command.
63
+ * Uses windowsHide: true to prevent console windows from appearing
64
+ * when called from detached processes (daemon, plugin workers).
65
+ */
66
+ function machineId() {
67
+ return new Promise((resolve, reject) => {
68
+ (0, child_process_1.exec)(getMachineIdCommand(), { windowsHide: true }, (err, stdout) => {
69
+ if (err) {
70
+ return reject(new Error(`Error while obtaining machine id: ${err.stack}`));
71
+ }
72
+ return resolve(hashId(parseCommandOutput(stdout.toString())));
73
+ });
74
+ });
75
+ }
6
76
  /**
7
77
  * Get the current machine ID, with caching and error handling
8
78
  * @returns The machine ID or empty string if unable to retrieve
@@ -10,7 +80,7 @@ let _cachedMachineId = null;
10
80
  async function getCurrentMachineId() {
11
81
  if (_cachedMachineId === null) {
12
82
  try {
13
- _cachedMachineId = await (0, node_machine_id_1.machineId)();
83
+ _cachedMachineId = await machineId();
14
84
  }
15
85
  catch (e) {
16
86
  if (process.env.NX_VERBOSE_LOGGING === 'true') {
@@ -1 +1 @@
1
- {"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,CACP,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,GAAG,EAAE,MAAM,KACR,MAAM,CAAC;IAEZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAW,GAAG,cAAc,CAcrE;AAwBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,OAAO,CAmBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,sBAAsB,CAkIxB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,GAAE,cAAuC,EACvD,GAAG,SAAgB,GAClB,MAAM,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,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,cAAuC,EACvD,UAAU,GAAE,MAAM,EAAyC,EAC3D,IAAI,GAAE,MAAsB,GAC3B,IAAI,CAiEN"}
1
+ {"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/package-manager.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,CACP,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,GAAG,EAAE,MAAM,KACR,MAAM,CAAC;IAEZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAW,GAAG,cAAc,CAcrE;AAwBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,OAAO,CAmBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,GAA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AE,CAAC,CAiBlC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,GAAE,cAAuC,EACvD,IAAI,GAAE,MAAsB,GAC3B,MAAM,EAAE,CAoBV;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,cAAuC,EACvD,UAAU,GAAE,MAAM,EAAyC,EAC3D,IAAI,GAAE,MAAsB,GAC3B,IAAI,CAiEN"}
@@ -477,19 +477,14 @@ async function packageRegistryView(pkg, version, args) {
477
477
  return stdout.toString().trim();
478
478
  }
479
479
  async function packageRegistryPack(cwd, pkg, version) {
480
- let pm = detectPackageManager();
481
- if (pm === 'yarn' || pm === 'bun') {
482
- /**
483
- * `(p)npm pack` will download a tarball of the specified version,
484
- * whereas `yarn` pack creates a tarball of the active workspace, so it
485
- * does not work for getting the content of a library.
486
- *
487
- * @see https://github.com/nrwl/nx/pull/9667#discussion_r842553994
488
- *
489
- * bun doesn't currently support pack
490
- */
491
- pm = 'npm';
492
- }
480
+ /**
481
+ * Only `npm pack` supports downloading a tarball of a specified remote
482
+ * package. `yarn` packs the active workspace, `pnpm pack` only packs
483
+ * the local project, and `bun` doesn't support pack.
484
+ *
485
+ * @see https://github.com/nrwl/nx/pull/9667#discussion_r842553994
486
+ */
487
+ const pm = 'npm';
493
488
  const { stdout } = await execAsync(`${pm} pack ${pkg}@${version}`, {
494
489
  cwd,
495
490
  windowsHide: true,
@@ -9,7 +9,7 @@ async function requireNxKey() {
9
9
  if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
10
10
  try {
11
11
  (0, child_process_1.execSync)(`${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/key@latest`, {
12
- windowsHide: false,
12
+ windowsHide: true,
13
13
  });
14
14
  // @ts-ignore
15
15
  return await Promise.resolve().then(() => require('@nx/key'));
@@ -1 +1 @@
1
- {"version":3,"file":"serialize-overrides-into-command-line.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/serialize-overrides-into-command-line.ts"],"names":[],"mappings":"AAEA,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,GAAG,MAAM,EAAE,CAUX"}
1
+ {"version":3,"file":"serialize-overrides-into-command-line.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/serialize-overrides-into-command-line.ts"],"names":[],"mappings":"AAGA,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,GAAG,MAAM,EAAE,CAUX"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.serializeOverridesIntoCommandLine = serializeOverridesIntoCommandLine;
4
4
  const flat_1 = require("flat");
5
+ const shell_quoting_1 = require("./shell-quoting");
5
6
  function serializeOverridesIntoCommandLine(options) {
6
7
  const unparsed = options._ ? [...options._] : [];
7
8
  for (const key of Object.keys(options)) {
@@ -29,7 +30,8 @@ function serializeOption(key, value, unparsed) {
29
30
  }
30
31
  }
31
32
  else if (typeof value === 'string' &&
32
- stringShouldBeWrappedIntoQuotes(value)) {
33
+ (0, shell_quoting_1.needsShellQuoting)(value) &&
34
+ !(0, shell_quoting_1.isAlreadyQuoted)(value)) {
33
35
  const sanitized = value.replace(/"/g, String.raw `\"`);
34
36
  unparsed.push(`--${key}="${sanitized}"`);
35
37
  }
@@ -37,6 +39,3 @@ function serializeOption(key, value, unparsed) {
37
39
  unparsed.push(`--${key}=${value}`);
38
40
  }
39
41
  }
40
- function stringShouldBeWrappedIntoQuotes(str) {
41
- return str.includes(' ') || str.includes('{') || str.includes('"');
42
- }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Check if a string contains shell metacharacters that require quoting.
3
+ * These characters have special meaning in shell and would be interpreted
4
+ * incorrectly if not quoted (e.g., | for pipe, & for background, etc.)
5
+ */
6
+ export declare function needsShellQuoting(str: string): boolean;
7
+ /**
8
+ * Check if a string is already wrapped in matching quotes (single or double).
9
+ */
10
+ export declare function isAlreadyQuoted(str: string): boolean;
11
+ //# sourceMappingURL=shell-quoting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-quoting.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/shell-quoting.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAMpD"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.needsShellQuoting = needsShellQuoting;
4
+ exports.isAlreadyQuoted = isAlreadyQuoted;
5
+ /**
6
+ * Shell metacharacters that have special meaning and require quoting.
7
+ *
8
+ * Characters included:
9
+ * - | - pipe
10
+ * - & - background/AND
11
+ * - ; - command separator
12
+ * - < > - redirections
13
+ * - ( ) - subshell
14
+ * - $ - variable expansion
15
+ * - ` - command substitution
16
+ * - \ - escape
17
+ * - " ' - quotes
18
+ * - * ? [ ] - globbing
19
+ * - { } - brace expansion
20
+ * - ~ - home directory
21
+ * - # - comment
22
+ * - ! - history expansion
23
+ * - \s - whitespace (spaces, tabs, newlines)
24
+ */
25
+ const SHELL_META_CHARS = /[|&;<>()$`\\!"'*?[\]{}~#\s]/;
26
+ /**
27
+ * Check if a string contains shell metacharacters that require quoting.
28
+ * These characters have special meaning in shell and would be interpreted
29
+ * incorrectly if not quoted (e.g., | for pipe, & for background, etc.)
30
+ */
31
+ function needsShellQuoting(str) {
32
+ return SHELL_META_CHARS.test(str);
33
+ }
34
+ /**
35
+ * Check if a string is already wrapped in matching quotes (single or double).
36
+ */
37
+ function isAlreadyQuoted(str) {
38
+ return (str.length >= 2 &&
39
+ ((str[0] === "'" && str[str.length - 1] === "'") ||
40
+ (str[0] === '"' && str[str.length - 1] === '"')));
41
+ }
@@ -1,2 +0,0 @@
1
- export declare function addCracoCommandsToPackageScripts(appName: string, isStandalone: boolean): void;
2
- //# sourceMappingURL=add-craco-commands-to-package-scripts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-craco-commands-to-package-scripts.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.ts"],"names":[],"mappings":"AAEA,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,OAAO,QAiBtB"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addCracoCommandsToPackageScripts = addCracoCommandsToPackageScripts;
4
- const fileutils_1 = require("../../../../utils/fileutils");
5
- function addCracoCommandsToPackageScripts(appName, isStandalone) {
6
- const packageJsonPath = isStandalone
7
- ? 'package.json'
8
- : `apps/${appName}/package.json`;
9
- const distPath = isStandalone
10
- ? `dist/${appName}`
11
- : `../../dist/apps/${appName}`;
12
- const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
13
- packageJson.scripts = {
14
- ...packageJson.scripts,
15
- start: 'nx exec -- craco start',
16
- serve: 'npm start',
17
- build: `cross-env BUILD_PATH=${distPath} nx exec -- craco build`,
18
- test: 'nx exec -- craco test',
19
- };
20
- (0, fileutils_1.writeJsonFile)(packageJsonPath, packageJson);
21
- }
@@ -1,2 +0,0 @@
1
- export declare function addViteCommandsToPackageScripts(appName: string, isStandalone: boolean): void;
2
- //# sourceMappingURL=add-vite-commands-to-package-scripts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-vite-commands-to-package-scripts.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.ts"],"names":[],"mappings":"AAEA,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,OAAO,QAgBtB"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addViteCommandsToPackageScripts = addViteCommandsToPackageScripts;
4
- const fileutils_1 = require("../../../../utils/fileutils");
5
- function addViteCommandsToPackageScripts(appName, isStandalone) {
6
- const packageJsonPath = isStandalone
7
- ? 'package.json'
8
- : `apps/${appName}/package.json`;
9
- const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
10
- packageJson.scripts = {
11
- ...packageJson.scripts,
12
- // These should be replaced by the vite init generator later.
13
- start: 'vite',
14
- test: 'vitest',
15
- dev: 'vite',
16
- build: 'vite build',
17
- eject: undefined,
18
- };
19
- (0, fileutils_1.writeJsonFile)(packageJsonPath, packageJson, { spaces: 2 });
20
- }
@@ -1,2 +0,0 @@
1
- export declare function checkForCustomWebpackSetup(): void;
2
- //# sourceMappingURL=check-for-custom-webpack-setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-for-custom-webpack-setup.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/command-line/init/implementation/react/check-for-custom-webpack-setup.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,SAczC"}