@qodalis/cli-guid 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -1,24 +1,18 @@
1
- # Guid
1
+ # Cli extension
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.0.
3
+ The `@qodalis/cli-guid` package is a CLI extension designed to provide GUID (Globally Unique Identifier) generation and management capabilities to the Qodalis CLI.
4
4
 
5
- ## Code scaffolding
5
+ # Features
6
6
 
7
- Run `ng generate component component-name --project guid` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project guid`.
8
- > Note: Don't forget to add `--project guid` or else it will be added to the default project in your `angular.json` file.
7
+ Generate GUIDs: Quickly generate unique GUIDs for various use cases.
8
+ Validate GUIDs: Verify if a given string is a valid GUID.
9
+ Custom Formats: Support for different GUID formats and patterns.
10
+ Integration: Seamlessly integrates with the Qodalis CLI environment.
9
11
 
10
- ## Build
12
+ # Installation
11
13
 
12
- Run `ng build guid` to build the project. The build artifacts will be stored in the `dist/` directory.
14
+ ```bash
15
+ packages add @qodalis/cli-guid
16
+ ```
13
17
 
14
- ## Publishing
15
-
16
- After building your library with `ng build guid`, go to the dist folder `cd dist/guid` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test guid` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
18
+ This command downloads and registers the extension for use within the CLI environment.
@@ -0,0 +1,19 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CliGuidCommandProcessor } from './processors/cli-guid-command-processor';
3
+ import { resolveCommandProcessorProvider } from '@qodalis/angular-cli';
4
+ import * as i0 from "@angular/core";
5
+ export class CliGuidModule {
6
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
7
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule }); }
8
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule, providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)] }); }
9
+ }
10
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule, decorators: [{
11
+ type: NgModule,
12
+ args: [{
13
+ declarations: [],
14
+ imports: [],
15
+ exports: [],
16
+ providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)],
17
+ }]
18
+ }] });
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLWd1aWQubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvZ3VpZC9zcmMvbGliL2NsaS1ndWlkLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLHlDQUF5QyxDQUFDO0FBQ2xGLE9BQU8sRUFBRSwrQkFBK0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDOztBQVF2RSxNQUFNLE9BQU8sYUFBYTsrR0FBYixhQUFhO2dIQUFiLGFBQWE7Z0hBQWIsYUFBYSxhQUZYLENBQUMsK0JBQStCLENBQUMsdUJBQXVCLENBQUMsQ0FBQzs7NEZBRTVELGFBQWE7a0JBTnpCLFFBQVE7bUJBQUM7b0JBQ04sWUFBWSxFQUFFLEVBQUU7b0JBQ2hCLE9BQU8sRUFBRSxFQUFFO29CQUNYLE9BQU8sRUFBRSxFQUFFO29CQUNYLFNBQVMsRUFBRSxDQUFDLCtCQUErQixDQUFDLHVCQUF1QixDQUFDLENBQUM7aUJBQ3hFIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgTmdNb2R1bGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IENsaUd1aWRDb21tYW5kUHJvY2Vzc29yIH0gZnJvbSAnLi9wcm9jZXNzb3JzL2NsaS1ndWlkLWNvbW1hbmQtcHJvY2Vzc29yJztcbmltcG9ydCB7IHJlc29sdmVDb21tYW5kUHJvY2Vzc29yUHJvdmlkZXIgfSBmcm9tICdAcW9kYWxpcy9hbmd1bGFyLWNsaSc7XG5cbkBOZ01vZHVsZSh7XG4gICAgZGVjbGFyYXRpb25zOiBbXSxcbiAgICBpbXBvcnRzOiBbXSxcbiAgICBleHBvcnRzOiBbXSxcbiAgICBwcm92aWRlcnM6IFtyZXNvbHZlQ29tbWFuZFByb2Nlc3NvclByb3ZpZGVyKENsaUd1aWRDb21tYW5kUHJvY2Vzc29yKV0sXG59KVxuZXhwb3J0IGNsYXNzIENsaUd1aWRNb2R1bGUge31cbiJdfQ==
@@ -1,5 +1,5 @@
1
1
  /*
2
2
  * Public API Surface of guid
3
3
  */
4
- export * from './lib/guid.module';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2d1aWQvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLG1CQUFtQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBndWlkXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvZ3VpZC5tb2R1bGUnO1xuIl19
4
+ export * from './lib/cli-guid.module';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2d1aWQvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLHVCQUF1QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBndWlkXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvY2xpLWd1aWQubW9kdWxlJztcbiJdfQ==
@@ -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.
@@ -82,18 +83,18 @@ class CliGuidCommandProcessor {
82
83
  }
83
84
  }
84
85
 
85
- class GuidModule {
86
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
87
- 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] }); }
86
+ class CliGuidModule {
87
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
88
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule }); }
89
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule, providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)] }); }
89
90
  }
