@qodalis/cli-guid 1.0.2 → 1.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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
import { CliGuidCommandProcessor } from './processors/cli-guid-command-processor';
|
|
3
|
+
import { resolveCommandProcessorProvider } from '@qodalis/angular-cli';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export class GuidModule {
|
|
5
6
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
6
7
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: GuidModule }); }
|
|
7
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, providers: [CliGuidCommandProcessor] }); }
|
|
8
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)] }); }
|
|
8
9
|
}
|
|
9
10
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, decorators: [{
|
|
10
11
|
type: NgModule,
|
|
@@ -12,7 +13,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
12
13
|
declarations: [],
|
|
13
14
|
imports: [],
|
|
14
15
|
exports: [],
|
|
15
|
-
providers: [CliGuidCommandProcessor],
|
|
16
|
+
providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)],
|
|
16
17
|
}]
|
|
17
18
|
}] });
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//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b3J0czogW10sXG4gICAgZXhwb3J0czogW10sXG4gICAgcHJvdmlkZXJzOiBbcmVzb2x2ZUNvbW1hbmRQcm9jZXNzb3JQcm92aWRlcihDbGlHdWlkQ29tbWFuZFByb2Nlc3NvcildLFxufSlcbmV4cG9ydCBjbGFzcyBHdWlkTW9kdWxlIHt9XG4iXX0=
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { NgModule } from '@angular/core';
|
|
3
|
+
import { resolveCommandProcessorProvider } from '@qodalis/angular-cli';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* A command processor for generating and validating GUIDs.
|
|
@@ -85,7 +86,7 @@ class CliGuidCommandProcessor {
|
|
|
85
86
|
class GuidModule {
|
|
86
87
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
87
88
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: GuidModule }); }
|
|
88
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, providers: [CliGuidCommandProcessor] }); }
|
|
89
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)] }); }
|
|
89
90
|
}
|
|
90
91
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, decorators: [{
|
|
91
92
|
type: NgModule,
|
|
@@ -93,7 +94,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
93
94
|
declarations: [],
|
|
94
95
|
imports: [],
|
|
95
96
|
exports: [],
|
|
96
|
-
providers: [CliGuidCommandProcessor],
|
|
97
|
+
providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)],
|
|
97
98
|
}]
|
|
98
99
|
}] });
|
|
99
100
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qodalis-cli-guid.mjs","sources":["../../../projects/guid/src/lib/processors/cli-guid-command-processor.ts","../../../projects/guid/src/lib/guid.module.ts","../../../projects/guid/src/public-api.ts","../../../projects/guid/src/qodalis-cli-guid.ts"],"sourcesContent":["import {\n CliProcessCommand,\n ICliCommandProcessor,\n ICliExecutionContext,\n} from '@qodalis/cli-core';\n\n/**\n * A command processor for generating and validating GUIDs.\n */\nexport class CliGuidCommandProcessor implements ICliCommandProcessor {\n command = 'guid';\n description = 'Generate and validate GUIDs';\n author = {\n name: 'Nicolae Lupei',\n email: 'nicolae.lupei@qodalis.com',\n };\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n constructor() {\n this.processors = [\n {\n command: 'new',\n description: 'Generate a new GUID',\n parameters: [\n {\n name: 'copy',\n aliases: ['c'],\n description: 'Copy the GUID to the clipboard',\n required: false,\n type: 'boolean',\n },\n ],\n processCommand: async (command, context) => {\n const copyToClipboard =\n command.args['copy'] || command.args['c'];\n const guid = CliGuidCommandProcessor.generateGUID();\n context.writer.writeln(guid);\n\n if (copyToClipboard) {\n await context.clipboard.write(guid);\n context.writer.writeInfo(\n 'The GUID has been copied to the clipboard',\n );\n }\n },\n },\n {\n command: 'validate',\n allowUnlistedCommands: true,\n description: 'Validate a GUID',\n processCommand: async (command, context) => {\n if (!command.value) {\n context.writer.writeError(\n 'Please specify a GUID to validate',\n );\n return;\n }\n\n const isValid = CliGuidCommandProcessor.validateGUID(\n command.value,\n );\n\n if (isValid) {\n context.writer.writeSuccess('Yes, that is GUID!');\n } else {\n context.writer.writeError(\n `The GUID <${command.value}> is not valid`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.writer.writeln('Please specify a subcommand');\n }\n\n writeDescription(context: ICliExecutionContext): void {\n context.writer.writeln(this.description);\n //examples\n context.writer.writeln('Examples:');\n context.writer.writeln(' guid new');\n context.writer.writeln(' guid new --copy');\n context.writer.writeln(\n ' guid validate 123e4567-e89b-12d3-a456-426614174000',\n );\n }\n\n public static generateGUID(): string {\n // Generate a GUID in the format of xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(\n /[xy]/g,\n (char) => {\n const random = (Math.random() * 16) | 0; // Random integer between 0 and 15\n const value = char === 'x' ? random : (random & 0x3) | 0x8; // Ensure 'y' starts with 8, 9, A, or B\n return value.toString(16); // Convert to hexadecimal\n },\n );\n }\n\n public static validateGUID(guid: string): boolean {\n // Regular expression to match a valid GUID format\n const guidRegex =\n /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;\n return guidRegex.test(guid);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CliGuidCommandProcessor } from './processors/cli-guid-command-processor';\n\n@NgModule({\n declarations: [],\n imports: [],\n exports: [],\n providers: [CliGuidCommandProcessor],\n})\nexport class GuidModule {}\n","/*\n * Public API Surface of guid\n */\n\nexport * from './lib/guid.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qodalis-cli-guid.mjs","sources":["../../../projects/guid/src/lib/processors/cli-guid-command-processor.ts","../../../projects/guid/src/lib/guid.module.ts","../../../projects/guid/src/public-api.ts","../../../projects/guid/src/qodalis-cli-guid.ts"],"sourcesContent":["import {\n CliProcessCommand,\n ICliCommandProcessor,\n ICliExecutionContext,\n} from '@qodalis/cli-core';\n\n/**\n * A command processor for generating and validating GUIDs.\n */\nexport class CliGuidCommandProcessor implements ICliCommandProcessor {\n command = 'guid';\n description = 'Generate and validate GUIDs';\n author = {\n name: 'Nicolae Lupei',\n email: 'nicolae.lupei@qodalis.com',\n };\n\n processors?: ICliCommandProcessor[] | undefined = [];\n\n constructor() {\n this.processors = [\n {\n command: 'new',\n description: 'Generate a new GUID',\n parameters: [\n {\n name: 'copy',\n aliases: ['c'],\n description: 'Copy the GUID to the clipboard',\n required: false,\n type: 'boolean',\n },\n ],\n processCommand: async (command, context) => {\n const copyToClipboard =\n command.args['copy'] || command.args['c'];\n const guid = CliGuidCommandProcessor.generateGUID();\n context.writer.writeln(guid);\n\n if (copyToClipboard) {\n await context.clipboard.write(guid);\n context.writer.writeInfo(\n 'The GUID has been copied to the clipboard',\n );\n }\n },\n },\n {\n command: 'validate',\n allowUnlistedCommands: true,\n description: 'Validate a GUID',\n processCommand: async (command, context) => {\n if (!command.value) {\n context.writer.writeError(\n 'Please specify a GUID to validate',\n );\n return;\n }\n\n const isValid = CliGuidCommandProcessor.validateGUID(\n command.value,\n );\n\n if (isValid) {\n context.writer.writeSuccess('Yes, that is GUID!');\n } else {\n context.writer.writeError(\n `The GUID <${command.value}> is not valid`,\n );\n }\n },\n },\n ];\n }\n\n async processCommand(\n command: CliProcessCommand,\n context: ICliExecutionContext,\n ): Promise<void> {\n context.writer.writeln('Please specify a subcommand');\n }\n\n writeDescription(context: ICliExecutionContext): void {\n context.writer.writeln(this.description);\n //examples\n context.writer.writeln('Examples:');\n context.writer.writeln(' guid new');\n context.writer.writeln(' guid new --copy');\n context.writer.writeln(\n ' guid validate 123e4567-e89b-12d3-a456-426614174000',\n );\n }\n\n public static generateGUID(): string {\n // Generate a GUID in the format of xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(\n /[xy]/g,\n (char) => {\n const random = (Math.random() * 16) | 0; // Random integer between 0 and 15\n const value = char === 'x' ? random : (random & 0x3) | 0x8; // Ensure 'y' starts with 8, 9, A, or B\n return value.toString(16); // Convert to hexadecimal\n },\n );\n }\n\n public static validateGUID(guid: string): boolean {\n // Regular expression to match a valid GUID format\n const guidRegex =\n /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;\n return guidRegex.test(guid);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CliGuidCommandProcessor } from './processors/cli-guid-command-processor';\nimport { resolveCommandProcessorProvider } from '@qodalis/angular-cli';\n\n@NgModule({\n declarations: [],\n imports: [],\n exports: [],\n providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)],\n})\nexport class GuidModule {}\n","/*\n * Public API Surface of guid\n */\n\nexport * from './lib/guid.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAMA;;AAEG;MACU,uBAAuB,CAAA;AAUhC,IAAA,WAAA,GAAA;QATA,IAAO,CAAA,OAAA,GAAG,MAAM,CAAC;QACjB,IAAW,CAAA,WAAA,GAAG,6BAA6B,CAAC;AAC5C,QAAA,IAAA,CAAA,MAAM,GAAG;AACL,YAAA,IAAI,EAAE,eAAe;AACrB,YAAA,KAAK,EAAE,2BAA2B;SACrC,CAAC;QAEF,IAAU,CAAA,UAAA,GAAwC,EAAE,CAAC;QAGjD,IAAI,CAAC,UAAU,GAAG;AACd,YAAA;AACI,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,WAAW,EAAE,qBAAqB;AAClC,gBAAA,UAAU,EAAE;AACR,oBAAA;AACI,wBAAA,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,CAAC,GAAG,CAAC;AACd,wBAAA,WAAW,EAAE,gCAAgC;AAC7C,wBAAA,QAAQ,EAAE,KAAK;AACf,wBAAA,IAAI,EAAE,SAAS;AAClB,qBAAA;AACJ,iBAAA;AACD,gBAAA,cAAc,EAAE,OAAO,OAAO,EAAE,OAAO,KAAI;AACvC,oB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AA,EAAA,EAAA,IAAA,EAAA,UAAU,aAFR,CAAC,+BAA+B,CAAC,uBAAuB,CAAC,CAAC,EAAA,CAAA,CAAA,EAAA;;4FAE5D,UAAU,EAAA,UAAA,EAAA,CAAA;kBANtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE,CAAC,+BAA+B,CAAC,uBAAuB,CAAC,CAAC;AACxE,iBAAA,CAAA;;;ACTD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
package/umd/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
typeof
|
|
3
|
-
factory
|
|
4
|
-
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('@qodalis/cli-core')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['@qodalis/cli-core'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.core));
|
|
5
|
+
})(this, (function (cliCore) { 'use strict';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A command processor for generating and validating GUIDs.
|
|
@@ -84,14 +85,10 @@
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
console.log('window is undefined');
|
|
95
|
-
}
|
|
88
|
+
const module = {
|
|
89
|
+
name: '@qodalis/cli-guid',
|
|
90
|
+
processors: [new CliGuidCommandProcessor()],
|
|
91
|
+
};
|
|
92
|
+
cliCore.bootUmdModule(module);
|
|
96
93
|
|
|
97
94
|
}));
|