@aneuhold/core-ts-lib 2.2.6 → 2.2.7

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 (40) hide show
  1. package/lib/index.d.ts +3 -4
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +1 -2
  4. package/lib/index.js.map +1 -1
  5. package/lib/index.ts +5 -7
  6. package/lib/interfaces/ITracer.d.ts.map +1 -1
  7. package/lib/interfaces/ITracer.js.map +1 -1
  8. package/lib/interfaces/ITracer.ts +8 -2
  9. package/lib/services/ArrayService.d.ts.map +1 -1
  10. package/lib/services/ArrayService.js.map +1 -1
  11. package/lib/services/ArrayService.ts +4 -1
  12. package/lib/services/DateService/DateService.d.ts.map +1 -1
  13. package/lib/services/DateService/DateService.js +3 -1
  14. package/lib/services/DateService/DateService.js.map +1 -1
  15. package/lib/services/DateService/DateService.spec.ts +98 -0
  16. package/lib/services/DateService/DateService.ts +25 -7
  17. package/lib/services/DependencyService.d.ts.map +1 -1
  18. package/lib/services/DependencyService.js +3 -1
  19. package/lib/services/DependencyService.js.map +1 -1
  20. package/lib/services/DependencyService.ts +32 -10
  21. package/lib/services/FileSystemService/FileSystemService.d.ts +12 -38
  22. package/lib/services/FileSystemService/FileSystemService.d.ts.map +1 -1
  23. package/lib/services/FileSystemService/FileSystemService.js +26 -83
  24. package/lib/services/FileSystemService/FileSystemService.js.map +1 -1
  25. package/lib/services/FileSystemService/FileSystemService.spec.ts +133 -0
  26. package/lib/services/FileSystemService/FileSystemService.ts +53 -138
  27. package/lib/services/PackageService.d.ts +4 -60
  28. package/lib/services/PackageService.d.ts.map +1 -1
  29. package/lib/services/PackageService.js +43 -182
  30. package/lib/services/PackageService.js.map +1 -1
  31. package/lib/services/PackageService.ts +119 -241
  32. package/lib/utils/ErrorUtils.d.ts.map +1 -1
  33. package/lib/utils/ErrorUtils.js.map +1 -1
  34. package/lib/utils/ErrorUtils.ts +3 -1
  35. package/package.json +1 -1
  36. package/lib/services/FileSystemService/GlobMatchingService.d.ts +0 -48
  37. package/lib/services/FileSystemService/GlobMatchingService.d.ts.map +0 -1
  38. package/lib/services/FileSystemService/GlobMatchingService.js +0 -129
  39. package/lib/services/FileSystemService/GlobMatchingService.js.map +0 -1
  40. package/lib/services/FileSystemService/GlobMatchingService.ts +0 -153
