x-fidelity 3.0.2 → 3.0.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [3.0.3](https://github.com/zotoio/x-fidelity/compare/v3.0.2...v3.0.3) (2025-02-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **error handling:** deal with unexpected errors globally ensuring async ops finish ([2292d4d](https://github.com/zotoio/x-fidelity/commit/2292d4d09ef75a419778d3df77381a1353217361))
7
+ * improve error handling and telemetry logging ([f7fa9ca](https://github.com/zotoio/x-fidelity/commit/f7fa9ca6b63bcf75ebab8dbc710eb78fc718cefe))
8
+ * normalize event type casing in telemetry test ([9b791f9](https://github.com/zotoio/x-fidelity/commit/9b791f969816f29efa6138b9f95235c6614a3ac7))
9
+ * standardize event type casing to lowercase in error handling ([0416cca](https://github.com/zotoio/x-fidelity/commit/0416ccae4f796ee1a3404f65545a00d67e26bbc7))
10
+
1
11
  ## [3.0.2](https://github.com/zotoio/x-fidelity/compare/v3.0.1...v3.0.2) (2025-02-15)
2
12
 
3
13
 
@@ -70,7 +70,10 @@ class ConfigManager {
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
71
  const { archetype = cli_1.options.archetype, logPrefix } = params;
72
72
  if (!ConfigManager.configs[archetype]) {
73
- ConfigManager.configs[archetype] = yield ConfigManager.initialize({ archetype, logPrefix });
73
+ ConfigManager.configs[archetype] = yield ConfigManager.initialize({ archetype, logPrefix }).catch(error => {
74
+ logger_1.logger.error(error, `Error initializing config for archetype: ${archetype}`);
75
+ throw error;
76
+ });
74
77
  }
75
78
  return ConfigManager.configs[archetype];
76
79
  });
@@ -118,8 +121,7 @@ class ConfigManager {
118
121
  }
119
122
  catch (error) {
120
123
  logger_1.logger.error(`Failed to load extension ${moduleName} from all locations: ${error}`);
121
- if (process.env.NODE_ENV !== 'test')
122
- process.exit(1);
124
+ throw new Error(`Failed to load extension ${moduleName} from all locations: ${error}`);
123
125
  }
124
126
  }
125
127
  }
@@ -134,7 +136,10 @@ class ConfigManager {
134
136
  if (logPrefix)
135
137
  (0, logger_1.setLogPrefix)(logPrefix);
136
138
  // Load plugins during initialization
137
- yield this.loadPlugins(cli_1.options.extensions);
139
+ yield this.loadPlugins(cli_1.options.extensions).catch(error => {
140
+ logger_1.logger.error(error, `Error loading plugins`);
141
+ throw error;
142
+ });
138
143
  logger_1.logger.info(`Initializing config manager for archetype: ${archetype}`);
139
144
  logger_1.logger.debug(`Initialize params: ${JSON.stringify(params)}`);
140
145
  const config = {
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ const handleError = (error) => __awaiter(void 0, void 0, void 0, function* () {
71
71
  },
72
72
  timestamp: new Date().toISOString()
73
73
  }, executionLogPrefix);
74
- logger_1.logger.error(JSON.stringify(error));
74
+ logger_1.logger.error(error, 'Execution failure');
75
75
  });
76
76
  const outcomeMessage = (message) => `\n
77
77
  ==========================================================================
@@ -129,7 +129,14 @@ function main() {
129
129
  }
130
130
  }
131
131
  catch (e) {
132
- yield handleError(e);
132
+ yield handleError(e).then(() => {
133
+ // give some time async ops to finish if not handled directly
134
+ if (process.env.NODE_ENV !== 'test') {
135
+ setTimeout(() => {
136
+ process.exit(1);
137
+ }, 3000);
138
+ }
139
+ });
133
140
  }
134
141
  });
135
142
  }
package/dist/xfidelity CHANGED
@@ -71,7 +71,7 @@ const handleError = (error) => __awaiter(void 0, void 0, void 0, function* () {
71
71
  },
72
72
  timestamp: new Date().toISOString()
73
73
  }, executionLogPrefix);
74
- logger_1.logger.error(JSON.stringify(error));
74
+ logger_1.logger.error(error, 'Execution failure');
75
75
  });
76
76
  const outcomeMessage = (message) => `\n
77
77
  ==========================================================================
@@ -129,7 +129,14 @@ function main() {
129
129
  }
130
130
  }
131
131
  catch (e) {
132
- yield handleError(e);
132
+ yield handleError(e).then(() => {
133
+ // give some time async ops to finish if not handled directly
134
+ if (process.env.NODE_ENV !== 'test') {
135
+ setTimeout(() => {
136
+ process.exit(1);
137
+ }, 3000);
138
+ }
139
+ });
133
140
  }
134
141
  });
135
142
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-fidelity",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "cli for opinionated framework adherence checks",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index.d.ts",
@@ -30,7 +30,10 @@ export class ConfigManager {
30
30
  public static async getConfig(params: GetConfigParams): Promise<ExecutionConfig> {
31
31
  const { archetype = options.archetype, logPrefix } = params;
32
32
  if (!ConfigManager.configs[archetype]) {
33
- ConfigManager.configs[archetype] = await ConfigManager.initialize({ archetype, logPrefix });
33
+ ConfigManager.configs[archetype] = await ConfigManager.initialize({ archetype, logPrefix }).catch(error => {
34
+ logger.error(error, `Error initializing config for archetype: ${archetype}`);
35
+ throw error;
36
+ });
34
37
  }
35
38
  return ConfigManager.configs[archetype];
36
39
  }
@@ -76,7 +79,7 @@ export class ConfigManager {
76
79
  logger.info(`Successfully loaded extension: ${moduleName}`);
77
80
  } catch (error) {
78
81
  logger.error(`Failed to load extension ${moduleName} from all locations: ${error}`);
79
- if (process.env.NODE_ENV !== 'test') process.exit(1);
82
+ throw new Error(`Failed to load extension ${moduleName} from all locations: ${error}`);
80
83
  }
81
84
  }
82
85
  }
@@ -90,7 +93,10 @@ export class ConfigManager {
90
93
  if (logPrefix) setLogPrefix(logPrefix);
91
94
 
92
95
  // Load plugins during initialization
93
- await this.loadPlugins(options.extensions);
96
+ await this.loadPlugins(options.extensions).catch(error => {
97
+ logger.error(error, `Error loading plugins`);
98
+ throw error;
99
+ });
94
100
  logger.info(`Initializing config manager for archetype: ${archetype}`);
95
101
  logger.debug(`Initialize params: ${JSON.stringify(params)}`);
96
102
 
package/src/index.ts CHANGED
@@ -23,7 +23,7 @@ const handleError = async (error: Error) => {
23
23
  },
24
24
  timestamp: new Date().toISOString()
25
25
  }, executionLogPrefix);
26
- logger.error(JSON.stringify(error));
26
+ logger.error(error, 'Execution failure');
27
27
  };
28
28
 
29
29
  const outcomeMessage = (message: string) => `\n
@@ -81,8 +81,14 @@ export async function main() {
81
81
  }
82
82
  }
83
83
  } catch (e: any) {
84
- await handleError(e);
85
-
84
+ await handleError(e).then(() => {
85
+ // give some time async ops to finish if not handled directly
86
+ if (process.env.NODE_ENV !== 'test') {
87
+ setTimeout(() => {
88
+ process.exit(1);
89
+ }, 3000);
90
+ }
91
+ });
86
92
  }
87
93
  }
88
94