@unisphere/nx 4.5.1 → 4.5.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rename-application.d.ts","sourceRoot":"","sources":["../../../src/generators/rename-application/rename-application.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAuW5D,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gCAAgC,iBA+E1C;AAED,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"rename-application.d.ts","sourceRoot":"","sources":["../../../src/generators/rename-application/rename-application.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAKL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAyX5D,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gCAAgC,iBA+E1C;AAED,eAAe,0BAA0B,CAAC"}
@@ -171,19 +171,37 @@ function updateProjectJson(tree, newPath, oldPath, oldNxProjectName, newNxProjec
171
171
  return;
172
172
  }
173
173
  let updated = false;
174
- if (content.includes(oldPath)) {
175
- content = content.replace(new RegExp(escapeRegExp(oldPath), 'g'), newPath);
176
- updated = true;
174
+ if (content.includes(oldPath) && oldPath !== newPath) {
175
+ const result = safeReplace(content, oldPath, newPath);
176
+ if (result !== content) {
177
+ content = result;
178
+ updated = true;
179
+ }
177
180
  }
178
- if (content.includes(oldNxProjectName)) {
179
- content = content.replace(new RegExp(escapeRegExp(oldNxProjectName), 'g'), newNxProjectName);
180
- updated = true;
181
+ if (content.includes(oldNxProjectName) && oldNxProjectName !== newNxProjectName) {
182
+ const result = safeReplace(content, oldNxProjectName, newNxProjectName);
183
+ if (result !== content) {
184
+ content = result;
185
+ updated = true;
186
+ }
181
187
  }
182
188
  if (updated) {
183
189
  tree.write(projectJsonPath, content);
184
190
  devkit_1.logger.info(`✅ Updated project.json paths and comments`);
185
191
  }
186
192
  }
193
+ function safeReplace(text, oldVal, newVal) {
194
+ if (oldVal === newVal)
195
+ return text;
196
+ if (!newVal.includes(oldVal)) {
197
+ return text.replace(new RegExp(escapeRegExp(oldVal), 'g'), newVal);
198
+ }
199
+ const placeholder = `\x00__SAFE_REPLACE_${Date.now()}__\x00`;
200
+ let result = text.replace(new RegExp(escapeRegExp(newVal), 'g'), placeholder);
201
+ result = result.replace(new RegExp(escapeRegExp(oldVal), 'g'), newVal);
202
+ result = result.replace(new RegExp(escapeRegExp(placeholder), 'g'), newVal);
203
+ return result;
204
+ }
187
205
  function updateReadme(tree, newPath, oldNormalizedName, newNormalizedName) {
188
206
  const readmePath = `${newPath}/README.md`;
189
207
  if (!tree.exists(readmePath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "4.5.1",
3
+ "version": "4.5.2",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",