@@ -22,187 +22,61 @@ export default class PackageService {
22
22
  * project has any pending changes first, then update the version of the
23
23
  * jsr.json to match the package.json file, then run the
24
24
  * `jsr publish --dry-run` command, and finally cleanup the changes made.
25
- *
26
- * @param alternativePackageNames Optional array of alternative package names to validate publishing under
27
- *
28
- * **Warning:** This method uses simple string replacement for package names, which may have unintended effects
29
- * if the package name appears in unexpected places. Use with caution.
30
25
  */
31
- static async validateJsrPublish(alternativePackageNames?: string[]): Promise<void> {
26
+ static async validateJsrPublish(): Promise<void> {
32
27
  if (await FileSystemService.hasPendingChanges()) {
33
28
  DR.logger.error('Please commit or stash your changes before publishing.');
34
29
  process.exit(1);
35
30
  }
31
+ await PackageService.replaceMonorepoImportsWithNpmSpecifiers();
32
+ const { packageName, version: currentVersion } =
33
+ await PackageService.updateJsrFromPackageJson();
34
+ const successfulDryRun = await PackageService.publishJsrDryRun(
35
+ packageName,
36
+ currentVersion
37
+ );
38
+ await PackageService.revertGitChanges();
36
39
 
37
- const { packageName: originalPackageName } = await PackageService.getPackageInfo();
38
- const packageNamesToValidate = [originalPackageName, ...(alternativePackageNames || [])];
39
-
40
- for (const packageName of packageNamesToValidate) {
41
- const isAlternativeName = packageName !== originalPackageName;
42
-
43
- DR.logger.info(`Validating JSR publishing for package: ${packageName}`);
44
-
45
- if (isAlternativeName) {
46
- await PackageService.replacePackageName(originalPackageName, packageName);
47
- }
48
-
49
- await PackageService.replaceMonorepoImportsWithNpmSpecifiers();
50
- const { version: currentVersion } = await PackageService.updateJsrFromPackageJson();
51
- const successfulDryRun = await PackageService.publishJsrDryRun(packageName, currentVersion);
52
-
53
- await PackageService.resetGitChanges();
54
-
55
- if (!successfulDryRun) {
56
- process.exit(1);
57
- }
40
+ if (!successfulDryRun) {
41
+ process.exit(1);
42
+ } else {
43
+ DR.logger.success('Successfully validated JSR publishing.');
58
44
  }
59
-
60
- DR.logger.success('Successfully validated JSR publishing for all package names.');
61
45
  }
62
46
 
63
- /**
64
- * Publishes the current project to JSR.
65
- *
66
- * @param alternativePackageNames Optional array of alternative package names to publish under
67
- *
68
- * **Warning:** This method uses simple string replacement for package names, which may have unintended effects
69
- * if the package name appears in unexpected places. Use with caution.
70
- */
71
- static async publishToJsr(alternativePackageNames?: string[]): Promise<void> {
47
+ static async publishToJsr(): Promise<void> {
72
48
  if (await FileSystemService.hasPendingChanges()) {
73
49
  DR.logger.error('Please commit or stash your changes before publishing.');
74
50
  process.exit(1);
75
51
  }
52
+ await PackageService.replaceMonorepoImportsWithNpmSpecifiers();
53
+ await PackageService.updateJsrFromPackageJson();
54
+ const result = await PackageService.publishJsr();
55
+ await PackageService.revertGitChanges();
76
56
 
77
- const { packageName: originalPackageName } = await PackageService.getPackageInfo();
78
- const packageNamesToPublish = [originalPackageName, ...(alternativePackageNames || [])];
79
-
80
- for (const packageName of packageNamesToPublish) {
81
- const isAlternativeName = packageName !== originalPackageName;
82
-
83
- DR.logger.info(`Publishing to JSR for package: ${packageName}`);
84
-
85
- if (isAlternativeName) {
86
- await PackageService.replacePackageName(originalPackageName, packageName);
87
- }
88
-
89
- await PackageService.replaceMonorepoImportsWithNpmSpecifiers();
90
- await PackageService.updateJsrFromPackageJson();
91
- const result = await PackageService.publishJsr();
92
-
93
- await PackageService.resetGitChanges();
94
-
95
- if (!result) {
96
- process.exit(1);
97
- }
57
+ if (!result) {
58
+ process.exit(1);
59
+ } else {
60
+ DR.logger.success('Successfully published to JSR.');
98
61
  }
99
-
100
- DR.logger.success('Successfully published to JSR for all package names.');
101
62
  }
102
63
 
103
64
  /**
104
65
  * Validates the current project for publishing to npm. This will run
105
66
  * `npm publish --access public --dry-run` and check for version conflicts
106
67
  * on the npm registry.
107
- *
108
- * @param alternativePackageNames Optional array of alternative package names to validate publishing under
109
- *
110
- * **Warning:** This method uses simple string replacement for package names, which may have unintended effects
111
- * if the package name appears in unexpected places. Use with caution.
112
68
  */
113
- static async validateNpmPublish(alternativePackageNames?: string[]): Promise<void> {
114
- if (await FileSystemService.hasPendingChanges()) {
115
- DR.logger.error('Please commit or stash your changes before publishing.');
116
- process.exit(1);
117
- }
118
-
119
- const { packageName: originalPackageName, version: currentVersion } =
69
+ static async validateNpmPublish(): Promise<void> {
70
+ const { packageName, version: currentVersion } =
120
71
  await PackageService.getPackageInfo();
121
- const packageNamesToValidate = [originalPackageName, ...(alternativePackageNames || [])];
122
-
123
- for (const packageName of packageNamesToValidate) {
124
- const isAlternativeName = packageName !== originalPackageName;
125
-
126
- DR.logger.info(`Validating npm publishing for package: ${packageName}`);
127
-
128
- if (isAlternativeName) {
129
- await PackageService.replacePackageName(originalPackageName, packageName);
130
- }
131
-
132
- const successfulDryRun = await PackageService.publishNpmDryRun();
133
- if (!successfulDryRun) {
134
- if (isAlternativeName) {
135
- await PackageService.resetGitChanges();
136
- }
137
- process.exit(1);
138
- }
139
-
140
- await PackageService.checkNpmVersionConflicts(packageName, currentVersion);
141
-
142
- if (isAlternativeName) {
143
- await PackageService.resetGitChanges();
144
- }
145
- }
146
-
147
- DR.logger.success('Successfully validated npm publishing for all package names.');
148
- }
149
72
 
150
- /**
151
- * Publishes the current project to npm.
152
- *
153
- * @param alternativePackageNames Optional array of alternative package names to publish under
154
- *
155
- * **Warning:** This method uses simple string replacement for package names, which may have unintended effects
156
- * if the package name appears in unexpected places. Use with caution.
157
- */
158
- static async publishToNpm(alternativePackageNames?: string[]): Promise<void> {
159
- if (await FileSystemService.hasPendingChanges()) {
160
- DR.logger.error('Please commit or stash your changes before publishing.');
73
+ const successfulDryRun = await PackageService.publishNpmDryRun();
74
+ if (!successfulDryRun) {
161
75
  process.exit(1);
162
76
  }
163
77
 
164
- const { packageName: originalPackageName } = await PackageService.getPackageInfo();
165
- const packageNamesToPublish = [originalPackageName, ...(alternativePackageNames || [])];
166
-
167
- for (const packageName of packageNamesToPublish) {
168
- const isAlternativeName = packageName !== originalPackageName;
169
-
170
- DR.logger.info(`Publishing to npm for package: ${packageName}`);
171
-
172
- if (isAlternativeName) {
173
- await PackageService.replacePackageName(originalPackageName, packageName);
174
- }
175
-
176
- const result = await PackageService.publishNpm();
177
-
178
- if (isAlternativeName) {
179
- await PackageService.resetGitChanges();
180
- }
181
-
182
- if (!result) {
183
- process.exit(1);
184
- }
185
- }
186
-
187
- DR.logger.success('Successfully published to npm for all package names.');
188
- }
189
-
190
- /**
191
- * Test method for string replacement functionality. This method allows testing
192
- * the string replacement behavior without performing actual publishing operations.
193
- *
194
- * @param originalString The original string to replace
195
- * @param newString The new string to replace it with
196
- *
197
- * **Warning:** This method uses simple string replacement, which may have unintended effects
198
- * if the string appears in unexpected places. Use with caution.
199
- */
200
- static async testStringReplacement(originalString: string, newString: string): Promise<void> {
201
- DR.logger.info(`Testing string replacement from "${originalString}" to "${newString}"`);
202
-
203
- await PackageService.replacePackageName(originalString, newString);
204
-
205
- DR.logger.info('Test completed - package name replacement has been applied');
78
+ await PackageService.checkNpmVersionConflicts(packageName, currentVersion);
79
+ DR.logger.success('Successfully validated npm publishing.');
206
80
  }
207
81
 
208
82
  /**
@@ -227,7 +101,9 @@ export default class PackageService {
227
101
 
228
102
  try {
229
103
  const { packageName, version } = await PackageService.getPackageInfo();
230
- const packageJsonData = JSON.parse(await readFile(packageJsonPath, 'utf-8')) as PackageJson;
104
+ const packageJsonData = JSON.parse(
105
+ await readFile(packageJsonPath, 'utf-8')
106
+ ) as PackageJson;
231
107
  const jsrJsonData = JSON.parse(
232
108
  await readFile(jsrJsonPath, 'utf-8')
233
109
  ) as JsonWithVersionProperty;
@@ -236,10 +112,15 @@ export default class PackageService {
236
112
  jsrJsonData.version = version;
237
113
 
238
114
  // Resolve wildcard dependencies in package.json for JSR compatibility
239
- await this.resolveWildcardDependenciesInPackageJson(packageJsonData, packageJsonPath);
115
+ await this.resolveWildcardDependenciesInPackageJson(
116
+ packageJsonData,
117
+ packageJsonPath
118
+ );
240
119
 
241
120
  await writeFile(jsrJsonPath, JSON.stringify(jsrJsonData, null, 2));
242
- DR.logger.info('Updated jsr.json from package.json to version ' + version);
121
+ DR.logger.info(
122
+ 'Updated jsr.json from package.json to version ' + version
123
+ );
243
124
 
244
125
  return {
245
126
  packageName,
@@ -247,7 +128,9 @@ export default class PackageService {
247
128
  };
248
129
  } catch (error) {
249
130
  const errorString = ErrorUtils.getErrorString(error);
250
- DR.logger.error(`Failed to update jsr.json from package.json: ${errorString}`);
131
+ DR.logger.error(
132
+ `Failed to update jsr.json from package.json: ${errorString}`
133
+ );
251
134
  throw error;
252
135
  }
253
136
  }
@@ -269,13 +152,16 @@ export default class PackageService {
269
152
  const childPackages = await DependencyService.getChildPackageJsons('../');
270
153
 
271
154
  // Helper function to resolve dependencies
272
- const resolveDependencies = (deps: Record<string, string> | undefined): void => {
155
+ const resolveDependencies = (
156
+ deps: Record<string, string> | undefined
157
+ ): void => {
273
158
  if (!deps) return;
274
159
 
275
160
  for (const [depName, depVersion] of Object.entries(deps)) {
276
161
  if (depVersion === '*' && depName in childPackages) {
277
162
  // Replace wildcard with "*" + actual version from the monorepo
278
- deps[depName] = `*${childPackages[depName].packageJsonContents.version}`;
163
+ deps[depName] =
164
+ `*${childPackages[depName].packageJsonContents.version}`;
279
165
  }
280
166
  }
281
167
  };
@@ -287,12 +173,19 @@ export default class PackageService {
287
173
  resolveDependencies(packageJsonData.optionalDependencies);
288
174
 
289
175
  // Write the updated package.json
290
- await writeFile(packageJsonPath, JSON.stringify(packageJsonData, null, 2));
176
+ await writeFile(
177
+ packageJsonPath,
178
+ JSON.stringify(packageJsonData, null, 2)
179
+ );
291
180
 
292
- DR.logger.info('Resolved wildcard dependencies in package.json for JSR compatibility');
181
+ DR.logger.info(
182
+ 'Resolved wildcard dependencies in package.json for JSR compatibility'
183
+ );
293
184
  } catch (error) {
294
185
  const errorString = ErrorUtils.getErrorString(error);
295
- DR.logger.error(`Failed to resolve wildcard dependencies: ${errorString}`);
186
+ DR.logger.error(
187
+ `Failed to resolve wildcard dependencies: ${errorString}`
188
+ );
296
189
  throw error;
297
190
  }
298
191
  }
@@ -315,13 +208,17 @@ export default class PackageService {
315
208
 
316
209
  DR.logger.info('Running `jsr publish --dry-run`');
317
210
  try {
318
- const { stdout, stderr } = await execAsync('jsr publish --allow-dirty --dry-run');
211
+ const { stdout, stderr } = await execAsync(
212
+ 'jsr publish --allow-dirty --dry-run'
213
+ );
319
214
  if (stderr) {
320
215
  DR.logger.info(stderr);
321
216
  }
322
217
  DR.logger.info(stdout);
323
218
  } catch (error) {
324
- DR.logger.error(`Failed to run 'jsr publish --dry-run': ${ErrorUtils.getErrorString(error)}`);
219
+ DR.logger.error(
220
+ `Failed to run 'jsr publish --dry-run': ${ErrorUtils.getErrorString(error)}`
221
+ );
325
222
  return false;
326
223
  }
327
224
  return true;
@@ -369,7 +266,9 @@ export default class PackageService {
369
266
  }
370
267
 
371
268
  try {
372
- const packageJsonData = JSON.parse(await readFile(packageJsonPath, 'utf-8')) as PackageJson;
269
+ const packageJsonData = JSON.parse(
270
+ await readFile(packageJsonPath, 'utf-8')
271
+ ) as PackageJson;
373
272
 
374
273
  return {
375
274
  packageName: packageJsonData.name,
@@ -410,7 +309,9 @@ export default class PackageService {
410
309
  packageName: string,
411
310
  currentVersion: string
412
311
  ): Promise<void> {
413
- DR.logger.info(`Checking npm registry for existing versions of ${packageName}...`);
312
+ DR.logger.info(
313
+ `Checking npm registry for existing versions of ${packageName}...`
314
+ );
414
315
 
415
316
  try {
416
317
  const { stdout } = await execAsync(`npm view ${packageName}`);
@@ -419,19 +320,28 @@ export default class PackageService {
419
320
  const latestVersionMatch = stdout.match(/latest:\s*([^\s|]+)/);
420
321
  if (latestVersionMatch) {
421
322
  const latestVersion = latestVersionMatch[1];
422
- PackageService.checkVersionConflict(currentVersion, latestVersion, 'npm');
323
+ PackageService.checkVersionConflict(
324
+ currentVersion,
325
+ latestVersion,
326
+ 'npm'
327
+ );
423
328
  }
424
329
  } catch (error) {
425
330
  const errorString = ErrorUtils.getErrorString(error);
426
331
 
427
332
  // If the package doesn't exist on npm, that's fine for first publish
428
333
  if (errorString.includes('404') || errorString.includes('not found')) {
429
- DR.logger.info('Package not found on npm - this appears to be a first publish.');
334
+ DR.logger.info(
335
+ 'Package not found on npm - this appears to be a first publish.'
336
+ );
430
337
  return;
431
338
  }
432
339
 
433
340
  // Re-throw version conflict errors
434
- if (errorString.includes('already exists') || errorString.includes('is lower than')) {
341
+ if (
342
+ errorString.includes('already exists') ||
343
+ errorString.includes('is lower than')
344
+ ) {
435
345
  throw error;
436
346
  }
437
347
 
@@ -505,7 +415,9 @@ export default class PackageService {
505
415
  // Get all TypeScript files in the src directory
506
416
  const allFiles = await FileSystemService.getAllFilePathsRelative(srcDir);
507
417
  const tsFiles = allFiles
508
- .filter((filePath) => filePath.endsWith('.ts') && !filePath.endsWith('.spec.ts'))
418
+ .filter(
419
+ (filePath) => filePath.endsWith('.ts') && !filePath.endsWith('.spec.ts')
420
+ )
509
421
  .map((filePath) => path.join(srcDir, filePath));
510
422
 
511
423
  DR.logger.info(
@@ -547,7 +459,9 @@ export default class PackageService {
547
459
  );
548
460
  }
549
461
  } catch (error) {
550
- DR.logger.error(`Failed to process file ${filePath}: ${ErrorUtils.getErrorString(error)}`);
462
+ DR.logger.error(
463
+ `Failed to process file ${filePath}: ${ErrorUtils.getErrorString(error)}`
464
+ );
551
465
  }
552
466
  }
553
467
 
@@ -556,6 +470,19 @@ export default class PackageService {
556
470
  );
557
471
  }
558
472
 
473
+ private static async revertGitChanges(): Promise<void> {
474
+ DR.logger.info(
475
+ 'Reverting changes made to jsr.json, package.json, and source files'
476
+ );
477
+ try {
478
+ await execAsync('git checkout -- jsr.json package.json src/');
479
+ } catch (error) {
480
+ DR.logger.error(
481
+ `Failed to revert changes: ${ErrorUtils.getErrorString(error)}`
482
+ );
483
+ }
484
+ }
485
+
559
486
  /**
560
487
  * Checks for version conflicts on JSR by looking up the current package
561
488
  * and comparing versions. Throws an error if the current version already
@@ -578,19 +505,31 @@ export default class PackageService {
578
505
  if (latestVersionMatch) {
579
506
  const latestVersion = latestVersionMatch[1];
580
507
 
581
- PackageService.checkVersionConflict(currentVersion, latestVersion, 'JSR');
508
+ PackageService.checkVersionConflict(
509
+ currentVersion,
510
+ latestVersion,
511
+ 'JSR'
512
+ );
582
513
  }
583
514
  } catch (error) {
584
515
  const errorString = ErrorUtils.getErrorString(error);
585
516
 
586
517
  // If the package doesn't exist on JSR, that's fine for first publish
587
- if (errorString.includes('Package not found') || errorString.includes('404')) {
588
- DR.logger.info('Package not found on JSR - this appears to be a first publish.');
518
+ if (
519
+ errorString.includes('Package not found') ||
520
+ errorString.includes('404')
521
+ ) {
522
+ DR.logger.info(
523
+ 'Package not found on JSR - this appears to be a first publish.'
524
+ );
589
525
  return;
590
526
  }
591
527
 
592
528
  // Re-throw version conflict errors
593
- if (errorString.includes('already exists') || errorString.includes('is lower than')) {
529
+ if (
530
+ errorString.includes('already exists') ||
531
+ errorString.includes('is lower than')
532
+ ) {
594
533
  throw error;
595
534
  }
596
535
 
@@ -616,7 +555,10 @@ export default class PackageService {
616
555
  );
617
556
 
618
557
  // Compare versions using semver-like comparison
619
- const comparison = StringService.compareSemanticVersions(currentVersion, latestVersion);
558
+ const comparison = StringService.compareSemanticVersions(
559
+ currentVersion,
560
+ latestVersion
561
+ );
620
562
 
621
563
  if (comparison === 0) {
622
564
  throw new Error(
@@ -630,68 +572,4 @@ export default class PackageService {
630
572
 
631
573
  DR.logger.info('Version check passed - ready to publish.');
632
574
  }
633
-
634
- /**
635
- * Replaces the package name in package.json and jsr.json files with a new name.
636
- * Uses FileSystemService.replaceInFiles to perform the replacement.
637
- *
638
- * @param originalPackageName The original package name to replace
639
- * @param newPackageName The new package name to use
640
- */
641
- private static async replacePackageName(
642
- originalPackageName: string,
643
- newPackageName: string
644
- ): Promise<void> {
645
- DR.logger.info(`Replacing package name from "${originalPackageName}" to "${newPackageName}"`);
646
-
647
- const rootDir = process.cwd();
648
-
649
- // Replace in package.json and jsr.json files
650
- await FileSystemService.replaceInFiles({
651
- searchString: originalPackageName,
652
- replaceString: newPackageName,
653
- rootPath: rootDir,
654
- includePatterns: ['package.json', 'jsr.json'],
655
- excludePatterns: []
656
- });
657
-
658
- DR.logger.info(`Successfully replaced package name in configuration files`);
659
- }
660
-
661
- /**
662
- * Performs a git reset to discard all changes in the working directory.
663
- * This is used between alternative package name operations.
664
- */
665
- private static async resetGitChanges(): Promise<void> {
666
- DR.logger.info('Resetting git changes');
667
- try {
668
- await execAsync('git reset --hard HEAD');
669
- } catch (error) {
670
- DR.logger.error(`Failed to reset git changes: ${ErrorUtils.getErrorString(error)}`);
671
- throw error;
672
- }
673
- }
674
-
675
- /**
676
- * Publishes the current project to npm.
677
- *
678
- * @returns true if the publish was successful, false otherwise.
679
- */
680
- private static async publishNpm(): Promise<boolean> {
681
- DR.logger.info('Running `npm publish --access public`');
682
- return new Promise((resolve) => {
683
- const child = spawn('npm publish', ['--access', 'public'], {
684
- stdio: 'inherit',
685
- shell: true
686
- });
687
-
688
- child.on('exit', (code) => {
689
- if (code === 0) {
690
- resolve(true);
691
- } else {
692
- resolve(false);
693
- }
694
- });
695
- });
696
- }
697
575
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM;IAQlE;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAI/D;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAS9C"}
1
+ {"version":3,"file":"ErrorUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM;IAUlE;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAI/D;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAS9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorUtils.js","sourceRoot":"","sources":["../../src/utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,eAAuB;QAChE,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,WAAW,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QACrC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,YAAoB,EAAE,eAAuB;QAC7D,UAAU,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAc;QAClC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"ErrorUtils.js","sourceRoot":"","sources":["../../src/utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,eAAuB;QAChE,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,WAAW,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QACrC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAC5D,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,YAAoB,EAAE,eAAuB;QAC7D,UAAU,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAc;QAClC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
@@ -13,7 +13,9 @@ export default class ErrorUtils {
13
13
  for (let i = 0; i < errorList.length; i += 1) {
14
14
  errorString += `${errorList[i]}\n`;
15
15
  }
16
- throw new Error(`${errorString}${JSON.stringify(erroneousObject, null, 2)}`);
16
+ throw new Error(
17
+ `${errorString}${JSON.stringify(erroneousObject, null, 2)}`
18
+ );
17
19
  }
18
20
 
19
21
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aneuhold/core-ts-lib",
3
3
  "author": "Anton G. Neuhold Jr.",
4
4
  "license": "MIT",
5
- "version": "2.2.6",
5
+ "version": "2.2.7",
6
6
  "description": "A core library for all of my TypeScript projects",
7
7
  "type": "module",
8
8
  "scripts": {
@@ -1,48 +0,0 @@
1
- /**
2
- * A service for handling glob-like pattern matching operations.
3
- * Supports common glob patterns like **, *, and exact matches.
4
- *
5
- * Inspired by the isaacs/node-glob library (ISC License)
6
- * but simplified for basic use cases.
7
- */
8
- export default class GlobMatchingService {
9
- /**
10
- * Gets files matching the include patterns while excluding those that match exclude patterns.
11
- * Uses simple glob-like matching for common patterns.
12
- *
13
- * @param allFiles Array of all file paths to filter
14
- * @param rootPath The root directory path for computing relative paths
15
- * @param includePatterns Array of glob-like patterns to include
16
- * @param excludePatterns Array of glob-like patterns to exclude
17
- */
18
- static getMatchingFiles(allFiles: string[], rootPath: string, includePatterns: string[], excludePatterns: string[]): string[];
19
- /**
20
- * Simple glob-like pattern matching for common use cases.
21
- * Supports:
22
- * - ** for any number of directories (globstar)
23
- * - * for any characters except path separators
24
- * - Exact matches
25
- *
26
- * @param filePath The file path to test
27
- * @param pattern The pattern to match against
28
- */
29
- static matchesPattern(filePath: string, pattern: string): boolean;
30
- /**
31
- * Match path segments against pattern segments with support for globstar (**).
32
- *
33
- * The idea is that each segment doesn't cross path separators. It should
34
- * be split by '/' and then matched segment by segment.
35
- *
36
- * @param pathSegments Array of path segments
37
- * @param patternSegments Array of pattern segments
38
- */
39
- private static matchSegments;
40
- /**
41
- * Match a single segment with support for * wildcard
42
- *
43
- * @param pathSegment Single path segment
44
- * @param patternSegment Single pattern segment
45
- */
46
- private static matchSingleSegment;
47
- }
48
- //# sourceMappingURL=GlobMatchingService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GlobMatchingService.d.ts","sourceRoot":"","sources":["../../../src/services/FileSystemService/GlobMatchingService.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC;;;;;;;;OAQG;IACH,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EAAE,EACzB,eAAe,EAAE,MAAM,EAAE,GACxB,MAAM,EAAE;IAcX;;;;;;;;;OASG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAiBjE;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAuD5B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAiBlC"}