@launch77/cli 1.2.0 ā 1.4.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/CHANGELOG.md +22 -0
- package/dist/cli.js +8 -1
- package/dist/cli.js.map +1 -1
- package/dist/infrastructure/git.d.ts +37 -0
- package/dist/infrastructure/git.d.ts.map +1 -0
- package/dist/infrastructure/git.js +82 -0
- package/dist/infrastructure/git.js.map +1 -0
- package/dist/infrastructure/github.d.ts +43 -0
- package/dist/infrastructure/github.d.ts.map +1 -0
- package/dist/infrastructure/github.js +89 -0
- package/dist/infrastructure/github.js.map +1 -0
- 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/catalog/schemas/catalog-ui-components.schema.json +2 -18
- package/dist/modules/git/commands/git-connect.d.ts +3 -0
- package/dist/modules/git/commands/git-connect.d.ts.map +1 -0
- package/dist/modules/git/commands/git-connect.js +156 -0
- package/dist/modules/git/commands/git-connect.js.map +1 -0
- package/dist/modules/git/errors/git-errors.d.ts +21 -0
- package/dist/modules/git/errors/git-errors.d.ts.map +1 -0
- package/dist/modules/git/errors/git-errors.js +41 -0
- package/dist/modules/git/errors/git-errors.js.map +1 -0
- package/dist/modules/git/index.d.ts +5 -0
- package/dist/modules/git/index.d.ts.map +1 -0
- package/dist/modules/git/index.js +8 -0
- package/dist/modules/git/index.js.map +1 -0
- package/dist/modules/git/services/git-service.d.ts +24 -0
- package/dist/modules/git/services/git-service.d.ts.map +1 -0
- package/dist/modules/git/services/git-service.js +56 -0
- package/dist/modules/git/services/git-service.js.map +1 -0
- package/dist/modules/git/services/github-service.d.ts +27 -0
- package/dist/modules/git/services/github-service.d.ts.map +1 -0
- package/dist/modules/git/services/github-service.js +45 -0
- package/dist/modules/git/services/github-service.js.map +1 -0
- 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 +8 -3
- package/dist/modules/plugin/services/plugin-svc.d.ts.map +1 -1
- package/dist/modules/plugin/services/plugin-svc.js +96 -15
- package/dist/modules/plugin/services/plugin-svc.js.map +1 -1
- 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/modules/workspace/commands/init-workspace.d.ts.map +1 -1
- package/dist/modules/workspace/commands/init-workspace.js +4 -5
- package/dist/modules/workspace/commands/init-workspace.js.map +1 -1
- package/dist/modules/workspace/services/workspace-service.d.ts +2 -1
- package/dist/modules/workspace/services/workspace-service.d.ts.map +1 -1
- package/dist/modules/workspace/services/workspace-service.js +27 -1
- package/dist/modules/workspace/services/workspace-service.js.map +1 -1
- package/dist/templates/plugin/README.md.hbs +39 -0
- package/dist/{plugins/theme/package.json ā templates/plugin/package.json.hbs} +5 -3
- 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/{plugins/theme ā templates/plugin}/tsup.config.ts +0 -1
- package/dist/templates/workspace/.github/workflows/ci.yml +102 -0
- package/dist/templates/workspace/package.json +16 -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 +7 -10
- package/src/cli.ts +10 -1
- package/src/infrastructure/git.ts +86 -0
- package/src/infrastructure/github.ts +111 -0
- 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 +183 -0
- package/src/modules/git/errors/git-errors.ts +44 -0
- package/src/modules/git/index.ts +9 -0
- package/src/modules/git/services/git-service.ts +63 -0
- package/src/modules/git/services/github-service.ts +52 -0
- 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.ts +108 -15
- 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/modules/workspace/commands/init-workspace.ts +4 -6
- package/src/modules/workspace/services/workspace-service.ts +30 -1
- 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 +102 -0
- package/templates/workspace/package.json +5 -0
- 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/app-templates/webapp/.env.ci +0 -6
- package/dist/app-templates/webapp/.env.example +0 -9
- package/dist/app-templates/webapp/.eslintrc.json +0 -6
- package/dist/app-templates/webapp/README.md.hbs +0 -80
- package/dist/app-templates/webapp/app/about/page.tsx.hbs +0 -41
- package/dist/app-templates/webapp/app/dashboard/page.tsx.hbs +0 -51
- package/dist/app-templates/webapp/app/globals.css +0 -31
- package/dist/app-templates/webapp/app/layout.tsx.hbs +0 -26
- package/dist/app-templates/webapp/app/page.tsx.hbs +0 -30
- package/dist/app-templates/webapp/next.config.js +0 -99
- package/dist/app-templates/webapp/package.json.hbs +0 -30
- package/dist/app-templates/webapp/postcss.config.js +0 -6
- package/dist/app-templates/webapp/tailwind.config.ts +0 -24
- package/dist/app-templates/webapp/tsconfig.json +0 -29
- package/dist/app-templates/webapp/vercel.json.hbs +0 -7
- package/dist/modules/catalog/schemas/schemas/catalog-ui-components.schema.json +0 -145
- package/dist/plugins/theme/plugin.json +0 -9
- package/dist/plugins/theme/src/generator.ts +0 -92
- package/dist/plugins/theme/src/utils/config-modifier.ts +0 -142
- package/dist/plugins/theme/src/utils/css-modifier.ts +0 -89
- package/dist/plugins/theme/templates/app/theme-test/page.tsx +0 -156
- package/dist/plugins/theme/templates/src/modules/theme/README.md +0 -209
- package/dist/plugins/theme/templates/src/modules/theme/config/brand.css +0 -23
- package/dist/plugins/theme/tsconfig.json +0 -14
- package/dist/templates/templates/startup/apps/.gitkeep +0 -8
- package/dist/templates/templates/workspace/.launch77/workspace.json +0 -3
- package/dist/templates/templates/workspace/README.md +0 -62
- package/dist/templates/templates/workspace/app-templates/.gitkeep +0 -1
- package/dist/templates/templates/workspace/apps/.gitkeep +0 -1
- package/dist/templates/templates/workspace/libraries/.gitkeep +0 -1
- package/dist/templates/templates/workspace/package.json +0 -31
- package/dist/templates/templates/workspace/plugins/.gitkeep +0 -1
- package/dist/templates/templates/workspace/tsconfig.json +0 -22
- package/dist/templates/templates/workspace/turbo.json +0 -25
- package/launch77-cli-1.2.0.tgz +0 -0
- package/src/modules/plugin/lib/launch77-workspace.code-workspace +0 -14
- /package/dist/templates/{templates/workspace ā workspace}/.eslintignore +0 -0
- /package/dist/templates/{templates/workspace ā workspace}/.eslintrc.js +0 -0
- /package/dist/templates/{templates/workspace ā workspace}/.husky/pre-push +0 -0
- /package/dist/templates/{templates/workspace ā workspace}/.lintstagedrc.json +0 -0
- /package/dist/templates/{templates/workspace ā workspace}/.prettierrc +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-resolver.test.js","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-resolver.test.ts"],"names":[],"mappings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AE,SAAS,CAAC,CAAC,CAAA;YAE9C,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAE9D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,MAAM,EAAE,KAAK;gBACb,YAAY,EAAE,SAAS;gBACvB,UAAU,EAAE,iCAAiC;aAC9C,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;YACxD,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;YAElE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,MAAM,EAAE,KAAK;gBACb,YAAY,EAAE,SAAS;gBACvB,UAAU,EAAE,iCAAiC;aAC9C,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Launch77Context } from '@launch77/plugin-runtime';
|
|
2
|
+
export interface CreatePluginRequest {
|
|
3
|
+
pluginName: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CreatePluginResult {
|
|
7
|
+
pluginName: string;
|
|
8
|
+
pluginPath: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class PluginCreateService {
|
|
11
|
+
/**
|
|
12
|
+
* Create a new plugin from template
|
|
13
|
+
*/
|
|
14
|
+
createPlugin(request: CreatePluginRequest, context: Launch77Context): Promise<CreatePluginResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=plugin-create-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-create-service.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/services/plugin-create-service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,qBAAa,mBAAmB;IAC9B;;OAEG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA4CxG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { validatePluginName } from '@launch77/plugin-runtime';
|
|
4
|
+
import { processTemplate, getPluginTemplatePath } from '../../../infrastructure/template.js';
|
|
5
|
+
import { toPascalCase } from '../../../utils/string.js';
|
|
6
|
+
export class PluginCreateService {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new plugin from template
|
|
9
|
+
*/
|
|
10
|
+
async createPlugin(request, context) {
|
|
11
|
+
const { pluginName, description } = request;
|
|
12
|
+
// 1. Validate plugin name
|
|
13
|
+
const nameValidation = validatePluginName(pluginName);
|
|
14
|
+
if (!nameValidation.isValid) {
|
|
15
|
+
throw new Error(nameValidation.error || 'Invalid plugin name');
|
|
16
|
+
}
|
|
17
|
+
// 2. Validate workspace context
|
|
18
|
+
if (!context.isValid) {
|
|
19
|
+
throw new Error('Must be run from within a Launch77 workspace');
|
|
20
|
+
}
|
|
21
|
+
// 3. Determine plugin path
|
|
22
|
+
const pluginPath = path.join(context.workspaceRoot, 'plugins', pluginName);
|
|
23
|
+
// 4. Check if plugin already exists
|
|
24
|
+
if (await fs.pathExists(pluginPath)) {
|
|
25
|
+
throw new Error(`Plugin '${pluginName}' already exists at ${pluginPath}`);
|
|
26
|
+
}
|
|
27
|
+
// 5. Get plugin template path
|
|
28
|
+
const templatePath = getPluginTemplatePath('plugin');
|
|
29
|
+
// 6. Check if template exists
|
|
30
|
+
if (!(await fs.pathExists(templatePath))) {
|
|
31
|
+
throw new Error(`Plugin template not found at ${templatePath}`);
|
|
32
|
+
}
|
|
33
|
+
// 7. Process template with context
|
|
34
|
+
await processTemplate(templatePath, pluginPath, {
|
|
35
|
+
appName: pluginName, // Required by TemplateContext but not used for plugin templates
|
|
36
|
+
pluginName,
|
|
37
|
+
pluginNamePascal: toPascalCase(pluginName),
|
|
38
|
+
workspaceName: context.workspaceName,
|
|
39
|
+
description: description || `Launch77 plugin for ${pluginName}`,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
pluginName,
|
|
43
|
+
pluginPath,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=plugin-create-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-create-service.js","sourceRoot":"","sources":["../../../../src/modules/plugin/services/plugin-create-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAcvD,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,OAA4B,EAAE,OAAwB;QACvE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,OAAO,CAAA;QAE3C,0BAA0B;QAC1B,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAA;QACrD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,qBAAqB,CAAC,CAAA;QAChE,CAAC;QAED,gCAAgC;QAChC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;QACjE,CAAC;QAED,2BAA2B;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;QAE1E,oCAAoC;QACpC,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,uBAAuB,UAAU,EAAE,CAAC,CAAA;QAC3E,CAAC;QAED,8BAA8B;QAC9B,MAAM,YAAY,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAA;QAEpD,8BAA8B;QAC9B,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,gCAAgC,YAAY,EAAE,CAAC,CAAA;QACjE,CAAC;QAED,mCAAmC;QACnC,MAAM,eAAe,CAAC,YAAY,EAAE,UAAU,EAAE;YAC9C,OAAO,EAAE,UAAU,EAAE,gEAAgE;YACrF,UAAU;YACV,gBAAgB,EAAE,YAAY,CAAC,UAAU,CAAC;YAC1C,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,WAAW,EAAE,WAAW,IAAI,uBAAuB,UAAU,EAAE;SAChE,CAAC,CAAA;QAEF,OAAO;YACL,UAAU;YACV,UAAU;SACX,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type { Launch77Context } from '
|
|
1
|
+
import type { Launch77Context } from '@launch77/plugin-runtime';
|
|
2
2
|
import type { InstallPluginRequest, InstallPluginResult } from '../types/plugin-types.js';
|
|
3
3
|
export declare class PluginService {
|
|
4
4
|
/**
|
|
5
|
-
* Install a plugin to the current
|
|
5
|
+
* Install a plugin to the current package
|
|
6
6
|
*/
|
|
7
|
-
installPlugin(request: InstallPluginRequest, context: Launch77Context): Promise<InstallPluginResult>;
|
|
7
|
+
installPlugin(request: InstallPluginRequest, context: Launch77Context, logger?: (message: string) => void): Promise<InstallPluginResult>;
|
|
8
|
+
/**
|
|
9
|
+
* Download and install an npm plugin package
|
|
10
|
+
*/
|
|
11
|
+
private downloadNpmPlugin;
|
|
12
|
+
private getPackagePath;
|
|
8
13
|
private runGenerator;
|
|
9
14
|
}
|
|
10
15
|
//# sourceMappingURL=plugin-svc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-svc.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/services/plugin-svc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-svc.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugin/services/plugin-svc.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAA;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAoBzF,qBAAa,aAAa;IACxB;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA8D3J;;OAEG;YACW,iBAAiB;IAkB/B,OAAO,CAAC,cAAc;YAgBR,YAAY;CAY3B"}
|
|
@@ -1,26 +1,73 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
+
import chalk from 'chalk';
|
|
2
3
|
import { execa } from 'execa';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { readPluginMetadata } from '@launch77/plugin-runtime';
|
|
5
|
+
import { PluginInstallationError, InvalidPluginContextError, createInvalidContextError, MissingPluginTargetsError, createInvalidTargetError, NpmInstallationError, PluginResolutionError } from '../errors/plugin-errors.js';
|
|
6
|
+
import { validatePluginInput, resolvePluginLocation } from '../lib/plugin-resolver.js';
|
|
7
|
+
/**
|
|
8
|
+
* Map location type to target string
|
|
9
|
+
*/
|
|
10
|
+
function locationTypeToTarget(locationType) {
|
|
11
|
+
switch (locationType) {
|
|
12
|
+
case 'workspace-app':
|
|
13
|
+
return 'app';
|
|
14
|
+
case 'workspace-library':
|
|
15
|
+
return 'library';
|
|
16
|
+
case 'workspace-plugin':
|
|
17
|
+
return 'plugin';
|
|
18
|
+
case 'workspace-app-template':
|
|
19
|
+
return 'app-template';
|
|
20
|
+
default:
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
5
24
|
export class PluginService {
|
|
6
25
|
/**
|
|
7
|
-
* Install a plugin to the current
|
|
26
|
+
* Install a plugin to the current package
|
|
8
27
|
*/
|
|
9
|
-
async installPlugin(request, context) {
|
|
28
|
+
async installPlugin(request, context, logger = console.log) {
|
|
10
29
|
const { pluginName } = request;
|
|
11
|
-
//
|
|
12
|
-
|
|
30
|
+
// Must be in a package directory (app, library, plugin, or app-template)
|
|
31
|
+
const currentTarget = locationTypeToTarget(context.locationType);
|
|
32
|
+
if (!currentTarget)
|
|
13
33
|
throw createInvalidContextError(context.locationType);
|
|
14
34
|
if (!context.appName)
|
|
15
|
-
throw new InvalidPluginContextError('Could not determine
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
throw new InvalidPluginContextError('Could not determine package name. This is a bug. Please report it.');
|
|
36
|
+
// Step 1: Validate plugin input
|
|
37
|
+
logger(chalk.blue(`\nš Resolving plugin "${pluginName}"...`));
|
|
38
|
+
logger(` āā Validating plugin name...`);
|
|
39
|
+
const validation = validatePluginInput(pluginName);
|
|
40
|
+
if (!validation.isValid) {
|
|
41
|
+
throw new PluginResolutionError(pluginName, validation.error || 'Invalid plugin name');
|
|
42
|
+
}
|
|
43
|
+
logger(` ā āā ${chalk.green('ā')} Valid plugin name`);
|
|
44
|
+
// Step 2: Resolve plugin location
|
|
45
|
+
logger(` āā Checking local workspace: ${chalk.dim(`plugins/${pluginName}`)}`);
|
|
46
|
+
const resolution = await resolvePluginLocation(pluginName, context.workspaceRoot);
|
|
47
|
+
let pluginPath;
|
|
48
|
+
if (resolution.source === 'local') {
|
|
49
|
+
logger(` ā āā ${chalk.green('ā')} Found local plugin`);
|
|
50
|
+
pluginPath = resolution.localPath;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
logger(` ā āā ${chalk.dim('Not found locally')}`);
|
|
54
|
+
logger(` āā Resolving to npm package: ${chalk.cyan(resolution.npmPackage)}`);
|
|
55
|
+
// Download npm plugin
|
|
56
|
+
pluginPath = await this.downloadNpmPlugin(resolution.npmPackage, context.workspaceRoot, logger);
|
|
57
|
+
}
|
|
58
|
+
logger(` āā ${chalk.green('ā')} Plugin resolved\n`);
|
|
59
|
+
// Step 3: Read plugin metadata and validate targets
|
|
60
|
+
const metadata = await readPluginMetadata(pluginPath);
|
|
61
|
+
if (!metadata.targets || metadata.targets.length === 0) {
|
|
62
|
+
throw new MissingPluginTargetsError(pluginName);
|
|
63
|
+
}
|
|
64
|
+
if (!metadata.targets.includes(currentTarget)) {
|
|
65
|
+
throw createInvalidTargetError(pluginName, currentTarget, metadata.targets);
|
|
66
|
+
}
|
|
67
|
+
// Step 4: Get package directory path
|
|
68
|
+
const packagePath = this.getPackagePath(context);
|
|
69
|
+
// Step 5: Run generator
|
|
70
|
+
await this.runGenerator(pluginPath, packagePath, context);
|
|
24
71
|
return {
|
|
25
72
|
pluginName,
|
|
26
73
|
filesInstalled: true,
|
|
@@ -28,6 +75,40 @@ export class PluginService {
|
|
|
28
75
|
dependenciesInstalled: true,
|
|
29
76
|
};
|
|
30
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Download and install an npm plugin package
|
|
80
|
+
*/
|
|
81
|
+
async downloadNpmPlugin(npmPackage, workspaceRoot, logger) {
|
|
82
|
+
logger(` āā Installing from npm: ${chalk.cyan(npmPackage)}...`);
|
|
83
|
+
try {
|
|
84
|
+
// Install the npm package to the workspace
|
|
85
|
+
await execa('npm', ['install', npmPackage, '--save-dev'], {
|
|
86
|
+
cwd: workspaceRoot,
|
|
87
|
+
stdio: 'pipe', // Capture output for clean logging
|
|
88
|
+
});
|
|
89
|
+
// Return path to installed plugin in node_modules
|
|
90
|
+
const pluginPath = path.join(workspaceRoot, 'node_modules', npmPackage);
|
|
91
|
+
return pluginPath;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
throw new NpmInstallationError(npmPackage, error instanceof Error ? error : undefined);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
getPackagePath(context) {
|
|
98
|
+
// Determine the base directory based on location type
|
|
99
|
+
switch (context.locationType) {
|
|
100
|
+
case 'workspace-app':
|
|
101
|
+
return path.join(context.appsDir, context.appName);
|
|
102
|
+
case 'workspace-library':
|
|
103
|
+
return path.join(context.workspaceRoot, 'libraries', context.appName);
|
|
104
|
+
case 'workspace-plugin':
|
|
105
|
+
return path.join(context.workspaceRoot, 'plugins', context.appName);
|
|
106
|
+
case 'workspace-app-template':
|
|
107
|
+
return path.join(context.workspaceRoot, 'app-templates', context.appName);
|
|
108
|
+
default:
|
|
109
|
+
throw new InvalidPluginContextError(`Cannot install plugin from ${context.locationType}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
31
112
|
async runGenerator(pluginPath, appPath, context) {
|
|
32
113
|
try {
|
|
33
114
|
const generatorPath = path.join(pluginPath, 'dist/generator.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-svc.js","sourceRoot":"","sources":["../../../../src/modules/plugin/services/plugin-svc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;
|
|
1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AAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,uBAAuB,CAAC,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAC9J,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-init.d.ts","sourceRoot":"","sources":["../../../../src/modules/release/commands/release-init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC,wBAAgB,kBAAkB,IAAI,OAAO,CA4F5C"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { detectLaunch77Context } from '@launch77/plugin-runtime';
|
|
5
|
+
import { GitService, GitHubService, GitHubCLINotInstalledError, GitHubNotAuthenticatedError, NotInWorkspaceError, GitHubNotConnectedError } from '../../git/index.js';
|
|
6
|
+
import { ReleaseService } from '../services/release-service.js';
|
|
7
|
+
import { ChangesetNotInitializedError } from '../errors/release-errors.js';
|
|
8
|
+
export function releaseInitCommand() {
|
|
9
|
+
return new Command('release:init').description('Initialize complete release workflow setup').action(async () => {
|
|
10
|
+
console.log(chalk.blue('\nš Initializing release workflow...\n'));
|
|
11
|
+
const cwd = process.cwd();
|
|
12
|
+
const gitService = new GitService();
|
|
13
|
+
const githubService = new GitHubService();
|
|
14
|
+
const releaseService = new ReleaseService(githubService);
|
|
15
|
+
try {
|
|
16
|
+
// 1. Verify we're in a workspace root
|
|
17
|
+
const context = await detectLaunch77Context(cwd);
|
|
18
|
+
if (!context.isValid || context.locationType !== 'workspace-root') {
|
|
19
|
+
throw new NotInWorkspaceError(cwd);
|
|
20
|
+
}
|
|
21
|
+
// 2. Verify prerequisites (GitHub CLI installed and authenticated)
|
|
22
|
+
const spinner = ora('Checking prerequisites...').start();
|
|
23
|
+
await githubService.verifyPrerequisites();
|
|
24
|
+
spinner.succeed('Prerequisites verified');
|
|
25
|
+
// 3. Ensure connected to GitHub
|
|
26
|
+
try {
|
|
27
|
+
await gitService.ensureConnectedToGitHub(context.workspaceRoot);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error instanceof GitHubNotConnectedError) {
|
|
31
|
+
console.error(chalk.red(`\nā ${error.message}\n`));
|
|
32
|
+
console.log(chalk.gray(` Connect to GitHub first: ${chalk.cyan('launch77 git:connect')}\n`));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
// 4. Get repository information
|
|
38
|
+
const repoSpinner = ora('Detecting repository...').start();
|
|
39
|
+
const { owner, repo } = await githubService.getCurrentRepository(context.workspaceRoot);
|
|
40
|
+
repoSpinner.succeed(`Repository: ${owner}/${repo}`);
|
|
41
|
+
// 5. Fix changeset config access setting
|
|
42
|
+
console.log(chalk.cyan('\nš Configuring changesets...\n'));
|
|
43
|
+
try {
|
|
44
|
+
const changesetSpinner = ora('Checking changeset configuration...').start();
|
|
45
|
+
const wasChanged = await releaseService.fixChangesetAccess(context.workspaceRoot);
|
|
46
|
+
if (wasChanged) {
|
|
47
|
+
changesetSpinner.succeed('Updated .changeset/config.json access to "public"');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
changesetSpinner.succeed('Changeset already configured correctly');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (error instanceof ChangesetNotInitializedError) {
|
|
55
|
+
console.error(chalk.red(`\nā ${error.message}\n`));
|
|
56
|
+
console.log(chalk.gray(' Changesets should be initialized during workspace creation.'));
|
|
57
|
+
console.log(chalk.gray(` Run manually: ${chalk.cyan('npx changeset init')}\n`));
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
// 6. Setup RELEASE_TOKEN
|
|
63
|
+
releaseService.explainReleaseToken();
|
|
64
|
+
const token = await releaseService.promptForReleaseToken();
|
|
65
|
+
await releaseService.setupReleaseToken(owner, repo, token);
|
|
66
|
+
// 7. Guide npm Trusted Publishing setup
|
|
67
|
+
releaseService.explainNpmTrustedPublishing();
|
|
68
|
+
// 8. Show success summary
|
|
69
|
+
releaseService.showSuccessSummary();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error instanceof GitHubCLINotInstalledError) {
|
|
73
|
+
console.error(chalk.red(`\nā ${error.message}\n`));
|
|
74
|
+
console.log(chalk.gray(` Install with: ${chalk.cyan('brew install gh')}\n`));
|
|
75
|
+
console.log(chalk.gray(` Or visit: ${chalk.cyan('https://cli.github.com/')}\n`));
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
if (error instanceof GitHubNotAuthenticatedError) {
|
|
79
|
+
console.error(chalk.red(`\nā ${error.message}\n`));
|
|
80
|
+
console.log(chalk.gray(` Authenticate with: ${chalk.cyan('gh auth login')}\n`));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
if (error instanceof NotInWorkspaceError) {
|
|
84
|
+
console.error(chalk.red(`\nā ${error.message}\n`));
|
|
85
|
+
console.log(chalk.gray(` This command must be run from a Launch77 workspace root directory\n`));
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=release-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-init.js","sourceRoot":"","sources":["../../../../src/modules/release/commands/release-init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,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CAAC,CAAA;gBAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;YAED,IAAI,KAAK,YAAY,2BAA2B,EAAE,CAAC;gBACjD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAA;gBAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAA;gBACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;YAED,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;gBACzC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAA;gBAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,wEAAwE,CAAC,CAAC,CAAA;gBACjG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;YAED,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-errors.d.ts","sourceRoot":"","sources":["../../../../src/modules/release/errors/release-errors.ts"],"names":[],"mappings":"AAAA,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,4BAA6B,SAAQ,KAAK;;CAKtD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class InvalidReleaseTokenError extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'InvalidReleaseTokenError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class ChangesetNotInitializedError extends Error {
|
|
8
|
+
constructor() {
|
|
9
|
+
super('Changesets are not initialized in this workspace');
|
|
10
|
+
this.name = 'ChangesetNotInitializedError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=release-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-errors.js","sourceRoot":"","sources":["../../../../src/modules/release/errors/release-errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACrD;QACE,KAAK,CAAC,kDAAkD,CAAC,CAAA;QACzD,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAA;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/release/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAG9D,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AAGnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Services
|
|
2
|
+
export { ReleaseService } from './services/release-service.js';
|
|
3
|
+
// Errors
|
|
4
|
+
export { InvalidReleaseTokenError, ChangesetNotInitializedError } from './errors/release-errors.js';
|
|
5
|
+
// Commands
|
|
6
|
+
export { releaseInitCommand } from './commands/release-init.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/release/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,SAAS;AACT,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AAEnG,WAAW;AACX,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GitHubService } from '../../git/index.js';
|
|
2
|
+
export declare class ReleaseService {
|
|
3
|
+
private githubService;
|
|
4
|
+
constructor(githubService?: GitHubService);
|
|
5
|
+
/**
|
|
6
|
+
* Validate GitHub Personal Access Token format
|
|
7
|
+
*/
|
|
8
|
+
validateReleaseToken(token: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Explain what RELEASE_TOKEN is and why it's needed
|
|
11
|
+
*/
|
|
12
|
+
explainReleaseToken(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Prompt user for RELEASE_TOKEN
|
|
15
|
+
*/
|
|
16
|
+
promptForReleaseToken(): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Setup RELEASE_TOKEN secret in GitHub repository
|
|
19
|
+
*/
|
|
20
|
+
setupReleaseToken(owner: string, repo: string, token: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Fix changeset config to set access to "public"
|
|
23
|
+
*/
|
|
24
|
+
fixChangesetAccess(workspaceRoot: string): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Explain npm Trusted Publishing (OIDC)
|
|
27
|
+
*/
|
|
28
|
+
explainNpmTrustedPublishing(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Show success summary for release setup
|
|
31
|
+
*/
|
|
32
|
+
showSuccessSummary(): void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=release-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-service.d.ts","sourceRoot":"","sources":["../../../../src/modules/release/services/release-service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,qBAAa,cAAc;IACb,OAAO,CAAC,aAAa;gBAAb,aAAa,GAAE,aAAmC;IAEtE;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAWzC;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAoB3B;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;IAkB9C;;OAEG;IACG,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BlF;;OAEG;IACG,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA4BjE;;OAEG;IACH,2BAA2B,IAAI,IAAI;IAsBnC;;OAEG;IACH,kBAAkB,IAAI,IAAI;CAW3B"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { password, confirm } from '@inquirer/prompts';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import fs from 'fs/promises';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { GitHubService } from '../../git/index.js';
|
|
7
|
+
import { InvalidReleaseTokenError, ChangesetNotInitializedError } from '../errors/release-errors.js';
|
|
8
|
+
export class ReleaseService {
|
|
9
|
+
githubService;
|
|
10
|
+
constructor(githubService = new GitHubService()) {
|
|
11
|
+
this.githubService = githubService;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Validate GitHub Personal Access Token format
|
|
15
|
+
*/
|
|
16
|
+
validateReleaseToken(token) {
|
|
17
|
+
if (!token || token.trim().length === 0) {
|
|
18
|
+
throw new InvalidReleaseTokenError('Token cannot be empty');
|
|
19
|
+
}
|
|
20
|
+
// GitHub PATs start with specific prefixes
|
|
21
|
+
if (!token.startsWith('ghp_') && !token.startsWith('github_pat_')) {
|
|
22
|
+
throw new InvalidReleaseTokenError('Invalid token format. GitHub PATs should start with "ghp_" or "github_pat_"');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Explain what RELEASE_TOKEN is and why it's needed
|
|
27
|
+
*/
|
|
28
|
+
explainReleaseToken() {
|
|
29
|
+
console.log(chalk.cyan('\nš About RELEASE_TOKEN:\n'));
|
|
30
|
+
console.log(chalk.white('The RELEASE_TOKEN is a GitHub Personal Access Token (PAT) that allows'));
|
|
31
|
+
console.log(chalk.white('the Changesets action to create Pull Requests for version updates.\n'));
|
|
32
|
+
console.log(chalk.white('Why is this needed?'));
|
|
33
|
+
console.log(chalk.gray(' ⢠The default GITHUB_TOKEN has limited permissions'));
|
|
34
|
+
console.log(chalk.gray(' ⢠Creating PRs that trigger CI requires a PAT'));
|
|
35
|
+
console.log(chalk.gray(' ⢠This enables automated release workflows\n'));
|
|
36
|
+
console.log(chalk.white('Required permissions:'));
|
|
37
|
+
console.log(chalk.gray(' ⢠Contents: Read and write'));
|
|
38
|
+
console.log(chalk.gray(' ⢠Pull requests: Read and write\n'));
|
|
39
|
+
// Provide link to create PAT
|
|
40
|
+
const tokenUrl = 'https://github.com/settings/personal-access-tokens/new';
|
|
41
|
+
console.log(chalk.cyan('š Create your token:'));
|
|
42
|
+
console.log(chalk.gray(` ${chalk.cyan(tokenUrl)}`));
|
|
43
|
+
console.log(chalk.gray(` Name: Launch77 Release Token`));
|
|
44
|
+
console.log(chalk.gray(` Permissions: Contents (Read and write), Pull requests (Read and write)\n`));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Prompt user for RELEASE_TOKEN
|
|
48
|
+
*/
|
|
49
|
+
async promptForReleaseToken() {
|
|
50
|
+
return password({
|
|
51
|
+
message: 'Paste your Personal Access Token (PAT):',
|
|
52
|
+
mask: '*',
|
|
53
|
+
validate: (value) => {
|
|
54
|
+
try {
|
|
55
|
+
this.validateReleaseToken(value);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error instanceof InvalidReleaseTokenError) {
|
|
60
|
+
return error.message;
|
|
61
|
+
}
|
|
62
|
+
return 'Invalid token';
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Setup RELEASE_TOKEN secret in GitHub repository
|
|
69
|
+
*/
|
|
70
|
+
async setupReleaseToken(owner, repo, token) {
|
|
71
|
+
this.validateReleaseToken(token);
|
|
72
|
+
// Confirm before setting
|
|
73
|
+
console.log(chalk.yellow('\nā Note: This will overwrite any existing RELEASE_TOKEN secret\n'));
|
|
74
|
+
const shouldContinue = await confirm({
|
|
75
|
+
message: 'Continue and set RELEASE_TOKEN?',
|
|
76
|
+
default: true,
|
|
77
|
+
});
|
|
78
|
+
if (!shouldContinue) {
|
|
79
|
+
console.log(chalk.green('\nā
No changes made.\n'));
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
82
|
+
// Set the secret
|
|
83
|
+
const setSpinner = ora('Setting RELEASE_TOKEN secret...').start();
|
|
84
|
+
try {
|
|
85
|
+
await this.githubService.setRepositorySecret(owner, repo, 'RELEASE_TOKEN', token);
|
|
86
|
+
setSpinner.succeed('RELEASE_TOKEN configured successfully!');
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
setSpinner.fail('Failed to set RELEASE_TOKEN');
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Fix changeset config to set access to "public"
|
|
95
|
+
*/
|
|
96
|
+
async fixChangesetAccess(workspaceRoot) {
|
|
97
|
+
const configPath = path.join(workspaceRoot, '.changeset', 'config.json');
|
|
98
|
+
try {
|
|
99
|
+
// Check if config exists
|
|
100
|
+
const configContent = await fs.readFile(configPath, 'utf-8');
|
|
101
|
+
const config = JSON.parse(configContent);
|
|
102
|
+
// Check if already public
|
|
103
|
+
if (config.access === 'public') {
|
|
104
|
+
return false; // No change needed
|
|
105
|
+
}
|
|
106
|
+
// Update to public
|
|
107
|
+
config.access = 'public';
|
|
108
|
+
// Write back
|
|
109
|
+
await fs.writeFile(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
110
|
+
return true; // Changed
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error.code === 'ENOENT') {
|
|
114
|
+
throw new ChangesetNotInitializedError();
|
|
115
|
+
}
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Explain npm Trusted Publishing (OIDC)
|
|
121
|
+
*/
|
|
122
|
+
explainNpmTrustedPublishing() {
|
|
123
|
+
console.log(chalk.cyan('\nš¦ Setting up npm publishing with Trusted Publishers (OIDC):\n'));
|
|
124
|
+
console.log(chalk.white('Trusted Publishing uses OpenID Connect (OIDC) for secure, token-free publishing.'));
|
|
125
|
+
console.log(chalk.white('This is the recommended approach (no tokens to manage or expire).\n'));
|
|
126
|
+
console.log(chalk.white('Steps to configure:'));
|
|
127
|
+
console.log(chalk.gray(' 1. Visit: https://www.npmjs.com/settings/~/publishers'));
|
|
128
|
+
console.log(chalk.gray(' 2. Click "Add a trusted publisher"'));
|
|
129
|
+
console.log(chalk.gray(' 3. Select "GitHub Actions"'));
|
|
130
|
+
console.log(chalk.gray(' 4. Enter your repository information:'));
|
|
131
|
+
console.log(chalk.gray(' - Repository owner (your GitHub username or org)'));
|
|
132
|
+
console.log(chalk.gray(' - Repository name'));
|
|
133
|
+
console.log(chalk.gray(' - Workflow file: .github/workflows/ci.yml'));
|
|
134
|
+
console.log(chalk.gray(' 5. Save the configuration\n'));
|
|
135
|
+
console.log(chalk.white('Your GitHub workflow already has the required permission:'));
|
|
136
|
+
console.log(chalk.gray(' ā id-token: write\n'));
|
|
137
|
+
console.log(chalk.cyan('š Learn more:'));
|
|
138
|
+
console.log(chalk.gray(' https://docs.npmjs.com/trusted-publishers/\n'));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Show success summary for release setup
|
|
142
|
+
*/
|
|
143
|
+
showSuccessSummary() {
|
|
144
|
+
console.log(chalk.green('\nā
Release automation is ready!\n'));
|
|
145
|
+
console.log(chalk.white('What happens now:'));
|
|
146
|
+
console.log(chalk.gray(' ⢠When you push to main, CI runs as usual'));
|
|
147
|
+
console.log(chalk.gray(' ⢠Changesets detects version changes'));
|
|
148
|
+
console.log(chalk.gray(' ⢠A "Version Packages" PR is created automatically'));
|
|
149
|
+
console.log(chalk.gray(' ⢠Merge the PR to publish your packages\n'));
|
|
150
|
+
console.log(chalk.cyan('š Learn more:'));
|
|
151
|
+
console.log(chalk.gray(` ${chalk.cyan('https://github.com/changesets/changesets')}\n`));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=release-service.js.map
|