@aneuhold/core-ts-lib 2.0.10 → 2.1.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 (43) hide show
  1. package/lib/index.d.ts +5 -3
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +2 -2
  4. package/lib/index.js.map +1 -1
  5. package/lib/index.ts +6 -3
  6. package/lib/interfaces/ILogger.d.ts +48 -0
  7. package/lib/interfaces/ILogger.d.ts.map +1 -0
  8. package/lib/interfaces/ILogger.js +15 -0
  9. package/lib/interfaces/ILogger.js.map +1 -0
  10. package/lib/interfaces/ILogger.ts +55 -0
  11. package/lib/interfaces/ITracer.d.ts +79 -0
  12. package/lib/interfaces/ITracer.d.ts.map +1 -0
  13. package/lib/interfaces/ITracer.js +32 -0
  14. package/lib/interfaces/ITracer.js.map +1 -0
  15. package/lib/interfaces/ITracer.ts +102 -0
  16. package/lib/services/DependencyRegistry.d.ts +43 -0
  17. package/lib/services/DependencyRegistry.d.ts.map +1 -0
  18. package/lib/services/DependencyRegistry.js +52 -0
  19. package/lib/services/DependencyRegistry.js.map +1 -0
  20. package/lib/services/DependencyRegistry.ts +58 -0
  21. package/lib/services/DependencyService.js +4 -4
  22. package/lib/services/DependencyService.js.map +1 -1
  23. package/lib/services/DependencyService.ts +4 -4
  24. package/lib/services/FileSystemService/FileSystemService.d.ts +8 -0
  25. package/lib/services/FileSystemService/FileSystemService.d.ts.map +1 -1
  26. package/lib/services/FileSystemService/FileSystemService.js +16 -8
  27. package/lib/services/FileSystemService/FileSystemService.js.map +1 -1
  28. package/lib/services/FileSystemService/FileSystemService.ts +16 -8
  29. package/lib/services/PackageService.js +16 -16
  30. package/lib/services/PackageService.js.map +1 -1
  31. package/lib/services/PackageService.ts +16 -16
  32. package/lib/utils/ConsoleLogger.d.ts +101 -0
  33. package/lib/utils/ConsoleLogger.d.ts.map +1 -0
  34. package/lib/utils/ConsoleLogger.js +146 -0
  35. package/lib/utils/ConsoleLogger.js.map +1 -0
  36. package/lib/utils/ConsoleLogger.ts +161 -0
  37. package/package.json +9 -9
  38. package/readme.md +6 -3
  39. package/lib/utils/Logger.d.ts +0 -95
  40. package/lib/utils/Logger.d.ts.map +0 -1
  41. package/lib/utils/Logger.js +0 -136
  42. package/lib/utils/Logger.js.map +0 -1
  43. package/lib/utils/Logger.ts +0 -146
@@ -1,7 +1,7 @@
1
1
  import { access, readFile, writeFile } from 'fs/promises';
2
2
  import path from 'path';
3
3
  import ErrorUtils from '../utils/ErrorUtils.js';
4
- import Logger from '../utils/Logger.js';
4
+ import { DR } from './DependencyRegistry.js';
5
5
  import FileSystemService from './FileSystemService/FileSystemService.js';
6
6
 
