@nx/devkit 20.1.0-beta.3 → 20.1.0-beta.5

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/devkit",
3
- "version": "20.1.0-beta.3",
3
+ "version": "20.1.0-beta.5",
4
4
  "private": false,
5
5
  "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
6
6
  "repository": {
@@ -129,7 +129,7 @@ function processProject(tree, projectRoot, projectConfiguration) {
129
129
  if (!targetCommands.length) {
130
130
  return;
131
131
  }
132
- const replacedTargets = new Set();
132
+ let hasChanges = false;
133
133
  for (const targetCommand of targetCommands) {
134
134
  const { command, target, configuration } = targetCommand;
135
135
  const targetCommandRegex = new RegExp(`(?<=^|&)((?: )*(?:[^&\\r\\n\\s]+ )*)(${command})((?: [^&\\r\\n\\s]+)*(?: )*)(?=$|&)`, 'g');
@@ -140,7 +140,7 @@ function processProject(tree, projectRoot, projectConfiguration) {
140
140
  packageJson.scripts[scriptName] = script.replace(targetCommandRegex, configuration
141
141
  ? `$1nx ${target} --configuration=${configuration}$3`
142
142
  : `$1nx ${target}$3`);
143
- replacedTargets.add(target);
143
+ hasChanges = true;
144
144
  }
145
145
  else {
146
146
  /**
@@ -199,20 +199,22 @@ function processProject(tree, projectRoot, projectConfiguration) {
199
199
  packageJson.scripts[scriptName] = packageJson.scripts[scriptName].replace(match, match.replace(commandRegex, configuration
200
200
  ? `$1nx ${target} --configuration=${configuration}$4`
201
201
  : `$1nx ${target}$4`));
202
- replacedTargets.add(target);
202
+ hasChanges = true;
203
203
  }
204
204
  else {
205
205
  // there are different args or the script has extra args, replace with the command leaving the args
206
206
  packageJson.scripts[scriptName] = packageJson.scripts[scriptName].replace(match, match.replace(commandRegex, configuration
207
207
  ? `$1nx ${target} --configuration=${configuration}$3`
208
208
  : `$1nx ${target}$3`));
209
- replacedTargets.add(target);
209
+ hasChanges = true;
210
210
  }
211
211
  }
212
212
  }
213
213
  }
214
214
  }
215
- (0, devkit_exports_1.writeJson)(tree, packageJsonPath, packageJson);
215
+ if (hasChanges) {
216
+ (0, devkit_exports_1.writeJson)(tree, packageJsonPath, packageJson);
217
+ }
216
218
  }
217
219
  function getInferredTargetCommands(project) {
218
220
  const targetCommands = [];