90
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, decorators: [{
91
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CliGuidModule, decorators: [{
91
92
  type: NgModule,
92
93
  args: [{
93
94
  declarations: [],
94
95
  imports: [],
95
96
  exports: [],
96
- providers: [CliGuidCommandProcessor],
97
+ providers: [resolveCommandProcessorProvider(CliGuidCommandProcessor)],
97
98
  }]
98
99
  }] });
99
100
 
@@ -105,5 +106,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
105
106
  * Generated bundle index. Do not edit.
106
107
  */
107
108
 
108
- export { GuidModule };
109
+ export { CliGuidModule };
109
110
  //# sourceMappingURL=qodalis-cli-guid.mjs.map
@@ -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":";;;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,oBAAA,MAAM,eAAe,GACjB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9C,oBAAA,MAAM,IAAI,GAAG,uBAAuB,CAAC,YAAY,EAAE,CAAC;AACpD,oBAAA,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7B,oBAAA,IAAI,eAAe,EAAE;wBACjB,MAAM,OAAO,CA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../../../projects/guid/src/lib/cli-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 CliGuidModule {}\n","/*\n * Public API Surface of guid\n */\n\nexport * from './lib/cli-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,EA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AAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAb,aAAa,EAAA,CAAA,CAAA,EAAA;AAAb,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,aAFX,CAAC,+BAA+B,CAAC,uBAAuB,CAAC,CAAC,EAAA,CAAA,CAAA,EAAA;;4FAE5D,aAAa,EAAA,UAAA,EAAA,CAAA;kBANzB,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;;;;"}
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class CliGuidModule {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<CliGuidModule, never>;
4
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CliGuidModule, never, never, never>;
5
+ static ɵinj: i0.ɵɵInjectorDeclaration<CliGuidModule>;
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli-guid",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "An Angular CLI extension for generating and validating GUIDs.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
package/public-api.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './lib/guid.module';
1
+ export * from './lib/cli-guid.module';
package/umd/index.js CHANGED
@@ -1,7 +1,8 @@
1
- (function (factory) {
2
- typeof define === 'function' && define.amd ? define(factory) :
3
- factory();
4
- })((function () { 'use strict';
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
- if (typeof window !== 'undefined') {
88
- const module = {
89
- processors: [new CliGuidCommandProcessor()],
90
- };
91
- window['@qodalis/cli-guid'] = module;
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
  }));
@@ -1,18 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CliGuidCommandProcessor } from './processors/cli-guid-command-processor';
3
- import * as i0 from "@angular/core";
4
- export class GuidModule {
5
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
6
- 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
- }
9
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuidModule, decorators: [{
10
- type: NgModule,
11
- args: [{
12
- declarations: [],
13
- imports: [],
14
- exports: [],
15
- providers: [CliGuidCommandProcessor],
16
- }]
17
- }] });
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VpZC5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ndWlkL3NyYy9saWIvZ3VpZC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx5Q0FBeUMsQ0FBQzs7QUFRbEYsTUFBTSxPQUFPLFVBQVU7K0dBQVYsVUFBVTtnSEFBVixVQUFVO2dIQUFWLFVBQVUsYUFGUixDQUFDLHVCQUF1QixDQUFDOzs0RkFFM0IsVUFBVTtrQkFOdEIsUUFBUTttQkFBQztvQkFDTixZQUFZLEVBQUUsRUFBRTtvQkFDaEIsT0FBTyxFQUFFLEVBQUU7b0JBQ1gsT0FBTyxFQUFFLEVBQUU7b0JBQ1gsU0FBUyxFQUFFLENBQUMsdUJBQXVCLENBQUM7aUJBQ3ZDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgTmdNb2R1bGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcbmltcG9ydCB7IENsaUd1aWRDb21tYW5kUHJvY2Vzc29yIH0gZnJvbSAnLi9wcm9jZXNzb3JzL2NsaS1ndWlkLWNvbW1hbmQtcHJvY2Vzc29yJztcblxuQE5nTW9kdWxlKHtcbiAgICBkZWNsYXJhdGlvbnM6IFtdLFxuICAgIGltcG9ydHM6IFtdLFxuICAgIGV4cG9ydHM6IFtdLFxuICAgIHByb3ZpZGVyczogW0NsaUd1aWRDb21tYW5kUHJvY2Vzc29yXSxcbn0pXG5leHBvcnQgY2xhc3MgR3VpZE1vZHVsZSB7fVxuIl19
@@ -1,6 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class GuidModule {
3
- static ɵfac: i0.ɵɵFactoryDeclaration<GuidModule, never>;
4
- static ɵmod: i0.ɵɵNgModuleDeclaration<GuidModule, never, never, never>;
5
- static ɵinj: i0.ɵɵInjectorDeclaration<GuidModule>;
6
- }