@launch77/cli 1.3.0 → 1.4.1
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 +19 -0
- package/dist/cli.js +6 -3
- package/dist/cli.js.map +1 -1
- package/dist/infrastructure/template-generator.d.ts +1 -1
- package/dist/infrastructure/template-generator.d.ts.map +1 -1
- package/dist/infrastructure/template.d.ts +5 -0
- package/dist/infrastructure/template.d.ts.map +1 -1
- package/dist/infrastructure/template.js +11 -0
- package/dist/infrastructure/template.js.map +1 -1
- package/dist/modules/app/commands/create-app.js +1 -1
- package/dist/modules/app/commands/create-app.js.map +1 -1
- package/dist/modules/app/commands/delete-app.js +1 -1
- package/dist/modules/app/commands/delete-app.js.map +1 -1
- package/dist/modules/app/services/app-svc.d.ts +1 -1
- package/dist/modules/app/services/app-svc.d.ts.map +1 -1
- package/dist/modules/app/services/manifest-svc.d.ts +1 -1
- package/dist/modules/app/services/manifest-svc.d.ts.map +1 -1
- package/dist/modules/catalog/config/catalog-config.test.js +1 -1
- package/dist/modules/catalog/config/catalog-config.test.js.map +1 -1
- package/dist/modules/git/commands/git-connect.js +2 -2
- package/dist/modules/git/commands/git-connect.js.map +1 -1
- package/dist/modules/git/errors/git-errors.d.ts +3 -0
- package/dist/modules/git/errors/git-errors.d.ts.map +1 -1
- package/dist/modules/git/errors/git-errors.js +6 -0
- package/dist/modules/git/errors/git-errors.js.map +1 -1
- package/dist/modules/git/index.d.ts +3 -1
- package/dist/modules/git/index.d.ts.map +1 -1
- package/dist/modules/git/index.js +6 -1
- package/dist/modules/git/index.js.map +1 -1
- package/dist/modules/git/services/git-service.d.ts +5 -0
- package/dist/modules/git/services/git-service.d.ts.map +1 -1
- package/dist/modules/git/services/git-service.js +11 -1
- package/dist/modules/git/services/git-service.js.map +1 -1
- package/dist/modules/plugin/commands/plugin-create.d.ts +3 -0
- package/dist/modules/plugin/commands/plugin-create.d.ts.map +1 -0
- package/dist/modules/plugin/commands/plugin-create.js +59 -0
- package/dist/modules/plugin/commands/plugin-create.js.map +1 -0
- package/dist/modules/plugin/commands/plugin-install.d.ts.map +1 -1
- package/dist/modules/plugin/commands/plugin-install.js +9 -24
- package/dist/modules/plugin/commands/plugin-install.js.map +1 -1
- package/dist/modules/plugin/errors/plugin-errors.d.ts +24 -1
- package/dist/modules/plugin/errors/plugin-errors.d.ts.map +1 -1
- package/dist/modules/plugin/errors/plugin-errors.js +79 -6
- package/dist/modules/plugin/errors/plugin-errors.js.map +1 -1
- package/dist/modules/plugin/index.d.ts +4 -2
- package/dist/modules/plugin/index.d.ts.map +1 -1
- package/dist/modules/plugin/index.js +4 -2
- package/dist/modules/plugin/index.js.map +1 -1
- package/dist/modules/plugin/lib/plugin-registry.d.ts +6 -12
- package/dist/modules/plugin/lib/plugin-registry.d.ts.map +1 -1
- package/dist/modules/plugin/lib/plugin-registry.js +13 -30
- package/dist/modules/plugin/lib/plugin-registry.js.map +1 -1
- package/dist/modules/plugin/lib/plugin-resolver.d.ts +76 -0
- package/dist/modules/plugin/lib/plugin-resolver.d.ts.map +1 -0
- package/dist/modules/plugin/lib/plugin-resolver.js +128 -0
- package/dist/modules/plugin/lib/plugin-resolver.js.map +1 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.d.ts +2 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.d.ts.map +1 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.js +175 -0
- package/dist/modules/plugin/lib/plugin-resolver.test.js.map +1 -0
- package/dist/modules/plugin/services/plugin-create-service.d.ts +16 -0
- package/dist/modules/plugin/services/plugin-create-service.d.ts.map +1 -0
- package/dist/modules/plugin/services/plugin-create-service.js +47 -0
- package/dist/modules/plugin/services/plugin-create-service.js.map +1 -0
- package/dist/modules/plugin/services/plugin-svc.d.ts +29 -3
- package/dist/modules/plugin/services/plugin-svc.d.ts.map +1 -1
- package/dist/modules/plugin/services/plugin-svc.js +192 -17
- package/dist/modules/plugin/services/plugin-svc.js.map +1 -1
- package/dist/modules/plugin/services/plugin-svc.test.d.ts +2 -0
- package/dist/modules/plugin/services/plugin-svc.test.d.ts.map +1 -0
- package/dist/modules/plugin/services/plugin-svc.test.js +362 -0
- package/dist/modules/plugin/services/plugin-svc.test.js.map +1 -0
- package/dist/modules/release/commands/release-init.d.ts +3 -0
- package/dist/modules/release/commands/release-init.d.ts.map +1 -0
- package/dist/modules/release/commands/release-init.js +92 -0
- package/dist/modules/release/commands/release-init.js.map +1 -0
- package/dist/modules/release/errors/release-errors.d.ts +7 -0
- package/dist/modules/release/errors/release-errors.d.ts.map +1 -0
- package/dist/modules/release/errors/release-errors.js +13 -0
- package/dist/modules/release/errors/release-errors.js.map +1 -0
- package/dist/modules/release/index.d.ts +4 -0
- package/dist/modules/release/index.d.ts.map +1 -0
- package/dist/modules/release/index.js +7 -0
- package/dist/modules/release/index.js.map +1 -0
- package/dist/modules/release/services/release-service.d.ts +34 -0
- package/dist/modules/release/services/release-service.d.ts.map +1 -0
- package/dist/modules/release/services/release-service.js +154 -0
- package/dist/modules/release/services/release-service.js.map +1 -0
- package/dist/templates/plugin/README.md.hbs +39 -0
- package/dist/templates/plugin/package.json.hbs +34 -0
- package/dist/templates/plugin/plugin.json.hbs +7 -0
- package/dist/templates/plugin/src/generator.ts.hbs +64 -0
- package/dist/templates/plugin/templates/src/.gitkeep +0 -0
- package/dist/templates/plugin/tsconfig.json +10 -0
- package/dist/templates/plugin/tsup.config.ts +9 -0
- package/dist/templates/workspace/.github/workflows/ci.yml +8 -5
- package/dist/templates/workspace/package.json +3 -1
- package/dist/templates/workspace/turbo.json +5 -0
- package/dist/utils/launch77-context.d.ts +1 -1
- package/dist/utils/launch77-context.d.ts.map +1 -1
- package/dist/utils/launch77-context.js +25 -2
- package/dist/utils/launch77-context.js.map +1 -1
- package/dist/utils/launch77-validation.d.ts +1 -1
- package/dist/utils/launch77-validation.d.ts.map +1 -1
- package/dist/utils/string.d.ts +13 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +18 -0
- package/dist/utils/string.js.map +1 -0
- package/package.json +6 -9
- package/src/cli.ts +7 -3
- package/src/infrastructure/template-generator.ts +1 -1
- package/src/infrastructure/template.ts +14 -0
- package/src/modules/app/commands/create-app.ts +1 -1
- package/src/modules/app/commands/delete-app.ts +1 -1
- package/src/modules/app/services/app-svc.ts +1 -1
- package/src/modules/app/services/manifest-svc.ts +1 -1
- package/src/modules/catalog/config/catalog-config.test.ts +1 -1
- package/src/modules/git/commands/git-connect.ts +2 -2
- package/src/modules/git/errors/git-errors.ts +7 -0
- package/src/modules/git/index.ts +8 -1
- package/src/modules/git/services/git-service.ts +12 -1
- package/src/modules/plugin/commands/plugin-create.ts +68 -0
- package/src/modules/plugin/commands/plugin-install.ts +9 -26
- package/src/modules/plugin/errors/plugin-errors.ts +87 -6
- package/src/modules/plugin/index.ts +4 -2
- package/src/modules/plugin/lib/plugin-registry.ts +14 -37
- package/src/modules/plugin/lib/plugin-resolver.test.ts +215 -0
- package/src/modules/plugin/lib/plugin-resolver.ts +160 -0
- package/src/modules/plugin/services/plugin-create-service.ts +69 -0
- package/src/modules/plugin/services/plugin-svc.test.ts +418 -0
- package/src/modules/plugin/services/plugin-svc.ts +217 -17
- package/src/modules/release/commands/release-init.ts +102 -0
- package/src/modules/release/errors/release-errors.ts +13 -0
- package/src/modules/release/index.ts +8 -0
- package/src/modules/release/services/release-service.ts +170 -0
- package/src/utils/launch77-context.ts +29 -3
- package/src/utils/launch77-validation.ts +1 -1
- package/src/utils/string.ts +17 -0
- package/templates/plugin/README.md.hbs +39 -0
- package/templates/plugin/package.json.hbs +34 -0
- package/templates/plugin/plugin.json.hbs +7 -0
- package/templates/plugin/src/generator.ts.hbs +64 -0
- package/templates/plugin/templates/src/.gitkeep +0 -0
- package/templates/plugin/tsconfig.json +10 -0
- package/templates/plugin/tsup.config.ts +9 -0
- package/templates/workspace/.github/workflows/ci.yml +8 -5
- package/templates/workspace/package.json +3 -1
- package/templates/workspace/turbo.json +5 -0
- package/tests/integration/cli.test.ts +25 -0
- package/tests/integration/setup.ts +20 -0
- package/vitest.config.ts +9 -0
- package/vitest.integration.config.ts +9 -0
- package/dist/modules/git/commands/git-setup-releases.d.ts +0 -3
- package/dist/modules/git/commands/git-setup-releases.d.ts.map +0 -1
- package/dist/modules/git/commands/git-setup-releases.js +0 -128
- package/dist/modules/git/commands/git-setup-releases.js.map +0 -1
- package/launch77-cli-1.2.0.tgz +0 -0
- package/src/modules/git/commands/git-setup-releases.ts +0 -148
- package/src/modules/plugin/lib/launch77-workspace.code-workspace +0 -14
|
@@ -6,11 +6,34 @@ export declare class InvalidPluginContextError extends Error {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Factory function to create standardized InvalidPluginContextError
|
|
9
|
-
* for when plugin:install is run outside of
|
|
9
|
+
* for when plugin:install is run outside of a package directory
|
|
10
10
|
*/
|
|
11
11
|
export declare function createInvalidContextError(currentLocation: string): InvalidPluginContextError;
|
|
12
|
+
/**
|
|
13
|
+
* Error when plugin.json is missing the required 'targets' field
|
|
14
|
+
*/
|
|
15
|
+
export declare class MissingPluginTargetsError extends Error {
|
|
16
|
+
constructor(pluginName: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Factory function to create error when plugin targets don't match current location
|
|
20
|
+
*/
|
|
21
|
+
export declare function createInvalidTargetError(pluginName: string, currentTarget: string, allowedTargets: string[]): InvalidPluginContextError;
|
|
12
22
|
export declare class PluginInstallationError extends Error {
|
|
13
23
|
readonly cause?: Error | undefined;
|
|
14
24
|
constructor(message: string, cause?: Error | undefined);
|
|
15
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Error when plugin resolution fails
|
|
28
|
+
*/
|
|
29
|
+
export declare class PluginResolutionError extends Error {
|
|
30
|
+
constructor(pluginName: string, reason: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Error when npm package installation fails
|
|
34
|
+
*/
|
|
35
|
+
export declare class NpmInstallationError extends Error {
|
|
36
|
+
readonly cause?: Error | undefined;
|
|
37
|
+
constructor(packageName: string, cause?: Error | undefined);
|
|
38
|
+
}
|
|
16
39
|
//# sourceMappingURL=plugin-errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-errors.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/errors/plugin-errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,UAAU,EAAE,MAAM;CAM/B;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,MAAM,GAAG,yBAAyB,CAa5F;AAED,qBAAa,uBAAwB,SAAQ,KAAK;aAG9B,KAAK,CAAC,EAAE,KAAK;gBAD7B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,KAAK,YAAA;CAKhC"}
|
|
1
|
+
{"version":3,"file":"plugin-errors.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/errors/plugin-errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,UAAU,EAAE,MAAM;CAM/B;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,MAAM,GAAG,yBAAyB,CAa5F;AAED;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,UAAU,EAAE,MAAM;CAgB/B;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,yBAAyB,CAwBvI;AAED,qBAAa,uBAAwB,SAAQ,KAAK;aAG9B,KAAK,CAAC,EAAE,KAAK;gBAD7B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,KAAK,YAAA;CAKhC;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI/C;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;aAG3B,KAAK,CAAC,EAAE,KAAK;gBAD7B,WAAW,EAAE,MAAM,EACH,KAAK,CAAC,EAAE,KAAK,YAAA;CAYhC"}
|
|
@@ -14,19 +14,65 @@ export class InvalidPluginContextError extends Error {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Factory function to create standardized InvalidPluginContextError
|
|
17
|
-
* for when plugin:install is run outside of
|
|
17
|
+
* for when plugin:install is run outside of a package directory
|
|
18
18
|
*/
|
|
19
19
|
export function createInvalidContextError(currentLocation) {
|
|
20
|
-
return new InvalidPluginContextError(`plugin:install must be run from within
|
|
20
|
+
return new InvalidPluginContextError(`plugin:install must be run from within a package directory.
|
|
21
21
|
|
|
22
22
|
Current location: ${currentLocation}
|
|
23
|
-
Expected: apps/<app-name>/
|
|
23
|
+
Expected: apps/<name>/, libraries/<name>/, plugins/<name>/, or app-templates/<name>/
|
|
24
24
|
|
|
25
|
-
Navigate to
|
|
25
|
+
Navigate to a package directory:
|
|
26
26
|
cd apps/<app-name>/
|
|
27
|
+
cd libraries/<lib-name>/
|
|
28
|
+
cd plugins/<plugin-name>/
|
|
29
|
+
cd app-templates/<template-name>/`);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Error when plugin.json is missing the required 'targets' field
|
|
33
|
+
*/
|
|
34
|
+
export class MissingPluginTargetsError extends Error {
|
|
35
|
+
constructor(pluginName) {
|
|
36
|
+
super(`Plugin '${pluginName}' is missing the required 'targets' field in plugin.json.
|
|
37
|
+
|
|
38
|
+
The plugin.json file must include a 'targets' array specifying which package types
|
|
39
|
+
the plugin can be installed into.
|
|
40
|
+
|
|
41
|
+
Example plugin.json:
|
|
42
|
+
{
|
|
43
|
+
"name": "${pluginName}",
|
|
44
|
+
"version": "1.0.0",
|
|
45
|
+
"targets": ["app", "library", "plugin", "app-template"],
|
|
46
|
+
"pluginDependencies": {},
|
|
47
|
+
"libraryDependencies": {}
|
|
48
|
+
}`);
|
|
49
|
+
this.name = 'MissingPluginTargetsError';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Factory function to create error when plugin targets don't match current location
|
|
54
|
+
*/
|
|
55
|
+
export function createInvalidTargetError(pluginName, currentTarget, allowedTargets) {
|
|
56
|
+
const targetLocations = allowedTargets.map((target) => {
|
|
57
|
+
switch (target) {
|
|
58
|
+
case 'app':
|
|
59
|
+
return 'apps/<name>/';
|
|
60
|
+
case 'library':
|
|
61
|
+
return 'libraries/<name>/';
|
|
62
|
+
case 'plugin':
|
|
63
|
+
return 'plugins/<name>/';
|
|
64
|
+
case 'app-template':
|
|
65
|
+
return 'app-templates/<name>/';
|
|
66
|
+
default:
|
|
67
|
+
return target;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return new InvalidPluginContextError(`Plugin '${pluginName}' cannot be installed in a '${currentTarget}' package.
|
|
71
|
+
|
|
72
|
+
This plugin can only be installed in: ${allowedTargets.join(', ')}
|
|
27
73
|
|
|
28
|
-
|
|
29
|
-
|
|
74
|
+
Allowed locations:
|
|
75
|
+
${targetLocations.map((loc) => ` ${loc}`).join('\n')}`);
|
|
30
76
|
}
|
|
31
77
|
export class PluginInstallationError extends Error {
|
|
32
78
|
cause;
|
|
@@ -36,4 +82,31 @@ export class PluginInstallationError extends Error {
|
|
|
36
82
|
this.name = 'PluginInstallationError';
|
|
37
83
|
}
|
|
38
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Error when plugin resolution fails
|
|
87
|
+
*/
|
|
88
|
+
export class PluginResolutionError extends Error {
|
|
89
|
+
constructor(pluginName, reason) {
|
|
90
|
+
super(`Failed to resolve plugin '${pluginName}': ${reason}`);
|
|
91
|
+
this.name = 'PluginResolutionError';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Error when npm package installation fails
|
|
96
|
+
*/
|
|
97
|
+
export class NpmInstallationError extends Error {
|
|
98
|
+
cause;
|
|
99
|
+
constructor(packageName, cause) {
|
|
100
|
+
super(`Failed to install npm package '${packageName}'.
|
|
101
|
+
|
|
102
|
+
Please check:
|
|
103
|
+
- Your internet connection
|
|
104
|
+
- npm registry access (https://registry.npmjs.org)
|
|
105
|
+
- Package exists: https://www.npmjs.com/package/${packageName}
|
|
106
|
+
|
|
107
|
+
${cause ? `\nOriginal error: ${cause.message}` : ''}`);
|
|
108
|
+
this.cause = cause;
|
|
109
|
+
this.name = 'NpmInstallationError';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
39
112
|
//# sourceMappingURL=plugin-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-errors.js","sourceRoot":"","sources":["../../../../src/modules/plugin/errors/plugin-errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,UAAkB;QAC5B,KAAK,CAAC,WAAW,UAAU;;qDAEsB,CAAC,CAAA;QAClD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IACzC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,eAAuB;IAC/D,OAAO,IAAI,yBAAyB,CAClC;;oBAEgB,eAAe;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin-errors.js","sourceRoot":"","sources":["../../../../src/modules/plugin/errors/plugin-errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,UAAkB;QAC5B,KAAK,CAAC,WAAW,UAAU;;qDAEsB,CAAC,CAAA;QAClD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IACzC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,eAAuB;IAC/D,OAAO,IAAI,yBAAyB,CAClC;;oBAEgB,eAAe;;;;;;;oCAOC,CACjC,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,UAAkB;QAC5B,KAAK,CAAC,WAAW,UAAU;;;;;;;aAOlB,UAAU;;;;;EAKrB,CAAC,CAAA;QACC,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IACzC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAAkB,EAAE,aAAqB,EAAE,cAAwB;IAC1G,MAAM,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACpD,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,KAAK;gBACR,OAAO,cAAc,CAAA;YACvB,KAAK,SAAS;gBACZ,OAAO,mBAAmB,CAAA;YAC5B,KAAK,QAAQ;gBACX,OAAO,iBAAiB,CAAA;YAC1B,KAAK,cAAc;gBACjB,OAAO,uBAAuB,CAAA;YAChC;gBACE,OAAO,MAAM,CAAA;QACjB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,IAAI,yBAAyB,CAClC,WAAW,UAAU,+BAA+B,aAAa;;wCAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;;;EAG/D,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpD,CAAA;AACH,CAAC;AAED,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAG9B;IAFlB,YACE,OAAe,EACC,KAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAA;QAFE,UAAK,GAAL,KAAK,CAAQ;QAG7B,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;IACvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,UAAkB,EAAE,MAAc;QAC5C,KAAK,CAAC,6BAA6B,UAAU,MAAM,MAAM,EAAE,CAAC,CAAA;QAC5D,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAG3B;IAFlB,YACE,WAAmB,EACH,KAAa;QAE7B,KAAK,CAAC,kCAAkC,WAAW;;;;;kDAKL,WAAW;;EAE3D,KAAK,CAAC,CAAC,CAAC,qBAAqB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QATlC,UAAK,GAAL,KAAK,CAAQ;QAU7B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;IACpC,CAAC;CACF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { PluginService } from './services/plugin-svc.js';
|
|
2
|
+
export { PluginCreateService } from './services/plugin-create-service.js';
|
|
2
3
|
export type { InstallPluginRequest, InstallPluginResult, PluginMetadata, HookResult } from './types/plugin-types.js';
|
|
3
|
-
export { PluginNotFoundError, InvalidPluginContextError, PluginInstallationError } from './errors/plugin-errors.js';
|
|
4
|
+
export { PluginNotFoundError, InvalidPluginContextError, PluginInstallationError, PluginResolutionError, NpmInstallationError } from './errors/plugin-errors.js';
|
|
4
5
|
export { pluginInstallCommand } from './commands/plugin-install.js';
|
|
5
|
-
export {
|
|
6
|
+
export { pluginCreateCommand } from './commands/plugin-create.js';
|
|
7
|
+
export { listAvailablePlugins } from './lib/plugin-registry.js';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/plugin/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/plugin/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAGzE,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAGpH,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGhK,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Services
|
|
2
2
|
export { PluginService } from './services/plugin-svc.js';
|
|
3
|
+
export { PluginCreateService } from './services/plugin-create-service.js';
|
|
3
4
|
// Errors
|
|
4
|
-
export { PluginNotFoundError, InvalidPluginContextError, PluginInstallationError } from './errors/plugin-errors.js';
|
|
5
|
+
export { PluginNotFoundError, InvalidPluginContextError, PluginInstallationError, PluginResolutionError, NpmInstallationError } from './errors/plugin-errors.js';
|
|
5
6
|
// Commands
|
|
6
7
|
export { pluginInstallCommand } from './commands/plugin-install.js';
|
|
8
|
+
export { pluginCreateCommand } from './commands/plugin-create.js';
|
|
7
9
|
// Utilities
|
|
8
|
-
export {
|
|
10
|
+
export { listAvailablePlugins } from './lib/plugin-registry.js';
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/plugin/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/plugin/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAKzE,SAAS;AACT,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhK,WAAW;AACX,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,YAAY;AACZ,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* List all available plugins in the workspace
|
|
3
|
+
* Scans the workspace plugins/ directory for valid plugins
|
|
4
|
+
*
|
|
5
|
+
* @param workspaceRoot - The root directory of the Launch77 workspace
|
|
6
|
+
* @returns Array of plugin names found in the workspace
|
|
4
7
|
*/
|
|
5
|
-
export declare function
|
|
6
|
-
/**
|
|
7
|
-
* Check if a plugin exists
|
|
8
|
-
* A plugin must have: dist/generator.js and plugin.json
|
|
9
|
-
*/
|
|
10
|
-
export declare function pluginExists(pluginName: string): Promise<boolean>;
|
|
11
|
-
/**
|
|
12
|
-
* List all available plugins
|
|
13
|
-
*/
|
|
14
|
-
export declare function listAvailablePlugins(): Promise<string[]>;
|
|
8
|
+
export declare function listAvailablePlugins(workspaceRoot: string): Promise<string[]>;
|
|
15
9
|
//# sourceMappingURL=plugin-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-registry.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAwBnF"}
|
|
@@ -1,43 +1,26 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
2
|
import fs from 'fs-extra';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* List all available plugins in the workspace
|
|
5
|
+
* Scans the workspace plugins/ directory for valid plugins
|
|
6
|
+
*
|
|
7
|
+
* @param workspaceRoot - The root directory of the Launch77 workspace
|
|
8
|
+
* @returns Array of plugin names found in the workspace
|
|
7
9
|
*/
|
|
8
|
-
export function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
// From dist/modules/plugin/lib/ to dist/plugins/
|
|
12
|
-
const baseDir = path.join(__dirname, '../../../plugins');
|
|
13
|
-
return path.join(baseDir, pluginName);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Check if a plugin exists
|
|
17
|
-
* A plugin must have: dist/generator.js and plugin.json
|
|
18
|
-
*/
|
|
19
|
-
export async function pluginExists(pluginName) {
|
|
20
|
-
const pluginPath = getPluginPath(pluginName);
|
|
21
|
-
const hasGenerator = await fs.pathExists(path.join(pluginPath, 'dist/generator.js'));
|
|
22
|
-
const hasPluginJson = await fs.pathExists(path.join(pluginPath, 'plugin.json'));
|
|
23
|
-
return hasGenerator && hasPluginJson;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* List all available plugins
|
|
27
|
-
*/
|
|
28
|
-
export async function listAvailablePlugins() {
|
|
29
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
30
|
-
const __dirname = path.dirname(__filename);
|
|
31
|
-
const baseDir = path.join(__dirname, '../../../plugins');
|
|
32
|
-
if (!(await fs.pathExists(baseDir))) {
|
|
10
|
+
export async function listAvailablePlugins(workspaceRoot) {
|
|
11
|
+
const pluginsDir = path.join(workspaceRoot, 'plugins');
|
|
12
|
+
if (!(await fs.pathExists(pluginsDir))) {
|
|
33
13
|
return [];
|
|
34
14
|
}
|
|
35
|
-
const items = await fs.readdir(
|
|
15
|
+
const items = await fs.readdir(pluginsDir, { withFileTypes: true });
|
|
36
16
|
const plugins = [];
|
|
37
17
|
for (const item of items) {
|
|
38
18
|
if (item.isDirectory()) {
|
|
39
19
|
// Verify it's a valid plugin
|
|
40
|
-
|
|
20
|
+
const pluginPath = path.join(pluginsDir, item.name);
|
|
21
|
+
const hasPluginJson = await fs.pathExists(path.join(pluginPath, 'plugin.json'));
|
|
22
|
+
const hasGenerator = await fs.pathExists(path.join(pluginPath, 'dist/generator.js'));
|
|
23
|
+
if (hasPluginJson && hasGenerator) {
|
|
41
24
|
plugins.push(item.name);
|
|
42
25
|
}
|
|
43
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-registry.js","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin-registry.js","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,aAAqB;IAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;IAEtD,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;IACnE,MAAM,OAAO,GAAa,EAAE,CAAA;IAE5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,6BAA6B;YAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YACnD,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAA;YAC/E,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAA;YAEpF,IAAI,aAAa,IAAI,YAAY,EAAE,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ValidationResult } from '@launch77/plugin-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin resolution result
|
|
4
|
+
*/
|
|
5
|
+
export interface PluginResolution {
|
|
6
|
+
/** The source of the plugin */
|
|
7
|
+
source: 'local' | 'npm';
|
|
8
|
+
/** The resolved name/package to use */
|
|
9
|
+
resolvedName: string;
|
|
10
|
+
/** The local path if source is 'local' */
|
|
11
|
+
localPath?: string;
|
|
12
|
+
/** The npm package name if source is 'npm' */
|
|
13
|
+
npmPackage?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validate plugin input name
|
|
17
|
+
*
|
|
18
|
+
* Accepts:
|
|
19
|
+
* - Unscoped names (e.g., "release", "my-plugin")
|
|
20
|
+
* - Scoped npm packages (e.g., "@ibm/plugin-name")
|
|
21
|
+
*
|
|
22
|
+
* Rejects:
|
|
23
|
+
* - Invalid formats
|
|
24
|
+
* - Empty strings
|
|
25
|
+
* - Names with invalid characters
|
|
26
|
+
*
|
|
27
|
+
* @param name - The plugin name to validate
|
|
28
|
+
* @returns ValidationResult with isValid and optional error message
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* validatePluginInput('release') // { isValid: true }
|
|
32
|
+
* validatePluginInput('@ibm/analytics') // { isValid: true }
|
|
33
|
+
* validatePluginInput('@invalid') // { isValid: false, error: '...' }
|
|
34
|
+
*/
|
|
35
|
+
export declare function validatePluginInput(name: string): ValidationResult;
|
|
36
|
+
/**
|
|
37
|
+
* Convert an unscoped plugin name to an npm package name
|
|
38
|
+
*
|
|
39
|
+
* Rules:
|
|
40
|
+
* - Unscoped names: prefix with @launch77-shared/plugin-
|
|
41
|
+
* - Scoped names: use as-is
|
|
42
|
+
*
|
|
43
|
+
* @param name - The plugin name (must be validated first)
|
|
44
|
+
* @returns The npm package name
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* toNpmPackageName('release') // '@launch77-shared/plugin-release'
|
|
48
|
+
* toNpmPackageName('@ibm/analytics') // '@ibm/analytics'
|
|
49
|
+
*/
|
|
50
|
+
export declare function toNpmPackageName(name: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve plugin location from name
|
|
53
|
+
*
|
|
54
|
+
* Resolution order:
|
|
55
|
+
* 1. Check local workspace plugins directory
|
|
56
|
+
* 2. Resolve to npm package name
|
|
57
|
+
*
|
|
58
|
+
* @param name - The plugin name to resolve
|
|
59
|
+
* @param workspaceRoot - The workspace root directory
|
|
60
|
+
* @returns PluginResolution with source and resolved location
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Local plugin found
|
|
64
|
+
* await resolvePluginLocation('my-plugin', '/workspace')
|
|
65
|
+
* // { source: 'local', resolvedName: 'my-plugin', localPath: '/workspace/plugins/my-plugin' }
|
|
66
|
+
*
|
|
67
|
+
* // Not found locally, resolve to npm
|
|
68
|
+
* await resolvePluginLocation('release', '/workspace')
|
|
69
|
+
* // { source: 'npm', resolvedName: 'release', npmPackage: '@launch77-shared/plugin-release' }
|
|
70
|
+
*
|
|
71
|
+
* // Scoped package always resolves to npm
|
|
72
|
+
* await resolvePluginLocation('@ibm/analytics', '/workspace')
|
|
73
|
+
* // { source: 'npm', resolvedName: '@ibm/analytics', npmPackage: '@ibm/analytics' }
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolvePluginLocation(name: string, workspaceRoot: string): Promise<PluginResolution>;
|
|
76
|
+
//# sourceMappingURL=plugin-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-resolver.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-resolver.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,MAAM,EAAE,OAAO,GAAG,KAAK,CAAA;IACvB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAA;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CA2BlE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUrD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuC1G"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { parsePluginName, isValidNpmPackageName } from '@launch77/plugin-runtime';
|
|
4
|
+
/**
|
|
5
|
+
* Validate plugin input name
|
|
6
|
+
*
|
|
7
|
+
* Accepts:
|
|
8
|
+
* - Unscoped names (e.g., "release", "my-plugin")
|
|
9
|
+
* - Scoped npm packages (e.g., "@ibm/plugin-name")
|
|
10
|
+
*
|
|
11
|
+
* Rejects:
|
|
12
|
+
* - Invalid formats
|
|
13
|
+
* - Empty strings
|
|
14
|
+
* - Names with invalid characters
|
|
15
|
+
*
|
|
16
|
+
* @param name - The plugin name to validate
|
|
17
|
+
* @returns ValidationResult with isValid and optional error message
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* validatePluginInput('release') // { isValid: true }
|
|
21
|
+
* validatePluginInput('@ibm/analytics') // { isValid: true }
|
|
22
|
+
* validatePluginInput('@invalid') // { isValid: false, error: '...' }
|
|
23
|
+
*/
|
|
24
|
+
export function validatePluginInput(name) {
|
|
25
|
+
if (!name || name.trim().length === 0) {
|
|
26
|
+
return {
|
|
27
|
+
isValid: false,
|
|
28
|
+
error: 'Plugin name cannot be empty',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const trimmedName = name.trim();
|
|
32
|
+
// Parse the name to determine type and validate
|
|
33
|
+
const parsed = parsePluginName(trimmedName);
|
|
34
|
+
if (!parsed.isValid) {
|
|
35
|
+
return {
|
|
36
|
+
isValid: false,
|
|
37
|
+
error: parsed.error,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// If it's scoped, it must be a valid npm package name
|
|
41
|
+
if (parsed.type === 'scoped') {
|
|
42
|
+
return isValidNpmPackageName(trimmedName);
|
|
43
|
+
}
|
|
44
|
+
// Unscoped names are valid for both local and npm
|
|
45
|
+
return { isValid: true };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Convert an unscoped plugin name to an npm package name
|
|
49
|
+
*
|
|
50
|
+
* Rules:
|
|
51
|
+
* - Unscoped names: prefix with @launch77-shared/plugin-
|
|
52
|
+
* - Scoped names: use as-is
|
|
53
|
+
*
|
|
54
|
+
* @param name - The plugin name (must be validated first)
|
|
55
|
+
* @returns The npm package name
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* toNpmPackageName('release') // '@launch77-shared/plugin-release'
|
|
59
|
+
* toNpmPackageName('@ibm/analytics') // '@ibm/analytics'
|
|
60
|
+
*/
|
|
61
|
+
export function toNpmPackageName(name) {
|
|
62
|
+
const trimmedName = name.trim();
|
|
63
|
+
// If already scoped, use as-is
|
|
64
|
+
if (trimmedName.startsWith('@')) {
|
|
65
|
+
return trimmedName;
|
|
66
|
+
}
|
|
67
|
+
// Otherwise, convert to @launch77-shared/plugin-<name>
|
|
68
|
+
return `@launch77-shared/plugin-${trimmedName}`;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolve plugin location from name
|
|
72
|
+
*
|
|
73
|
+
* Resolution order:
|
|
74
|
+
* 1. Check local workspace plugins directory
|
|
75
|
+
* 2. Resolve to npm package name
|
|
76
|
+
*
|
|
77
|
+
* @param name - The plugin name to resolve
|
|
78
|
+
* @param workspaceRoot - The workspace root directory
|
|
79
|
+
* @returns PluginResolution with source and resolved location
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Local plugin found
|
|
83
|
+
* await resolvePluginLocation('my-plugin', '/workspace')
|
|
84
|
+
* // { source: 'local', resolvedName: 'my-plugin', localPath: '/workspace/plugins/my-plugin' }
|
|
85
|
+
*
|
|
86
|
+
* // Not found locally, resolve to npm
|
|
87
|
+
* await resolvePluginLocation('release', '/workspace')
|
|
88
|
+
* // { source: 'npm', resolvedName: 'release', npmPackage: '@launch77-shared/plugin-release' }
|
|
89
|
+
*
|
|
90
|
+
* // Scoped package always resolves to npm
|
|
91
|
+
* await resolvePluginLocation('@ibm/analytics', '/workspace')
|
|
92
|
+
* // { source: 'npm', resolvedName: '@ibm/analytics', npmPackage: '@ibm/analytics' }
|
|
93
|
+
*/
|
|
94
|
+
export async function resolvePluginLocation(name, workspaceRoot) {
|
|
95
|
+
const trimmedName = name.trim();
|
|
96
|
+
const parsed = parsePluginName(trimmedName);
|
|
97
|
+
// If scoped, always use npm (local plugins are never scoped)
|
|
98
|
+
if (parsed.type === 'scoped') {
|
|
99
|
+
return {
|
|
100
|
+
source: 'npm',
|
|
101
|
+
resolvedName: trimmedName,
|
|
102
|
+
npmPackage: trimmedName,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// Check local workspace plugins directory
|
|
106
|
+
const localPath = path.join(workspaceRoot, 'plugins', trimmedName);
|
|
107
|
+
const localExists = await fs.pathExists(localPath);
|
|
108
|
+
if (localExists) {
|
|
109
|
+
// Verify it's a valid plugin (has plugin.json and dist/generator.js)
|
|
110
|
+
const hasPluginJson = await fs.pathExists(path.join(localPath, 'plugin.json'));
|
|
111
|
+
const hasGenerator = await fs.pathExists(path.join(localPath, 'dist/generator.js'));
|
|
112
|
+
if (hasPluginJson && hasGenerator) {
|
|
113
|
+
return {
|
|
114
|
+
source: 'local',
|
|
115
|
+
resolvedName: trimmedName,
|
|
116
|
+
localPath,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Not found locally, resolve to npm package
|
|
121
|
+
const npmPackage = toNpmPackageName(trimmedName);
|
|
122
|
+
return {
|
|
123
|
+
source: 'npm',
|
|
124
|
+
resolvedName: trimmedName,
|
|
125
|
+
npmPackage,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=plugin-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-resolver.js","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAkBjF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,6BAA6B;SACrC,CAAA;IACH,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAE/B,gDAAgD;IAChD,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IAE3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAA;IACH,CAAC;IAED,sDAAsD;IACtD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAA;IAC3C,CAAC;IAED,kDAAkD;IAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAE/B,+BAA+B;IAC/B,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,uDAAuD;IACvD,OAAO,2BAA2B,WAAW,EAAE,CAAA;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAY,EAAE,aAAqB;IAC7E,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAC/B,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IAE3C,6DAA6D;IAC7D,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO;YACL,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,WAAW;YACzB,UAAU,EAAE,WAAW;SACxB,CAAA;IACH,CAAC;IAED,0CAA0C;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;IAClE,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;IAElD,IAAI,WAAW,EAAE,CAAC;QAChB,qEAAqE;QACrE,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAA;QAC9E,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAA;QAEnF,IAAI,aAAa,IAAI,YAAY,EAAE,CAAC;YAClC,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,YAAY,EAAE,WAAW;gBACzB,SAAS;aACV,CAAA;QACH,CAAC;IACH,CAAC;IAED,4CAA4C;IAC5C,MAAM,UAAU,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAA;IAEhD,OAAO;QACL,MAAM,EAAE,KAAK;QACb,YAAY,EAAE,WAAW;QACzB,UAAU;KACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-resolver.test.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-resolver.test.ts"],"names":[],"mappings":""}
|