7
7
  export interface PackageJson extends JsonWithVersionProperty {
@@ -125,7 +125,7 @@ export default class DependencyService {
125
125
  try {
126
126
  await access(filePath);
127
127
  } catch {
128
- Logger.info(
128
+ DR.logger.info(
129
129
  `No ${path.basename(filePath)} file found in the current directory.`
130
130
  );
131
131
  return;
@@ -139,12 +139,12 @@ export default class DependencyService {
139
139
  const newVersion = bump(oldVersion);
140
140
  fileData.version = newVersion;
141
141
  await writeFile(filePath, JSON.stringify(fileData, null, 2));
142
- Logger.info(
142
+ DR.logger.info(
143
143
  `Bumped ${path.basename(filePath)} from ${oldVersion} to ${newVersion}`
144
144
  );
145
145
  } catch (error) {
146
146
  const errorString = ErrorUtils.getErrorString(error);
147
- Logger.error(
147
+ DR.logger.error(
148
148
  `Failed to update ${path.basename(filePath)}: ${errorString}`
149
149
  );
150
150
  }
@@ -10,11 +10,15 @@ export default class FileSystemService {
10
10
  *
11
11
  * @param folderPath the path to the folder which contains the file that should
12
12
  * be updated
13
+ * @param fileName
14
+ * @param textToInsert
13
15
  */
14
16
  static findAndInsertText(folderPath: string, fileName: string, textToInsert: string): Promise<void>;
15
17
  /**
16
18
  * Copies the contents of one folder to another folder.
17
19
  *
20
+ * @param sourceFolderPath
21
+ * @param targetFolderPath
18
22
  * @param ignoreExtensions is an array with extensions that should be
19
23
  * ignored. For example, if you want to ignore all .ts files, you would pass
20
24
  * in ['ts'].
@@ -28,6 +32,8 @@ export default class FileSystemService {
28
32
  * the directory path provided.
29
33
  *
30
34
  * If only relative file paths are needed, use {@link getAllFilePathsRelative}.
35
+ *
36
+ * @param dirPath
31
37
  */
32
38
  static getAllFilePaths(dirPath: string): Promise<string[]>;
33
39
  /**
@@ -36,6 +42,8 @@ export default class FileSystemService {
36
42
  * include the directory path provided.
37
43
  *
38
44
  * If absolute file paths are needed, use {@link getAllFilePaths}.
45
+ *
46
+ * @param dirPath
39
47
  */
40
48
  static getAllFilePathsRelative(dirPath: string): Promise<string[]>;
41
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystemService.d.ts","sourceRoot":"./src/","sources":["services/FileSystemService/FileSystemService.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;;;;OAOG;WACU,iBAAiB,CAC5B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;IAsBhB;;;;;;OAMG;WACU,kBAAkB,CAC7B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;WAmCH,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAWtD,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5D;;;;;;OAMG;WACU,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAoBhE;;;;;;OAMG;WACU,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAOxE;;;;;OAKG;WACU,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;CAWnD"}
1
+ {"version":3,"file":"FileSystemService.d.ts","sourceRoot":"./src/","sources":["services/FileSystemService/FileSystemService.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;;;;;;OASG;WACU,iBAAiB,CAC5B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;IAsBhB;;;;;;;;OAQG;WACU,kBAAkB,CAC7B,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC;WAmCH,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAWtD,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5D;;;;;;;;OAQG;WACU,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAoBhE;;;;;;;;OAQG;WACU,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAOxE;;;;;OAKG;WACU,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;CAWnD"}
@@ -3,7 +3,7 @@ import { access, appendFile, cp, mkdir, readFile, readdir, rm, stat, writeFile }
3
3
  import path from 'path';
4
4
  import { promisify } from 'util';
5
5
  import ErrorUtils from '../../utils/ErrorUtils.js';
6
- import Logger from '../../utils/Logger.js';
6
+ import { DR } from '../DependencyRegistry.js';
7
7
  import StringService from '../StringService.js';
8
8
  const execAsync = promisify(exec);
9
9
  /**
@@ -18,6 +18,8 @@ export default class FileSystemService {
18
18
  *
19
19
  * @param folderPath the path to the folder which contains the file that should
20
20
  * be updated
21
+ * @param fileName
22
+ * @param textToInsert
21
23
  */
22
24
  static async findAndInsertText(folderPath, fileName, textToInsert) {
23
25
  const filePath = path.join(folderPath, fileName);
@@ -27,20 +29,22 @@ export default class FileSystemService {
27
29
  const fileContents = await readFile(filePath);
28
30
  if (!fileContents.includes(textToInsert)) {
29
31
  await appendFile(filePath, `\n${textToInsert}`);
30
- Logger.info(`Added "${textToInsert}" to "${filePath}"`);
32
+ DR.logger.info(`Added "${textToInsert}" to "${filePath}"`);
31
33
  }
32
34
  else {
33
- Logger.info(`"${textToInsert}" already exists in "${filePath}"`);
35
+ DR.logger.info(`"${textToInsert}" already exists in "${filePath}"`);
34
36
  }
35
37
  }
36
38
  catch {
37
- Logger.info(`File at "${filePath}" didn't exist. Creating it now and adding "${textToInsert}" to it.`);
39
+ DR.logger.info(`File at "${filePath}" didn't exist. Creating it now and adding "${textToInsert}" to it.`);
38
40
  await writeFile(filePath, textToInsert);
39
41
  }
40
42
  }
41
43
  /**
42
44
  * Copies the contents of one folder to another folder.
43
45
  *
46
+ * @param sourceFolderPath
47
+ * @param targetFolderPath
44
48
  * @param ignoreExtensions is an array with extensions that should be
45
49
  * ignored. For example, if you want to ignore all .ts files, you would pass
46
50
  * in ['ts'].
@@ -51,7 +55,7 @@ export default class FileSystemService {
51
55
  await access(sourceFolderPath);
52
56
  }
53
57
  catch {
54
- Logger.error(`Source directory "${sourceFolderPath}" does not exist.`);
58
+ DR.logger.error(`Source directory "${sourceFolderPath}" does not exist.`);
55
59
  return;
56
60
  }
57
61
  await FileSystemService.checkOrCreateFolder(targetFolderPath);
@@ -74,7 +78,7 @@ export default class FileSystemService {
74
78
  await access(folderPath);
75
79
  }
76
80
  catch {
77
- Logger.verbose.info(`Directory "${folderPath}" does not exist. Creating it now...`);
81
+ DR.logger.verbose.info(`Directory "${folderPath}" does not exist. Creating it now...`);
78
82
  await mkdir(folderPath, { recursive: true });
79
83
  }
80
84
  }
@@ -83,7 +87,7 @@ export default class FileSystemService {
83
87
  await access(folderPath);
84
88
  }
85
89
  catch {
86
- Logger.error(`Directory "${folderPath}" does not exist.`);
90
+ DR.logger.error(`Directory "${folderPath}" does not exist.`);
87
91
  return;
88
92
  }
89
93
  await rm(folderPath, { recursive: true });
@@ -94,6 +98,8 @@ export default class FileSystemService {
94
98
  * the directory path provided.
95
99
  *
96
100
  * If only relative file paths are needed, use {@link getAllFilePathsRelative}.
101
+ *
102
+ * @param dirPath
97
103
  */
98
104
  static async getAllFilePaths(dirPath) {
99
105
  const filePaths = [];
@@ -116,6 +122,8 @@ export default class FileSystemService {
116
122
  * include the directory path provided.
117
123
  *
118
124
  * If absolute file paths are needed, use {@link getAllFilePaths}.
125
+ *
126
+ * @param dirPath
119
127
  */
120
128
  static async getAllFilePathsRelative(dirPath) {
121
129
  const filePaths = await this.getAllFilePaths(dirPath);
@@ -135,7 +143,7 @@ export default class FileSystemService {
135
143
  return stdout.trim().length > 0;
136
144
  }
137
145
  catch (error) {
138
- Logger.error(`Failed to check for pending changes: ${ErrorUtils.getErrorString(error)}`);
146
+ DR.logger.error(`Failed to check for pending changes: ${ErrorUtils.getErrorString(error)}`);
139
147
  return false;
140
148
  }
141
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystemService.js","sourceRoot":"./src/","sources":["services/FileSystemService/FileSystemService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EACL,MAAM,EACN,UAAU,EACV,EAAE,EACF,KAAK,EACL,QAAQ,EACR,OAAO,EACP,EAAE,EACF,IAAI,EACJ,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;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AM,SAAS,CAAC,wBAAwB,CAAC,CAAC;YAC7D,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CACV,wCAAwC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAC3E,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"FileSystemService.js","sourceRoot":"./src/","sources":["services/FileSystemService/FileSystemService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EACL,MAAM,EACN,UAAU,EACV,EAAE,EACF,KAAK,EACL,QAAQ,EACR,OAAO,EACP,EAAE,EACF,IAAI,EACJ,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAC5B,UAAkB,EAClB,QAAgB,EAChB,YAAoB;QAEpB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAM,iBAAiB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAExD,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;YACvB,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC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
13
  import path from 'path';
14
14
  import { promisify } from 'util';
15
15
  import ErrorUtils from '../../utils/ErrorUtils.js';
16
- import Logger from '../../utils/Logger.js';
16
+ import { DR } from '../DependencyRegistry.js';
17
17
  import StringService from '../StringService.js';
18
18
 
19
19
  const execAsync = promisify(exec);
@@ -30,6 +30,8 @@ export default class FileSystemService {
30
30
  *
31
31
  * @param folderPath the path to the folder which contains the file that should
32
32
  * be updated
33
+ * @param fileName
34
+ * @param textToInsert
33
35
  */
34
36
  static async findAndInsertText(
35
37
  folderPath: string,
@@ -45,12 +47,12 @@ export default class FileSystemService {
45
47
  const fileContents = await readFile(filePath);
46
48
  if (!fileContents.includes(textToInsert)) {
47
49
  await appendFile(filePath, `\n${textToInsert}`);
48
- Logger.info(`Added "${textToInsert}" to "${filePath}"`);
50
+ DR.logger.info(`Added "${textToInsert}" to "${filePath}"`);
49
51
  } else {
50
- Logger.info(`"${textToInsert}" already exists in "${filePath}"`);
52
+ DR.logger.info(`"${textToInsert}" already exists in "${filePath}"`);
51
53
  }
52
54
  } catch {
53
- Logger.info(
55
+ DR.logger.info(
54
56
  `File at "${filePath}" didn't exist. Creating it now and adding "${textToInsert}" to it.`
55
57
  );
56
58
  await writeFile(filePath, textToInsert);
@@ -60,6 +62,8 @@ export default class FileSystemService {
60
62
  /**
61
63
  * Copies the contents of one folder to another folder.
62
64
  *
65
+ * @param sourceFolderPath
66
+ * @param targetFolderPath
63
67
  * @param ignoreExtensions is an array with extensions that should be
64
68
  * ignored. For example, if you want to ignore all .ts files, you would pass
65
69
  * in ['ts'].
@@ -73,7 +77,7 @@ export default class FileSystemService {
73
77
  try {
74
78
  await access(sourceFolderPath);
75
79
  } catch {
76
- Logger.error(`Source directory "${sourceFolderPath}" does not exist.`);
80
+ DR.logger.error(`Source directory "${sourceFolderPath}" does not exist.`);
77
81
  return;
78
82
  }
79
83
  await FileSystemService.checkOrCreateFolder(targetFolderPath);
@@ -107,7 +111,7 @@ export default class FileSystemService {
107
111
  try {
108
112
  await access(folderPath);
109
113
  } catch {
110
- Logger.verbose.info(
114
+ DR.logger.verbose.info(
111
115
  `Directory "${folderPath}" does not exist. Creating it now...`
112
116
  );
113
117
  await mkdir(folderPath, { recursive: true });
@@ -118,7 +122,7 @@ export default class FileSystemService {
118
122
  try {
119
123
  await access(folderPath);
120
124
  } catch {
121
- Logger.error(`Directory "${folderPath}" does not exist.`);
125
+ DR.logger.error(`Directory "${folderPath}" does not exist.`);
122
126
  return;
123
127
  }
124
128
  await rm(folderPath, { recursive: true });
@@ -130,6 +134,8 @@ export default class FileSystemService {
130
134
  * the directory path provided.
131
135
  *
132
136
  * If only relative file paths are needed, use {@link getAllFilePathsRelative}.
137
+ *
138
+ * @param dirPath
133
139
  */
134
140
  static async getAllFilePaths(dirPath: string): Promise<string[]> {
135
141
  const filePaths: string[] = [];
@@ -157,6 +163,8 @@ export default class FileSystemService {
157
163
  * include the directory path provided.
158
164
  *
159
165
  * If absolute file paths are needed, use {@link getAllFilePaths}.
166
+ *
167
+ * @param dirPath
160
168
  */
161
169
  static async getAllFilePathsRelative(dirPath: string): Promise<string[]> {
162
170
  const filePaths = await this.getAllFilePaths(dirPath);
@@ -176,7 +184,7 @@ export default class FileSystemService {
176
184
  const { stdout } = await execAsync('git status --porcelain');
177
185
  return stdout.trim().length > 0;
178
186
  } catch (error) {
179
- Logger.error(
187
+ DR.logger.error(
180
188
  `Failed to check for pending changes: ${ErrorUtils.getErrorString(error)}`
181
189
  );
182
190
  return false;
@@ -3,7 +3,7 @@ import { access, readFile, writeFile } from 'fs/promises';
3
3
  import path from 'path';
4
4
  import { promisify } from 'util';
5
5
  import ErrorUtils from '../utils/ErrorUtils.js';
6
- import Logger from '../utils/Logger.js';
6
+ import { DR } from './DependencyRegistry.js';
7
7
  import FileSystemService from './FileSystemService/FileSystemService.js';
8
8
  const execAsync = promisify(exec);
9
9
  /**
@@ -19,7 +19,7 @@ export default class PackageService {
19
19
  */
20
20
  static async validateJsrPublish() {
21
21
  if (await FileSystemService.hasPendingChanges()) {
22
- Logger.error('Please commit or stash your changes before publishing.');
22
+ DR.logger.error('Please commit or stash your changes before publishing.');
23
23
  process.exit(1);
24
24
  }
25
25
  await PackageService.updateJsrFromPackageJson();
@@ -29,12 +29,12 @@ export default class PackageService {
29
29
  process.exit(1);
30
30
  }
31
31
  else {
32
- Logger.success('Successfully validated JSR publishing.');
32
+ DR.logger.success('Successfully validated JSR publishing.');
33
33
  }
34
34
  }
35
35
  static async publishToJsr() {
36
36
  if (await FileSystemService.hasPendingChanges()) {
37
- Logger.error('Please commit or stash your changes before publishing.');
37
+ DR.logger.error('Please commit or stash your changes before publishing.');
38
38
  process.exit(1);
39
39
  }
40
40
  await PackageService.updateJsrFromPackageJson();
@@ -44,7 +44,7 @@ export default class PackageService {
44
44
  process.exit(1);
45
45
  }
46
46
  else {
47
- Logger.success('Successfully published to JSR.');
47
+ DR.logger.success('Successfully published to JSR.');
48
48
  }
49
49
  }
50
50
  static async updateJsrFromPackageJson() {
@@ -55,14 +55,14 @@ export default class PackageService {
55
55
  await access(packageJsonPath);
56
56
  }
57
57
  catch {
58
- Logger.error('No package.json file found in the current directory.');
58
+ DR.logger.error('No package.json file found in the current directory.');
59
59
  return;
60
60
  }
61
61
  try {
62
62
  await access(jsrJsonPath);
63
63
  }
64
64
  catch {
65
- Logger.error('No jsr.json file found in the current directory.');
65
+ DR.logger.error('No jsr.json file found in the current directory.');
66
66
  return;
67
67
  }
68
68
  try {
@@ -70,11 +70,11 @@ export default class PackageService {
70
70
  const jsrJsonData = JSON.parse(await readFile(jsrJsonPath, 'utf-8'));
71
71
  jsrJsonData.version = packageJsonData.version;
72
72
  await writeFile(jsrJsonPath, JSON.stringify(jsrJsonData, null, 2));
73
- Logger.info('Updated jsr.json from package.json to version ' + jsrJsonData.version);
73
+ DR.logger.info('Updated jsr.json from package.json to version ' + jsrJsonData.version);
74
74
  }
75
75
  catch (error) {
76
76
  const errorString = ErrorUtils.getErrorString(error);
77
- Logger.error(`Failed to update jsr.json from package.json: ${errorString}`);
77
+ DR.logger.error(`Failed to update jsr.json from package.json: ${errorString}`);
78
78
  }
79
79
  }
80
80
  /**
@@ -82,16 +82,16 @@ export default class PackageService {
82
82
  * successful, false otherwise.
83
83
  */
84
84
  static async publishJsrDryRun() {
85
- Logger.info('Running `jsr publish --dry-run`');
85
+ DR.logger.info('Running `jsr publish --dry-run`');
86
86
  try {
87
87
  const { stdout, stderr } = await execAsync('jsr publish --allow-dirty --dry-run');
88
88
  if (stderr) {
89
- Logger.info(stderr);
89
+ DR.logger.info(stderr);
90
90
  }
91
- Logger.info(stdout);
91
+ DR.logger.info(stdout);
92
92
  }
93
93
  catch (error) {
94
- Logger.error(`Failed to run 'jsr publish --dry-run': ${ErrorUtils.getErrorString(error)}`);
94
+ DR.logger.error(`Failed to run 'jsr publish --dry-run': ${ErrorUtils.getErrorString(error)}`);
95
95
  return false;
96
96
  }
97
97
  return true;
@@ -102,7 +102,7 @@ export default class PackageService {
102
102
  * @returns true if the publish was successful, false otherwise.
103
103
  */
104
104
  static async publishJsr() {
105
- Logger.info('Running `jsr publish`');
105
+ DR.logger.info('Running `jsr publish`');
106
106
  return new Promise((resolve) => {
107
107
  const child = spawn('jsr publish', ['--allow-dirty'], {
108
108
  stdio: 'inherit',
@@ -119,12 +119,12 @@ export default class PackageService {
119
119
  });
120
120
  }
121
121
  static async revertGitChanges() {
122
- Logger.info('Reverting changes made to jsr.json');
122
+ DR.logger.info('Reverting changes made to jsr.json');
123
123
  try {
124
124
  await execAsync('git checkout jsr.json');
125
125
  }
126
126
  catch (error) {
127
- Logger.error(`Failed to revert changes made to jsr.json: ${ErrorUtils.getErrorString(error)}`);
127
+ DR.logger.error(`Failed to revert changes made to jsr.json: ${ErrorUtils.getErrorString(error)}`);
128
128
  }
129
129
  }
130
130
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PackageService.js","sourceRoot":"./src/","sources":["services/PackageService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,E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CAAC;CACF"}
@@ -3,7 +3,7 @@ import { access, readFile, writeFile } from 'fs/promises';
3
3
  import path from 'path';
4
4
  import { promisify } from 'util';
5
5
  import ErrorUtils from '../utils/ErrorUtils.js';
6
- import Logger from '../utils/Logger.js';
6
+ import { DR } from './DependencyRegistry.js';
7
7
  import { JsonWithVersionProperty, PackageJson } from './DependencyService.js';
8
8
  import FileSystemService from './FileSystemService/FileSystemService.js';
9
9
 
@@ -22,7 +22,7 @@ export default class PackageService {
22
22
  */
23
23
  static async validateJsrPublish(): Promise<void> {
24
24
  if (await FileSystemService.hasPendingChanges()) {
25
- Logger.error('Please commit or stash your changes before publishing.');
25
+ DR.logger.error('Please commit or stash your changes before publishing.');
26
26
  process.exit(1);
27
27
  }
28
28
  await PackageService.updateJsrFromPackageJson();
@@ -31,13 +31,13 @@ export default class PackageService {
31
31
  if (!successfulDryRun) {
32
32
  process.exit(1);
33
33
  } else {
34
- Logger.success('Successfully validated JSR publishing.');
34
+ DR.logger.success('Successfully validated JSR publishing.');
35
35
  }
36
36
  }
37
37
 
38
38
  static async publishToJsr(): Promise<void> {
39
39
  if (await FileSystemService.hasPendingChanges()) {
40
- Logger.error('Please commit or stash your changes before publishing.');
40
+ DR.logger.error('Please commit or stash your changes before publishing.');
41
41
  process.exit(1);
42
42
  }
43
43
  await PackageService.updateJsrFromPackageJson();
@@ -46,7 +46,7 @@ export default class PackageService {
46
46
  if (!result) {
47
47
  process.exit(1);
48
48
  } else {
49
- Logger.success('Successfully published to JSR.');
49
+ DR.logger.success('Successfully published to JSR.');
50
50
  }
51
51
  }
52
52
 
@@ -58,14 +58,14 @@ export default class PackageService {
58
58
  try {
59
59
  await access(packageJsonPath);
60
60
  } catch {
61
- Logger.error('No package.json file found in the current directory.');
61
+ DR.logger.error('No package.json file found in the current directory.');
62
62
  return;
63
63
  }
64
64
 
65
65
  try {
66
66
  await access(jsrJsonPath);
67
67
  } catch {
68
- Logger.error('No jsr.json file found in the current directory.');
68
+ DR.logger.error('No jsr.json file found in the current directory.');
69
69
  return;
70
70
  }
71
71
 
@@ -78,12 +78,12 @@ export default class PackageService {
78
78
  ) as JsonWithVersionProperty;
79
79
  jsrJsonData.version = packageJsonData.version;
80
80
  await writeFile(jsrJsonPath, JSON.stringify(jsrJsonData, null, 2));
81
- Logger.info(
81
+ DR.logger.info(
82
82
  'Updated jsr.json from package.json to version ' + jsrJsonData.version
83
83
  );
84
84
  } catch (error) {
85
85
  const errorString = ErrorUtils.getErrorString(error);
86
- Logger.error(
86
+ DR.logger.error(
87
87
  `Failed to update jsr.json from package.json: ${errorString}`
88
88
  );
89
89
  }
@@ -94,17 +94,17 @@ export default class PackageService {
94
94
  * successful, false otherwise.
95
95
  */
96
96
  private static async publishJsrDryRun(): Promise<boolean> {
97
- Logger.info('Running `jsr publish --dry-run`');
97
+ DR.logger.info('Running `jsr publish --dry-run`');
98
98
  try {
99
99
  const { stdout, stderr } = await execAsync(
100
100
  'jsr publish --allow-dirty --dry-run'
101
101
  );
102
102
  if (stderr) {
103
- Logger.info(stderr);
103
+ DR.logger.info(stderr);
104
104
  }
105
- Logger.info(stdout);
105
+ DR.logger.info(stdout);
106
106
  } catch (error) {
107
- Logger.error(
107
+ DR.logger.error(
108
108
  `Failed to run 'jsr publish --dry-run': ${ErrorUtils.getErrorString(error)}`
109
109
  );
110
110
  return false;
@@ -118,7 +118,7 @@ export default class PackageService {
118
118
  * @returns true if the publish was successful, false otherwise.
119
119
  */
120
120
  private static async publishJsr(): Promise<boolean> {
121
- Logger.info('Running `jsr publish`');
121
+ DR.logger.info('Running `jsr publish`');
122
122
  return new Promise((resolve) => {
123
123
  const child = spawn('jsr publish', ['--allow-dirty'], {
124
124
  stdio: 'inherit',
@@ -136,11 +136,11 @@ export default class PackageService {
136
136
  }
137
137
 
138
138
  private static async revertGitChanges(): Promise<void> {
139
- Logger.info('Reverting changes made to jsr.json');
139
+ DR.logger.info('Reverting changes made to jsr.json');
140
140
  try {
141
141
  await execAsync('git checkout jsr.json');
142
142
  } catch (error) {
143
- Logger.error(
143
+ DR.logger.error(
144
144
  `Failed to revert changes made to jsr.json: ${ErrorUtils.getErrorString(error)}`
145
145
  );
146
146
  }
@@ -0,0 +1,101 @@
1
+ import { ILogger } from '../interfaces/ILogger.js';
2
+ /**
3
+ * A standard logger that logs messages to the console.
4
+ * Implements the ILogger interface.
5
+ */
6
+ export default class ConsoleLogger implements ILogger {
7
+ /**
8
+ * Indicates if verbose logging is enabled globally.
9
+ * Affects instances created via the `verbose` getter or constructor.
10
+ */
11
+ static verboseLoggingEnabled: boolean;
12
+ /**
13
+ * Private flag indicating if this instance should only log when verbose mode is enabled.
14
+ */
15
+ private logOnlyIfVerbose;
16
+ /**
17
+ * Creates an instance of ConsoleLogger.
18
+ *
19
+ * @param logOnlyIfVerbose - If true, this instance will only log messages if
20
+ * `ConsoleLogger.verboseLoggingEnabled` is also true.
21
+ */
22
+ constructor(logOnlyIfVerbose?: boolean);
23
+ /**
24
+ * Gets a new ConsoleLogger instance configured for verbose logging.
25
+ * This instance will only log if `ConsoleLogger.verboseLoggingEnabled` is true.
26
+ *
27
+ * @returns A new ConsoleLogger instance set to log only when verbose mode is active.
28
+ */
29
+ get verbose(): ConsoleLogger;
30
+ /**
31
+ * Static getter for a verbose ConsoleLogger instance.
32
+ * Equivalent to `new ConsoleLogger().verbose`.
33
+ *
34
+ * @returns A new ConsoleLogger instance set to log only when verbose mode is active.
35
+ */
36
+ static get verbose(): ConsoleLogger;
37
+ /**
38
+ * Logs info to the console. Prepends `ℹ️` to each message.
39
+ * Respects the instance's `logOnlyIfVerbose` setting and the global `verboseLoggingEnabled` flag.
40
+ *
41
+ * @param msg - The message to log.
42
+ * @param skipNewline - If true, the message will be logged without a newline.
43
+ */
44
+ info(msg: string, skipNewline?: boolean): void;
45
+ /**
46
+ * Static version of {@link ConsoleLogger.prototype.info}. Logs using a default instance.
47
+ *
48
+ * @param msg - The message to log.
49
+ * @param skipNewline - If true, the message will be logged without a newline.
50
+ */
51
+ static info(msg: string, skipNewline?: boolean): void;
52
+ /**
53
+ * Logs a success message to the console. Prepends `✅` to each message.
54
+ * Respects the instance's `logOnlyIfVerbose` setting and the global `verboseLoggingEnabled` flag.
55
+ *
56
+ * @param msg - The message to log.
57
+ */
58
+ success(msg: string): void;
59
+ /**
60
+ * Static version of {@link ConsoleLogger.prototype.success}. Logs using a default instance.
61
+ *
62
+ * @param msg - The message to log.
63
+ */
64
+ static success(msg: string): void;
65
+ /**
66
+ * Logs a failure message to the console. Prepends `🔴` to each message.
67
+ * Uses `console.log`. See {@link error} for critical errors.
68
+ * Respects the instance's `logOnlyIfVerbose` setting and the global `verboseLoggingEnabled` flag.
69
+ *
70
+ * @param msg - The message to log.
71
+ */
72
+ failure(msg: string): void;
73
+ /**
74
+ * Static version of {@link ConsoleLogger.prototype.failure}. Logs using a default instance.
75
+ *
76
+ * @param msg - The message to log.
77
+ */
78
+ static failure(msg: string): void;
79
+ /**
80
+ * Logs an error message to the console using `console.error`. Prepends `💀`.
81
+ * Use for potentially execution-stopping errors. See {@link failure} for non-critical issues.
82
+ * Respects the instance's `logOnlyIfVerbose` setting and the global `verboseLoggingEnabled` flag.
83
+ *
84
+ * @param msg - The message to log.
85
+ */
86
+ error(msg: string): void;
87
+ /**
88
+ * Static version of {@link ConsoleLogger.prototype.error}. Logs using a default instance.
89
+ *
90
+ * @param msg - The message to log.
91
+ */
92
+ static error(msg: string): void;
93
+ /**
94
+ * Determines if the message should be logged based on the instance's verbose setting
95
+ * and the global verbose logging flag.
96
+ *
97
+ * @returns True if the message should be logged, false otherwise.
98
+ */
99
+ private shouldLog;
100
+ }
101
+ //# sourceMappingURL=ConsoleLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"./src/","sources":["utils/ConsoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,OAAO;IACnD;;;OAGG;IACH,OAAc,qBAAqB,UAAS;IAE5C;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAAS;IAEjC;;;;;OAKG;gBACS,gBAAgB,CAAC,EAAE,OAAO;IAMtC;;;;;OAKG;IACH,IAAI,OAAO,IAAI,aAAa,CAE3B;IAED;;;;;OAKG;IACH,MAAM,KAAK,OAAO,IAAI,aAAa,CAElC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAiB9C;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAIrD;;;;;OAKG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;OAMG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;OAMG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMxB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;;OAKG;IACH,OAAO,CAAC,SAAS;CAKlB"}