@o3r/schematics 11.1.0-prerelease.30 → 11.1.0-prerelease.32

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": "@o3r/schematics",
3
- "version": "11.1.0-prerelease.30",
3
+ "version": "11.1.0-prerelease.32",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,7 +30,7 @@
30
30
  "@angular-devkit/core": "~18.0.0",
31
31
  "@angular-devkit/schematics": "~18.0.0",
32
32
  "@angular/cli": "~18.0.0",
33
- "@o3r/telemetry": "^11.1.0-prerelease.30",
33
+ "@o3r/telemetry": "^11.1.0-prerelease.32",
34
34
  "@schematics/angular": "~18.0.0",
35
35
  "eslint": "^8.57.0",
36
36
  "rxjs": "^7.8.1",
@@ -85,9 +85,9 @@
85
85
  "@nx/eslint-plugin": "~19.3.0",
86
86
  "@nx/jest": "~19.3.0",
87
87
  "@nx/js": "~19.3.0",
88
- "@o3r/build-helpers": "^11.1.0-prerelease.30",
89
- "@o3r/eslint-plugin": "^11.1.0-prerelease.30",
90
- "@o3r/telemetry": "^11.1.0-prerelease.30",
88
+ "@o3r/build-helpers": "^11.1.0-prerelease.32",
89
+ "@o3r/eslint-plugin": "^11.1.0-prerelease.32",
90
+ "@o3r/telemetry": "^11.1.0-prerelease.32",
91
91
  "@schematics/angular": "~18.0.0",
92
92
  "@stylistic/eslint-plugin-ts": "^2.0.0",
93
93
  "@types/inquirer": "~8.2.10",
@@ -1 +1 @@
1
- {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../../src/utility/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,gEAoBrG"}
1
+ {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../../src/utility/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,gEA2BrG"}
@@ -7,20 +7,24 @@ exports.ignorePatterns = void 0;
7
7
  * @param patternsToAdd List of patterns with description to add to gitignore files
8
8
  */
9
9
  function ignorePatterns(tree, patternsToAdd) {
10
- if (tree.exists('/.gitignore')) {
11
- let gitIgnoreFile = tree.read('/.gitignore').toString();
12
- let found = false;
13
- patternsToAdd
14
- .map(({ description, patterns }) => ({ description, patterns: patterns.filter((pattern) => new RegExp('^' + pattern.replace(/([*/\\.])/g, '\\$1')).test(gitIgnoreFile)) }))
15
- .filter(({ patterns }) => patterns.length)
16
- .forEach(({ description, patterns }) => {
17
- found = true;
18
- gitIgnoreFile = gitIgnoreFile + `\n# ${description}\n${patterns.join('\n')}\n`;
19
- });
20
- if (found) {
21
- tree.overwrite('/.gitignore', gitIgnoreFile);
22
- }
10
+ const gitIgnoreFileName = '/.gitignore';
11
+ const isGitIgnorePresent = tree.exists(gitIgnoreFileName);
12
+ let gitIgnoreFileContent = isGitIgnorePresent ? tree.readText(gitIgnoreFileName) : '';
13
+ const filteredPatternsToAdd = patternsToAdd
14
+ .map(({ description, patterns }) => ({ description, patterns: patterns.filter((pattern) => !new RegExp('^' + pattern.replace(/([*/\\.])/g, '\\$1')).test(gitIgnoreFileContent)) }))
15
+ .filter(({ patterns }) => patterns.length);
16
+ if (!filteredPatternsToAdd.length) {
17
+ return tree;
23
18
  }
19
+ gitIgnoreFileContent += '\n' + filteredPatternsToAdd
20
+ .map(({ description, patterns }) => (description ? `# ${description}\n` : '')
21
+ + patterns.join('\n'))
22
+ .join('\n');
23
+ if (isGitIgnorePresent) {
24
+ tree.overwrite(gitIgnoreFileName, gitIgnoreFileContent);
25
+ return tree;
26
+ }
27
+ tree.create(gitIgnoreFileName, gitIgnoreFileContent);
24
28
  return tree;
25
29
  }
26
30
  exports.ignorePatterns = ignorePatterns;
@@ -1 +1 @@
1
- {"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../../src/utility/gitignore.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAU,EAAE,aAA2D;IACpG,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QAE/B,IAAI,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAE,CAAC,QAAQ,EAAE,CAAC;QACzD,IAAI,KAAK,GAAG,KAAK,CAAC;QAElB,aAAa;aACV,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,EAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAC,CAAC,CAAC;aACxK,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;aACzC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE;YACrC,KAAK,GAAG,IAAI,CAAC;YACb,aAAa,GAAG,aAAa,GAAG,OAAO,WAAY,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAClF,CAAC,CAAC,CAAC;QAEL,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,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