@launch77/cli 1.3.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 +11 -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 +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/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 +1 -0
- 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.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/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 +1 -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/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
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import { validatePluginInput, toNpmPackageName, resolvePluginLocation } from './plugin-resolver.js';
|
|
6
|
+
describe('Plugin Resolver', () => {
|
|
7
|
+
describe('validatePluginInput', () => {
|
|
8
|
+
it('should accept valid unscoped plugin names', () => {
|
|
9
|
+
expect(validatePluginInput('release')).toEqual({ isValid: true });
|
|
10
|
+
expect(validatePluginInput('my-plugin')).toEqual({ isValid: true });
|
|
11
|
+
expect(validatePluginInput('analytics-v2')).toEqual({ isValid: true });
|
|
12
|
+
});
|
|
13
|
+
it('should accept valid scoped npm packages', () => {
|
|
14
|
+
expect(validatePluginInput('@ibm/plugin-name')).toEqual({ isValid: true });
|
|
15
|
+
expect(validatePluginInput('@launch77-shared/plugin-release')).toEqual({ isValid: true });
|
|
16
|
+
expect(validatePluginInput('@org/analytics')).toEqual({ isValid: true });
|
|
17
|
+
});
|
|
18
|
+
it('should reject empty names', () => {
|
|
19
|
+
const result = validatePluginInput('');
|
|
20
|
+
expect(result.isValid).toBe(false);
|
|
21
|
+
expect(result.error).toBeDefined();
|
|
22
|
+
});
|
|
23
|
+
it('should reject whitespace-only names', () => {
|
|
24
|
+
const result = validatePluginInput(' ');
|
|
25
|
+
expect(result.isValid).toBe(false);
|
|
26
|
+
expect(result.error).toBeDefined();
|
|
27
|
+
});
|
|
28
|
+
it('should reject invalid scoped packages', () => {
|
|
29
|
+
const result1 = validatePluginInput('@invalid');
|
|
30
|
+
expect(result1.isValid).toBe(false);
|
|
31
|
+
expect(result1.error).toBeDefined();
|
|
32
|
+
const result2 = validatePluginInput('@/package');
|
|
33
|
+
expect(result2.isValid).toBe(false);
|
|
34
|
+
expect(result2.error).toBeDefined();
|
|
35
|
+
const result3 = validatePluginInput('@org/');
|
|
36
|
+
expect(result3.isValid).toBe(false);
|
|
37
|
+
expect(result3.error).toBeDefined();
|
|
38
|
+
});
|
|
39
|
+
it('should reject names with uppercase letters', () => {
|
|
40
|
+
const result = validatePluginInput('MyPlugin');
|
|
41
|
+
expect(result.isValid).toBe(false);
|
|
42
|
+
expect(result.error).toContain('lowercase');
|
|
43
|
+
});
|
|
44
|
+
it('should reject names starting with numbers', () => {
|
|
45
|
+
const result = validatePluginInput('123plugin');
|
|
46
|
+
expect(result.isValid).toBe(false);
|
|
47
|
+
expect(result.error).toBeDefined();
|
|
48
|
+
});
|
|
49
|
+
it('should reject names with special characters', () => {
|
|
50
|
+
const result1 = validatePluginInput('plugin_name');
|
|
51
|
+
expect(result1.isValid).toBe(false);
|
|
52
|
+
const result2 = validatePluginInput('plugin.name');
|
|
53
|
+
expect(result2.isValid).toBe(false);
|
|
54
|
+
const result3 = validatePluginInput('plugin name');
|
|
55
|
+
expect(result3.isValid).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
it('should trim whitespace before validation', () => {
|
|
58
|
+
expect(validatePluginInput(' release ')).toEqual({ isValid: true });
|
|
59
|
+
expect(validatePluginInput(' @ibm/analytics ')).toEqual({ isValid: true });
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('toNpmPackageName', () => {
|
|
63
|
+
it('should prefix unscoped names with @launch77-shared/plugin-', () => {
|
|
64
|
+
expect(toNpmPackageName('release')).toBe('@launch77-shared/plugin-release');
|
|
65
|
+
expect(toNpmPackageName('my-plugin')).toBe('@launch77-shared/plugin-my-plugin');
|
|
66
|
+
expect(toNpmPackageName('analytics-v2')).toBe('@launch77-shared/plugin-analytics-v2');
|
|
67
|
+
});
|
|
68
|
+
it('should return scoped packages as-is', () => {
|
|
69
|
+
expect(toNpmPackageName('@ibm/analytics')).toBe('@ibm/analytics');
|
|
70
|
+
expect(toNpmPackageName('@launch77-shared/plugin-release')).toBe('@launch77-shared/plugin-release');
|
|
71
|
+
expect(toNpmPackageName('@org/package')).toBe('@org/package');
|
|
72
|
+
});
|
|
73
|
+
it('should trim whitespace', () => {
|
|
74
|
+
expect(toNpmPackageName(' release ')).toBe('@launch77-shared/plugin-release');
|
|
75
|
+
expect(toNpmPackageName(' @ibm/analytics ')).toBe('@ibm/analytics');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('resolvePluginLocation', () => {
|
|
79
|
+
let tempDir;
|
|
80
|
+
beforeEach(async () => {
|
|
81
|
+
// Create a temporary workspace directory
|
|
82
|
+
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'plugin-resolver-test-'));
|
|
83
|
+
await fs.ensureDir(path.join(tempDir, 'plugins'));
|
|
84
|
+
});
|
|
85
|
+
afterEach(async () => {
|
|
86
|
+
// Clean up
|
|
87
|
+
await fs.remove(tempDir);
|
|
88
|
+
});
|
|
89
|
+
it('should resolve local plugins first', async () => {
|
|
90
|
+
// Create a valid local plugin
|
|
91
|
+
const pluginPath = path.join(tempDir, 'plugins', 'my-plugin');
|
|
92
|
+
await fs.ensureDir(pluginPath);
|
|
93
|
+
await fs.ensureDir(path.join(pluginPath, 'dist'));
|
|
94
|
+
await fs.writeFile(path.join(pluginPath, 'plugin.json'), JSON.stringify({ name: 'my-plugin', version: '1.0.0' }));
|
|
95
|
+
await fs.writeFile(path.join(pluginPath, 'dist/generator.js'), 'console.log("test")');
|
|
96
|
+
const result = await resolvePluginLocation('my-plugin', tempDir);
|
|
97
|
+
expect(result).toEqual({
|
|
98
|
+
source: 'local',
|
|
99
|
+
resolvedName: 'my-plugin',
|
|
100
|
+
localPath: pluginPath,
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
it('should resolve to npm if local plugin does not exist', async () => {
|
|
104
|
+
const result = await resolvePluginLocation('release', tempDir);
|
|
105
|
+
expect(result).toEqual({
|
|
106
|
+
source: 'npm',
|
|
107
|
+
resolvedName: 'release',
|
|
108
|
+
npmPackage: '@launch77-shared/plugin-release',
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
it('should resolve to npm if local plugin is incomplete (missing plugin.json)', async () => {
|
|
112
|
+
// Create incomplete local plugin (no plugin.json)
|
|
113
|
+
const pluginPath = path.join(tempDir, 'plugins', 'incomplete');
|
|
114
|
+
await fs.ensureDir(pluginPath);
|
|
115
|
+
await fs.ensureDir(path.join(pluginPath, 'dist'));
|
|
116
|
+
await fs.writeFile(path.join(pluginPath, 'dist/generator.js'), 'console.log("test")');
|
|
117
|
+
const result = await resolvePluginLocation('incomplete', tempDir);
|
|
118
|
+
expect(result).toEqual({
|
|
119
|
+
source: 'npm',
|
|
120
|
+
resolvedName: 'incomplete',
|
|
121
|
+
npmPackage: '@launch77-shared/plugin-incomplete',
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
it('should resolve to npm if local plugin is incomplete (missing generator.js)', async () => {
|
|
125
|
+
// Create incomplete local plugin (no generator.js)
|
|
126
|
+
const pluginPath = path.join(tempDir, 'plugins', 'incomplete');
|
|
127
|
+
await fs.ensureDir(pluginPath);
|
|
128
|
+
await fs.writeFile(path.join(pluginPath, 'plugin.json'), JSON.stringify({ name: 'incomplete', version: '1.0.0' }));
|
|
129
|
+
const result = await resolvePluginLocation('incomplete', tempDir);
|
|
130
|
+
expect(result).toEqual({
|
|
131
|
+
source: 'npm',
|
|
132
|
+
resolvedName: 'incomplete',
|
|
133
|
+
npmPackage: '@launch77-shared/plugin-incomplete',
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
it('should always resolve scoped packages to npm', async () => {
|
|
137
|
+
// Even if a directory exists locally, scoped names go to npm
|
|
138
|
+
const pluginPath = path.join(tempDir, 'plugins', '@ibm');
|
|
139
|
+
await fs.ensureDir(pluginPath);
|
|
140
|
+
const result = await resolvePluginLocation('@ibm/analytics', tempDir);
|
|
141
|
+
expect(result).toEqual({
|
|
142
|
+
source: 'npm',
|
|
143
|
+
resolvedName: '@ibm/analytics',
|
|
144
|
+
npmPackage: '@ibm/analytics',
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
it('should resolve scoped @launch77-shared packages to npm', async () => {
|
|
148
|
+
const result = await resolvePluginLocation('@launch77-shared/plugin-release', tempDir);
|
|
149
|
+
expect(result).toEqual({
|
|
150
|
+
source: 'npm',
|
|
151
|
+
resolvedName: '@launch77-shared/plugin-release',
|
|
152
|
+
npmPackage: '@launch77-shared/plugin-release',
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
it('should handle plugins directory not existing', async () => {
|
|
156
|
+
// Remove plugins directory
|
|
157
|
+
await fs.remove(path.join(tempDir, 'plugins'));
|
|
158
|
+
const result = await resolvePluginLocation('release', tempDir);
|
|
159
|
+
expect(result).toEqual({
|
|
160
|
+
source: 'npm',
|
|
161
|
+
resolvedName: 'release',
|
|
162
|
+
npmPackage: '@launch77-shared/plugin-release',
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
it('should trim whitespace from plugin names', async () => {
|
|
166
|
+
const result = await resolvePluginLocation(' release ', tempDir);
|
|
167
|
+
expect(result).toEqual({
|
|
168
|
+
source: 'npm',
|
|
169
|
+
resolvedName: 'release',
|
|
170
|
+
npmPackage: '@launch77-shared/plugin-release',
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=plugin-resolver.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-resolver.test.js","sourceRoot":"","sources":["../../../../src/modules/plugin/lib/plugin-resolver.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACpE,OAAO,KAAK,IAA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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
|
+
{"version":3,"file":"plugin-svc.js","sourceRoot":"","sources":["../../../../src/modules/plugin/services/plugin-svc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAA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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,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0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,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"}
|