@asyncapi/cli 2.7.3 → 2.8.0
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/lib/commands/optimize.js +6 -5
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/lib/commands/optimize.js
CHANGED
|
@@ -68,7 +68,7 @@ class Optimize extends base_1.default {
|
|
|
68
68
|
this.outputMethod = flags.output;
|
|
69
69
|
this.metricsMetadata.optimized = false;
|
|
70
70
|
if (!(((_a = report.moveDuplicatesToComponents) === null || _a === void 0 ? void 0 : _a.length) || ((_b = report.removeComponents) === null || _b === void 0 ? void 0 : _b.length) || ((_c = report.reuseComponents) === null || _c === void 0 ? void 0 : _c.length))) {
|
|
71
|
-
this.log(
|
|
71
|
+
this.log(`🎉 Great news! Your file at ${(_d = this.specFile.getFilePath()) !== null && _d !== void 0 ? _d : this.specFile.getFileURL()} is already optimized.`);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
const isTTY = process.stdout.isTTY;
|
|
@@ -98,22 +98,23 @@ class Optimize extends base_1.default {
|
|
|
98
98
|
}
|
|
99
99
|
switch (this.outputMethod) {
|
|
100
100
|
case Outputs.TERMINAL:
|
|
101
|
+
this.log('📄 Here is your optimized AsyncAPI document:\n');
|
|
101
102
|
this.log(optimizedDocument);
|
|
102
103
|
break;
|
|
103
104
|
case Outputs.NEW_FILE:
|
|
104
105
|
yield writeFile(newPath, optimizedDocument, { encoding: 'utf8' });
|
|
105
|
-
this.log(
|
|
106
|
+
this.log(`✅ Success! Your optimized file has been created at ${chalk_1.default.blue({ newPath })}.`);
|
|
106
107
|
break;
|
|
107
108
|
case Outputs.OVERWRITE:
|
|
108
109
|
yield writeFile(specPath !== null && specPath !== void 0 ? specPath : 'asyncapi.yaml', optimizedDocument, { encoding: 'utf8' });
|
|
109
|
-
this.log(
|
|
110
|
+
this.log(`✅ Success! Your original file at ${specPath} has been updated.`);
|
|
110
111
|
break;
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
catch (error) {
|
|
114
115
|
throw new validation_error_1.ValidationError({
|
|
115
116
|
type: 'parser-error',
|
|
116
|
-
err: error
|
|
117
|
+
err: error,
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
});
|
|
@@ -195,7 +196,7 @@ class Optimize extends base_1.default {
|
|
|
195
196
|
message: 'where do you want to save the result:',
|
|
196
197
|
type: 'list',
|
|
197
198
|
default: 'log to terminal',
|
|
198
|
-
choices: [{ name: 'log to terminal', value: Outputs.TERMINAL }, { name: 'create new file', value: Outputs.NEW_FILE }, { name: 'update original', value: Outputs.OVERWRITE }]
|
|
199
|
+
choices: [{ name: 'log to terminal', value: Outputs.TERMINAL }, { name: 'create new file', value: Outputs.NEW_FILE }, { name: 'update original file', value: Outputs.OVERWRITE }]
|
|
199
200
|
}]);
|
|
200
201
|
this.outputMethod = outputRes.output;
|
|
201
202
|
});
|
package/oclif.manifest.json
CHANGED