@oclif/plugin-command-snapshot
Advanced tools
+7
-0
@@ -5,2 +5,9 @@ # Changelog | ||
| ## [2.2.0](https://github.com/oclif/plugin-command-snapshot/compare/v2.1.2...v2.2.0) (2021-06-30) | ||
| ### Features | ||
| * add --ignorevoid flag to schema:generate ([9c4a48e](https://github.com/oclif/plugin-command-snapshot/commit/9c4a48e076e750c2320a47bc4b7c2f4bfc7029ae)) | ||
| ### [2.1.2](https://github.com/oclif/plugin-command-snapshot/compare/v2.1.1...v2.1.2) (2021-06-07) | ||
@@ -7,0 +14,0 @@ |
@@ -10,4 +10,5 @@ import { flags } from '@oclif/command'; | ||
| private base; | ||
| private ignorevoid; | ||
| private classToId; | ||
| constructor(base: SnapshotCommand); | ||
| constructor(base: SnapshotCommand, ignorevoid?: boolean); | ||
| generate(): Promise<SchemasMap>; | ||
@@ -23,4 +24,5 @@ private getAllCmdFiles; | ||
| singlefile: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
| ignorevoid: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
| }; | ||
| run(): Promise<GenerateResponse>; | ||
| } |
@@ -11,4 +11,5 @@ "use strict"; | ||
| class SchemaGenerator { | ||
| constructor(base) { | ||
| constructor(base, ignorevoid = true) { | ||
| this.base = base; | ||
| this.ignorevoid = ignorevoid; | ||
| this.classToId = {}; | ||
@@ -25,2 +26,4 @@ } | ||
| const { returnType, commandId } = this.parseFile(file); | ||
| if (this.ignorevoid && returnType === 'void') | ||
| continue; | ||
| try { | ||
@@ -74,3 +77,3 @@ const config = { | ||
| validateReturnType(returnType, commandId) { | ||
| const notAllowed = ['any', 'unknown', 'void']; | ||
| const notAllowed = this.ignorevoid ? ['any', 'unknown'] : ['any', 'unknown', 'void']; | ||
| const vaugeTypes = ['JsonMap', 'JsonCollection', 'AnyJson']; | ||
@@ -97,3 +100,3 @@ if (notAllowed.includes(returnType)) { | ||
| const { flags } = this.parse(SchemaGenerate); | ||
| const generator = new SchemaGenerator(this); | ||
| const generator = new SchemaGenerator(this, flags.ignorevoid); | ||
| const schemas = await generator.generate(); | ||
@@ -131,2 +134,6 @@ const directory = flags.filepath.replace('{version}', this.config.version); | ||
| }), | ||
| ignorevoid: command_1.flags.boolean({ | ||
| description: 'ignore commands that return void', | ||
| default: true, | ||
| }), | ||
| }; |
@@ -1,1 +0,1 @@ | ||
| {"version":"2.1.2","commands":{"schema:compare":{"id":"schema:compare","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"path of the generated snapshot file","default":"./schemas"}},"args":[]},"schema:generate":{"id":"schema:generate","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"directory to save the generated schema files; can use \"{version}\" to insert the current CLI/plugin version","default":"./schemas"},"singlefile":{"name":"singlefile","type":"boolean","description":"put generated schema into a single file","allowNo":false}},"args":[]},"snapshot:compare":{"id":"snapshot:compare","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"path of the generated snapshot file","default":"./command-snapshot.json"}},"args":[]},"snapshot:generate":{"id":"snapshot:generate","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"path to save the generated snapshot file; can use \"{version}\" to replace the current CLI/plugin version","default":"./command-snapshot.json"}},"args":[]}}} | ||
| {"version":"2.2.0","commands":{"schema:compare":{"id":"schema:compare","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"path of the generated snapshot file","default":"./schemas"}},"args":[]},"schema:generate":{"id":"schema:generate","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"directory to save the generated schema files; can use \"{version}\" to insert the current CLI/plugin version","default":"./schemas"},"singlefile":{"name":"singlefile","type":"boolean","description":"put generated schema into a single file","allowNo":false},"ignorevoid":{"name":"ignorevoid","type":"boolean","description":"ignore commands that return void","allowNo":false}},"args":[]},"snapshot:compare":{"id":"snapshot:compare","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"path of the generated snapshot file","default":"./command-snapshot.json"}},"args":[]},"snapshot:generate":{"id":"snapshot:generate","pluginName":"@oclif/plugin-command-snapshot","pluginType":"core","aliases":[],"flags":{"filepath":{"name":"filepath","type":"option","description":"path to save the generated snapshot file; can use \"{version}\" to replace the current CLI/plugin version","default":"./command-snapshot.json"}},"args":[]}}} |
+3
-3
| { | ||
| "name": "@oclif/plugin-command-snapshot", | ||
| "description": "generates and compares OCLIF plugins snapshot files", | ||
| "version": "2.1.2", | ||
| "version": "2.2.0", | ||
| "author": "Ramyasri @nramyasri-sf", | ||
@@ -13,3 +13,3 @@ "bugs": "https://github.com/oclif/plugin-command-snapshot/issues", | ||
| "semver": "^7.3.5", | ||
| "sinon": "^10.0.0", | ||
| "sinon": "^11.1.1", | ||
| "ts-json-schema-generator": "^0.93.0", | ||
@@ -25,3 +25,3 @@ "tslib": "^2" | ||
| "@types/mocha": "^8", | ||
| "@types/node": "^14", | ||
| "@types/node": "^15", | ||
| "@types/semver": "^7.3.6", | ||
@@ -28,0 +28,0 @@ "chai": "^4", |
Sorry, the diff of this file is too big to display
196687
0.32%663
1.38%+ Added
+ Added
- Removed
- Removed
Updated