@ollie-shop/cli 0.3.0 → 0.3.2
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/.turbo/turbo-build.log +14 -2
- package/CHANGELOG.md +13 -0
- package/__tests__/mocks/core.ts +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +40574 -75
- package/package.json +7 -6
- package/src/actions/component.actions.ts +31 -0
- package/src/actions/function.actions.ts +34 -0
- package/src/actions/project.actions.ts +6 -2
- package/src/commands/__tests__/store-version.test.ts +1 -4
- package/tsup.config.ts +15 -0
- package/dist/__tests__/helpers/cli-test-helper.d.ts +0 -89
- package/dist/__tests__/helpers/cli-test-helper.d.ts.map +0 -1
- package/dist/__tests__/helpers/cli-test-helper.js +0 -220
- package/dist/__tests__/mocks/index.d.ts +0 -69
- package/dist/__tests__/mocks/index.d.ts.map +0 -1
- package/dist/__tests__/mocks/index.js +0 -77
- package/dist/actions/component.actions.d.ts +0 -14
- package/dist/actions/component.actions.d.ts.map +0 -1
- package/dist/actions/component.actions.js +0 -273
- package/dist/actions/function.actions.d.ts +0 -15
- package/dist/actions/function.actions.d.ts.map +0 -1
- package/dist/actions/function.actions.js +0 -254
- package/dist/actions/project.actions.d.ts +0 -17
- package/dist/actions/project.actions.d.ts.map +0 -1
- package/dist/actions/project.actions.js +0 -97
- package/dist/actions/version.actions.d.ts +0 -19
- package/dist/actions/version.actions.d.ts.map +0 -1
- package/dist/actions/version.actions.js +0 -216
- package/dist/commands/component.d.ts +0 -3
- package/dist/commands/component.d.ts.map +0 -1
- package/dist/commands/component.js +0 -192
- package/dist/commands/docs.d.ts +0 -3
- package/dist/commands/docs.d.ts.map +0 -1
- package/dist/commands/docs.js +0 -16
- package/dist/commands/function.d.ts +0 -3
- package/dist/commands/function.d.ts.map +0 -1
- package/dist/commands/function.js +0 -243
- package/dist/commands/help.d.ts +0 -3
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/help.js +0 -20
- package/dist/commands/index.d.ts +0 -3
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -26
- package/dist/commands/login.d.ts +0 -3
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -175
- package/dist/commands/project.d.ts +0 -3
- package/dist/commands/project.d.ts.map +0 -1
- package/dist/commands/project.js +0 -78
- package/dist/commands/store-version.d.ts +0 -3
- package/dist/commands/store-version.d.ts.map +0 -1
- package/dist/commands/store-version.js +0 -241
- package/dist/commands/version.d.ts +0 -3
- package/dist/commands/version.d.ts.map +0 -1
- package/dist/commands/version.js +0 -46
- package/dist/commands/whoami.d.ts +0 -3
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -41
- package/dist/index.d.ts.map +0 -1
- package/dist/prompts/component.prompts.d.ts +0 -14
- package/dist/prompts/component.prompts.d.ts.map +0 -1
- package/dist/prompts/component.prompts.js +0 -75
- package/dist/prompts/function.prompts.d.ts +0 -21
- package/dist/prompts/function.prompts.d.ts.map +0 -1
- package/dist/prompts/function.prompts.js +0 -127
- package/dist/schemas/command.schema.d.ts +0 -516
- package/dist/schemas/command.schema.d.ts.map +0 -1
- package/dist/schemas/command.schema.js +0 -267
- package/dist/types/index.d.ts +0 -147
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/utils/auth.d.ts +0 -4
- package/dist/utils/auth.d.ts.map +0 -1
- package/dist/utils/auth.js +0 -26
- package/dist/utils/cli-progress-reporter.d.ts +0 -12
- package/dist/utils/cli-progress-reporter.d.ts.map +0 -1
- package/dist/utils/cli-progress-reporter.js +0 -77
- package/dist/utils/command-builder.d.ts +0 -22
- package/dist/utils/command-builder.d.ts.map +0 -1
- package/dist/utils/command-builder.js +0 -268
- package/dist/utils/command-helpers.d.ts +0 -19
- package/dist/utils/command-helpers.d.ts.map +0 -1
- package/dist/utils/command-helpers.js +0 -79
- package/dist/utils/command-parser.d.ts +0 -146
- package/dist/utils/command-parser.d.ts.map +0 -1
- package/dist/utils/command-parser.js +0 -179
- package/dist/utils/command-suggestions.d.ts +0 -35
- package/dist/utils/command-suggestions.d.ts.map +0 -1
- package/dist/utils/command-suggestions.js +0 -152
- package/dist/utils/console.d.ts +0 -44
- package/dist/utils/console.d.ts.map +0 -1
- package/dist/utils/console.js +0 -233
- package/dist/utils/constants.d.ts +0 -8
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js +0 -10
- package/dist/utils/context-detector.d.ts +0 -12
- package/dist/utils/context-detector.d.ts.map +0 -1
- package/dist/utils/context-detector.js +0 -155
- package/dist/utils/enhanced-error-handler.d.ts +0 -47
- package/dist/utils/enhanced-error-handler.d.ts.map +0 -1
- package/dist/utils/enhanced-error-handler.js +0 -221
- package/dist/utils/error-handler.d.ts +0 -3
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js +0 -55
- package/dist/utils/errors.d.ts +0 -44
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -76
- package/dist/utils/interactive-builder.d.ts +0 -22
- package/dist/utils/interactive-builder.d.ts.map +0 -1
- package/dist/utils/interactive-builder.js +0 -246
- package/dist/utils/rich-progress.d.ts +0 -59
- package/dist/utils/rich-progress.d.ts.map +0 -1
- package/dist/utils/rich-progress.js +0 -234
- package/dist/utils/store.d.ts +0 -11
- package/dist/utils/store.d.ts.map +0 -1
- package/dist/utils/store.js +0 -19
- package/dist/utils/validation-error-formatter.d.ts +0 -25
- package/dist/utils/validation-error-formatter.d.ts.map +0 -1
- package/dist/utils/validation-error-formatter.js +0 -258
- package/dist/utils/validation-helpers.d.ts +0 -60
- package/dist/utils/validation-helpers.d.ts.map +0 -1
- package/dist/utils/validation-helpers.js +0 -152
- package/src/commands/__tests__/version.test.ts +0 -71
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMockConsole = createMockConsole;
|
|
4
|
-
exports.createMockInquirer = createMockInquirer;
|
|
5
|
-
exports.createMockSpinner = createMockSpinner;
|
|
6
|
-
exports.createMockCore = createMockCore;
|
|
7
|
-
const vitest_1 = require("vitest");
|
|
8
|
-
function createMockConsole() {
|
|
9
|
-
return {
|
|
10
|
-
success: vitest_1.vi.fn(),
|
|
11
|
-
error: vitest_1.vi.fn(),
|
|
12
|
-
info: vitest_1.vi.fn(),
|
|
13
|
-
warn: vitest_1.vi.fn(),
|
|
14
|
-
hint: vitest_1.vi.fn(),
|
|
15
|
-
spinner: vitest_1.vi.fn(() => createMockSpinner()),
|
|
16
|
-
log: vitest_1.vi.fn(),
|
|
17
|
-
dim: vitest_1.vi.fn(),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function createMockInquirer() {
|
|
21
|
-
return {
|
|
22
|
-
prompt: vitest_1.vi.fn(),
|
|
23
|
-
select: vitest_1.vi.fn(),
|
|
24
|
-
input: vitest_1.vi.fn(),
|
|
25
|
-
confirm: vitest_1.vi.fn(),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function createMockSpinner() {
|
|
29
|
-
return {
|
|
30
|
-
succeed: vitest_1.vi.fn(),
|
|
31
|
-
fail: vitest_1.vi.fn(),
|
|
32
|
-
start: vitest_1.vi.fn(),
|
|
33
|
-
stop: vitest_1.vi.fn(),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function createMockCore() {
|
|
37
|
-
return {
|
|
38
|
-
listComponents: vitest_1.vi.fn(),
|
|
39
|
-
createComponent: vitest_1.vi.fn(),
|
|
40
|
-
deployComponent: vitest_1.vi.fn(),
|
|
41
|
-
deleteComponent: vitest_1.vi.fn(),
|
|
42
|
-
listFunctions: vitest_1.vi.fn(),
|
|
43
|
-
createFunction: vitest_1.vi.fn(),
|
|
44
|
-
deployFunction: vitest_1.vi.fn(),
|
|
45
|
-
deleteFunction: vitest_1.vi.fn(),
|
|
46
|
-
listVersions: vitest_1.vi.fn(),
|
|
47
|
-
createVersion: vitest_1.vi.fn(),
|
|
48
|
-
setDefaultVersion: vitest_1.vi.fn(),
|
|
49
|
-
deleteVersion: vitest_1.vi.fn(),
|
|
50
|
-
versionService: {
|
|
51
|
-
list: vitest_1.vi.fn(),
|
|
52
|
-
create: vitest_1.vi.fn(),
|
|
53
|
-
setDefault: vitest_1.vi.fn(),
|
|
54
|
-
delete: vitest_1.vi.fn(),
|
|
55
|
-
clone: vitest_1.vi.fn(),
|
|
56
|
-
activate: vitest_1.vi.fn(),
|
|
57
|
-
deactivate: vitest_1.vi.fn(),
|
|
58
|
-
},
|
|
59
|
-
projectService: {
|
|
60
|
-
getProjectInfo: vitest_1.vi.fn(),
|
|
61
|
-
},
|
|
62
|
-
componentService: {
|
|
63
|
-
list: vitest_1.vi.fn(),
|
|
64
|
-
create: vitest_1.vi.fn(),
|
|
65
|
-
deploy: vitest_1.vi.fn(),
|
|
66
|
-
delete: vitest_1.vi.fn(),
|
|
67
|
-
},
|
|
68
|
-
functionService: {
|
|
69
|
-
list: vitest_1.vi.fn(),
|
|
70
|
-
create: vitest_1.vi.fn(),
|
|
71
|
-
deploy: vitest_1.vi.fn(),
|
|
72
|
-
delete: vitest_1.vi.fn(),
|
|
73
|
-
update: vitest_1.vi.fn(),
|
|
74
|
-
test: vitest_1.vi.fn(),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ComponentCreateOptions, ComponentDeployOptions, ComponentValidateOptions } from "../schemas/command.schema";
|
|
2
|
-
import type { CliConsole } from "../utils/console";
|
|
3
|
-
export declare function createComponent(options: ComponentCreateOptions, cliConsole: CliConsole): Promise<void>;
|
|
4
|
-
export declare function validateComponent(options: ComponentValidateOptions, cliConsole: CliConsole): Promise<void>;
|
|
5
|
-
export declare function buildComponent(options: {
|
|
6
|
-
path?: string;
|
|
7
|
-
watch?: boolean;
|
|
8
|
-
}, cliConsole: CliConsole): Promise<void>;
|
|
9
|
-
export declare function deployComponent(options: ComponentDeployOptions & {
|
|
10
|
-
wait?: boolean;
|
|
11
|
-
}, cliConsole: CliConsole): Promise<void>;
|
|
12
|
-
export declare function checkDeployStatus(buildId: string, cliConsole: CliConsole): Promise<void>;
|
|
13
|
-
export declare function listComponents(cliConsole: CliConsole): Promise<void>;
|
|
14
|
-
//# sourceMappingURL=component.actions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.actions.d.ts","sourceRoot":"","sources":["../../src/actions/component.actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EAEtB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,EACjC,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3C,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EACpD,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAwFf;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA8Cf;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAkE1E"}
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createComponent = createComponent;
|
|
4
|
-
exports.validateComponent = validateComponent;
|
|
5
|
-
exports.buildComponent = buildComponent;
|
|
6
|
-
exports.deployComponent = deployComponent;
|
|
7
|
-
exports.checkDeployStatus = checkDeployStatus;
|
|
8
|
-
exports.listComponents = listComponents;
|
|
9
|
-
const command_schema_1 = require("../schemas/command.schema");
|
|
10
|
-
const validation_helpers_1 = require("../utils/validation-helpers");
|
|
11
|
-
async function createComponent(options, cliConsole) {
|
|
12
|
-
const { createComponent: createComponentService } = await import("@ollie-shop/core");
|
|
13
|
-
const spinner = cliConsole.spinner({
|
|
14
|
-
text: "Creating component...",
|
|
15
|
-
});
|
|
16
|
-
try {
|
|
17
|
-
if (!options.name) {
|
|
18
|
-
throw new Error("Component name is required");
|
|
19
|
-
}
|
|
20
|
-
const result = await createComponentService({
|
|
21
|
-
name: options.name,
|
|
22
|
-
slot: options.slot || "main",
|
|
23
|
-
typescript: true, // Always use TypeScript
|
|
24
|
-
includeTests: options.tests ?? true,
|
|
25
|
-
});
|
|
26
|
-
spinner.succeed(`Component created successfully at ${result}`);
|
|
27
|
-
cliConsole.nextSteps("Next steps", [
|
|
28
|
-
{
|
|
29
|
-
description: "Navigate to component directory",
|
|
30
|
-
command: `cd ${result}`,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
description: "Install dependencies",
|
|
34
|
-
command: "npm install",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
description: "Start development",
|
|
38
|
-
command: "npm run dev",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
description: "Deploy component",
|
|
42
|
-
command: "ollieshop component deploy --id <id>",
|
|
43
|
-
},
|
|
44
|
-
]);
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
spinner.fail("Failed to create component");
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function validateComponent(options, cliConsole) {
|
|
52
|
-
const { validateComponent: validateComponentService } = await import("@ollie-shop/core");
|
|
53
|
-
const { getContextualPath } = await import("../utils/context-detector.js");
|
|
54
|
-
const targetPath = getContextualPath(options.path, "component");
|
|
55
|
-
const spinner = cliConsole.spinner({ text: "Validating component..." });
|
|
56
|
-
try {
|
|
57
|
-
const result = await validateComponentService(targetPath);
|
|
58
|
-
(0, validation_helpers_1.handleValidationResult)(result, spinner, cliConsole, "Component");
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
spinner.fail("Validation failed");
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async function buildComponent(options, cliConsole) {
|
|
66
|
-
const { buildComponent: buildComponentService } = await import("@ollie-shop/core");
|
|
67
|
-
const { getContextualPath } = await import("../utils/context-detector.js");
|
|
68
|
-
const targetPath = getContextualPath(options.path, "component");
|
|
69
|
-
const spinner = cliConsole.spinner({ text: "Building component..." });
|
|
70
|
-
try {
|
|
71
|
-
if (options.watch) {
|
|
72
|
-
cliConsole.info("Watching for changes...");
|
|
73
|
-
}
|
|
74
|
-
const result = await buildComponentService(targetPath);
|
|
75
|
-
spinner.succeed("Component built successfully!");
|
|
76
|
-
if (result.outputPath) {
|
|
77
|
-
cliConsole.info(`Output: ${result.outputPath}`);
|
|
78
|
-
}
|
|
79
|
-
if (result.size) {
|
|
80
|
-
cliConsole.info(`Size: ${(result.size / 1024).toFixed(2)} KB`);
|
|
81
|
-
}
|
|
82
|
-
if (result.duration) {
|
|
83
|
-
cliConsole.info(`Duration: ${(result.duration / 1000).toFixed(2)}s`);
|
|
84
|
-
}
|
|
85
|
-
if (result.warnings && result.warnings.length > 0) {
|
|
86
|
-
cliConsole.warn("Build warnings:");
|
|
87
|
-
for (const warning of result.warnings) {
|
|
88
|
-
cliConsole.warn(` - ${warning}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
spinner.fail("Build failed");
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async function deployComponent(options, cliConsole) {
|
|
98
|
-
if (!options.componentId) {
|
|
99
|
-
throw new Error("Component ID is required for deployment");
|
|
100
|
-
}
|
|
101
|
-
const spinner = cliConsole.spinner({
|
|
102
|
-
text: "Building and deploying component...",
|
|
103
|
-
});
|
|
104
|
-
try {
|
|
105
|
-
// For CLI demo purposes, simulate deployment without Supabase
|
|
106
|
-
// In production, this would use the builder API directly
|
|
107
|
-
const buildId = `build-${Date.now()}`;
|
|
108
|
-
const result = {
|
|
109
|
-
buildId,
|
|
110
|
-
status: "IN_PROGRESS",
|
|
111
|
-
startTime: new Date().toISOString(),
|
|
112
|
-
};
|
|
113
|
-
spinner.succeed("Component deployment initiated!");
|
|
114
|
-
cliConsole.success(`Build ID: ${result.buildId}`);
|
|
115
|
-
cliConsole.info(`Initial Status: ${result.status}`);
|
|
116
|
-
// If wait flag is set, simulate deployment progress
|
|
117
|
-
if (options.wait) {
|
|
118
|
-
// Stop spinner and use rich progress reporter
|
|
119
|
-
spinner.stop();
|
|
120
|
-
const { RichProgressReporter } = await import("../utils/rich-progress.js");
|
|
121
|
-
const progressReporter = new RichProgressReporter();
|
|
122
|
-
progressReporter.start();
|
|
123
|
-
try {
|
|
124
|
-
// Simulate deployment progress for demo
|
|
125
|
-
const phases = [
|
|
126
|
-
{
|
|
127
|
-
phase: "validate",
|
|
128
|
-
message: "Validating component...",
|
|
129
|
-
progress: 0.1,
|
|
130
|
-
},
|
|
131
|
-
{ phase: "build", message: "Building component...", progress: 0.3 },
|
|
132
|
-
{
|
|
133
|
-
phase: "bundle",
|
|
134
|
-
message: "Creating bundle...",
|
|
135
|
-
progress: 0.5,
|
|
136
|
-
metadata: { bundleSize: 125000, gzippedSize: 42000 },
|
|
137
|
-
},
|
|
138
|
-
{ phase: "upload", message: "Uploading to CDN...", progress: 0.7 },
|
|
139
|
-
{ phase: "deploy", message: "Deploying component...", progress: 0.9 },
|
|
140
|
-
{ phase: "complete", message: "Deployment complete!", progress: 1.0 },
|
|
141
|
-
];
|
|
142
|
-
// Simulate progress updates
|
|
143
|
-
for (const update of phases) {
|
|
144
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
145
|
-
progressReporter.updateProgress(update);
|
|
146
|
-
}
|
|
147
|
-
const deploymentUrl = `https://cdn.ollie.shop/components/${options.componentId}/${buildId}`;
|
|
148
|
-
const duration = 5.5; // simulated duration
|
|
149
|
-
progressReporter.stop(true);
|
|
150
|
-
cliConsole.success(`\nDeployment URL: ${deploymentUrl}`);
|
|
151
|
-
cliConsole.info(`Duration: ${duration}s`);
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
progressReporter.stop(false);
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
// Async mode - just show next steps
|
|
160
|
-
cliConsole.nextSteps("Monitor deployment", [
|
|
161
|
-
{
|
|
162
|
-
description: "Check deployment status",
|
|
163
|
-
command: `ollieshop component deploy-status ${result.buildId}`,
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
description: "Or deploy with --wait flag to wait for completion",
|
|
167
|
-
command: `ollieshop component deploy --id ${options.componentId} --wait`,
|
|
168
|
-
},
|
|
169
|
-
]);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
spinner.fail("Deployment failed");
|
|
174
|
-
throw error;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
async function checkDeployStatus(buildId, cliConsole) {
|
|
178
|
-
const spinner = cliConsole.spinner({ text: "Checking deployment status..." });
|
|
179
|
-
try {
|
|
180
|
-
// For CLI demo purposes, return mock build status
|
|
181
|
-
// In production, this would use the builder API directly
|
|
182
|
-
const build = {
|
|
183
|
-
id: buildId,
|
|
184
|
-
status: "SUCCEEDED",
|
|
185
|
-
startTime: new Date(Date.now() - 30000).toISOString(),
|
|
186
|
-
endTime: new Date().toISOString(),
|
|
187
|
-
};
|
|
188
|
-
if (!build) {
|
|
189
|
-
spinner.fail("Build not found");
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
spinner.succeed("Status retrieved");
|
|
193
|
-
cliConsole.info(`Build ID: ${build.id}`);
|
|
194
|
-
cliConsole.info(`Status: ${build.status}`);
|
|
195
|
-
cliConsole.info(`Start Time: ${new Date(build.startTime).toLocaleString()}`);
|
|
196
|
-
if (build.endTime) {
|
|
197
|
-
cliConsole.info(`End Time: ${new Date(build.endTime).toLocaleString()}`);
|
|
198
|
-
const duration = (new Date(build.endTime).getTime() -
|
|
199
|
-
new Date(build.startTime).getTime()) /
|
|
200
|
-
1000;
|
|
201
|
-
cliConsole.info(`Duration: ${duration}s`);
|
|
202
|
-
}
|
|
203
|
-
if (build.status === "SUCCEEDED") {
|
|
204
|
-
cliConsole.success("✅ Deployment completed successfully!");
|
|
205
|
-
}
|
|
206
|
-
else if (build.status === "FAILED" || build.status === "FAULT") {
|
|
207
|
-
cliConsole.error("❌ Deployment failed");
|
|
208
|
-
}
|
|
209
|
-
else if (build.status === "IN_PROGRESS") {
|
|
210
|
-
cliConsole.info("🔄 Deployment in progress...");
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
catch (error) {
|
|
214
|
-
spinner.fail("Failed to check status");
|
|
215
|
-
throw error;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
async function listComponents(cliConsole) {
|
|
219
|
-
const spinner = cliConsole.spinner({ text: "Loading components..." });
|
|
220
|
-
try {
|
|
221
|
-
// For CLI demo purposes, return mock components
|
|
222
|
-
// In production, this would use the API directly
|
|
223
|
-
const rawComponents = [
|
|
224
|
-
{
|
|
225
|
-
id: "comp-1",
|
|
226
|
-
name: "custom-header",
|
|
227
|
-
slot: "header",
|
|
228
|
-
active: true,
|
|
229
|
-
createdAt: new Date().toISOString(),
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
id: "comp-2",
|
|
233
|
-
name: "shipping-calculator",
|
|
234
|
-
slot: "shipping",
|
|
235
|
-
active: false,
|
|
236
|
-
createdAt: new Date(Date.now() - 172800000).toISOString(),
|
|
237
|
-
},
|
|
238
|
-
];
|
|
239
|
-
// Map core component types to CLI display format
|
|
240
|
-
const components = rawComponents.map((component) => command_schema_1.ComponentListItemSchema.parse({
|
|
241
|
-
id: component.id,
|
|
242
|
-
name: component.name,
|
|
243
|
-
slot: component.slot,
|
|
244
|
-
version: "1.0.0", // TODO: Get version from component metadata
|
|
245
|
-
enabled: component.active,
|
|
246
|
-
createdAt: component.createdAt,
|
|
247
|
-
type: "ui", // TODO: Get type from component metadata
|
|
248
|
-
description: "Component description", // TODO: Get from metadata
|
|
249
|
-
}));
|
|
250
|
-
spinner.succeed();
|
|
251
|
-
if (components.length === 0) {
|
|
252
|
-
cliConsole.warn("No components found");
|
|
253
|
-
cliConsole.suggestions([
|
|
254
|
-
"Create your first component with: ollieshop component create",
|
|
255
|
-
"Check our documentation at: https://docs.ollie.shop/components",
|
|
256
|
-
]);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
cliConsole.info(`Found ${components.length} component${components.length === 1 ? "" : "s"}:\n`);
|
|
260
|
-
cliConsole.table(components.map((c) => ({
|
|
261
|
-
ID: c.id,
|
|
262
|
-
Name: c.name,
|
|
263
|
-
Slot: c.slot,
|
|
264
|
-
Version: c.version || "N/A",
|
|
265
|
-
Enabled: c.enabled ? "✓" : "✗",
|
|
266
|
-
Created: new Date(c.createdAt).toLocaleDateString(),
|
|
267
|
-
})));
|
|
268
|
-
}
|
|
269
|
-
catch (error) {
|
|
270
|
-
spinner.fail("Failed to list components");
|
|
271
|
-
throw error;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { FunctionBuildOptions, FunctionCreateOptions, FunctionDeployOptions, FunctionTestOptions } from "../schemas/command.schema";
|
|
2
|
-
import type { CliConsole } from "../utils/console";
|
|
3
|
-
export declare function createFunction(options: FunctionCreateOptions, cliConsole: CliConsole): Promise<void>;
|
|
4
|
-
export declare function buildFunction(options: FunctionBuildOptions, cliConsole: CliConsole): Promise<void>;
|
|
5
|
-
export declare function testFunction(options: FunctionTestOptions, cliConsole: CliConsole): Promise<void>;
|
|
6
|
-
export declare function validateFunction(options: {
|
|
7
|
-
path?: string;
|
|
8
|
-
strict?: boolean;
|
|
9
|
-
fix?: boolean;
|
|
10
|
-
}, cliConsole: CliConsole): Promise<void>;
|
|
11
|
-
export declare function deployFunction(options: FunctionDeployOptions & {
|
|
12
|
-
wait?: boolean;
|
|
13
|
-
}, cliConsole: CliConsole): Promise<void>;
|
|
14
|
-
export declare function listFunctions(cliConsole: CliConsole): Promise<void>;
|
|
15
|
-
//# sourceMappingURL=function.actions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.actions.d.ts","sourceRoot":"","sources":["../../src/actions/function.actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,EAC9B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,EAC7B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3D,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EACnD,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA4Ff;AAED,wBAAsB,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEzE"}
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFunction = createFunction;
|
|
4
|
-
exports.buildFunction = buildFunction;
|
|
5
|
-
exports.testFunction = testFunction;
|
|
6
|
-
exports.validateFunction = validateFunction;
|
|
7
|
-
exports.deployFunction = deployFunction;
|
|
8
|
-
exports.listFunctions = listFunctions;
|
|
9
|
-
const command_schema_1 = require("../schemas/command.schema");
|
|
10
|
-
const validation_helpers_1 = require("../utils/validation-helpers");
|
|
11
|
-
async function createFunction(options, cliConsole) {
|
|
12
|
-
// Lazy import - only loaded when this function is called
|
|
13
|
-
const { createFunction: createFunctionService } = await import("@ollie-shop/core");
|
|
14
|
-
const spinner = cliConsole.spinner({
|
|
15
|
-
text: "Creating function...",
|
|
16
|
-
});
|
|
17
|
-
try {
|
|
18
|
-
const result = await createFunctionService({
|
|
19
|
-
name: options.name || "my-function",
|
|
20
|
-
invocation: options.invocation || "request",
|
|
21
|
-
priority: options.priority || 50,
|
|
22
|
-
onError: options.onError || "throw",
|
|
23
|
-
typescript: true, // Always use TypeScript
|
|
24
|
-
includeTests: options.tests ?? true,
|
|
25
|
-
description: options.description,
|
|
26
|
-
});
|
|
27
|
-
spinner.succeed(`Function created successfully at ${result}`);
|
|
28
|
-
cliConsole.nextSteps("Next steps", [
|
|
29
|
-
{
|
|
30
|
-
description: "Navigate to function directory",
|
|
31
|
-
command: `cd ${result}`,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
description: "Install dependencies",
|
|
35
|
-
command: "npm install",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
description: "Test function",
|
|
39
|
-
command: "npm test",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
description: "Deploy function",
|
|
43
|
-
command: "ollieshop function deploy",
|
|
44
|
-
},
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
spinner.fail("Failed to create function");
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function buildFunction(options, cliConsole) {
|
|
53
|
-
// Lazy import - only loaded when this function is called
|
|
54
|
-
const { buildFunction: buildFunctionService } = await import("@ollie-shop/core");
|
|
55
|
-
const { getContextualPath } = await import("../utils/context-detector.js");
|
|
56
|
-
const targetPath = getContextualPath(options.path, "function");
|
|
57
|
-
const spinner = cliConsole.spinner({ text: "Building function..." });
|
|
58
|
-
try {
|
|
59
|
-
if (options.watch) {
|
|
60
|
-
cliConsole.info("Watching for changes...");
|
|
61
|
-
}
|
|
62
|
-
const result = await buildFunctionService(targetPath);
|
|
63
|
-
spinner.succeed("Function built successfully!");
|
|
64
|
-
if (typeof result === "object" && "outputPath" in result) {
|
|
65
|
-
cliConsole.info(`Output: ${result.outputPath || targetPath}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
spinner.fail("Build failed");
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
async function testFunction(options, cliConsole) {
|
|
74
|
-
const { testFunction: testFunctionService } = await import("@ollie-shop/core");
|
|
75
|
-
const { getContextualPath } = await import("../utils/context-detector.js");
|
|
76
|
-
const targetPath = getContextualPath(options.path, "function");
|
|
77
|
-
const spinner = cliConsole.spinner({ text: "Testing function..." });
|
|
78
|
-
try {
|
|
79
|
-
if (options.watch) {
|
|
80
|
-
cliConsole.info("Running tests in watch mode...");
|
|
81
|
-
}
|
|
82
|
-
const result = await testFunctionService(targetPath, {
|
|
83
|
-
watch: options.watch,
|
|
84
|
-
});
|
|
85
|
-
spinner.succeed("Function tests completed!");
|
|
86
|
-
if (typeof result === "object" && "summary" in result) {
|
|
87
|
-
cliConsole.info(`Test summary: ${result.summary}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
spinner.fail("Tests failed");
|
|
92
|
-
throw error;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async function validateFunction(options, cliConsole) {
|
|
96
|
-
// Lazy import - only loaded when this function is called
|
|
97
|
-
const { validateFunction: validateFunctionService } = await import("@ollie-shop/core");
|
|
98
|
-
const { getContextualPath } = await import("../utils/context-detector.js");
|
|
99
|
-
const targetPath = getContextualPath(options.path, "function");
|
|
100
|
-
const spinner = cliConsole.spinner({ text: "Validating function..." });
|
|
101
|
-
try {
|
|
102
|
-
const result = await validateFunctionService(targetPath);
|
|
103
|
-
(0, validation_helpers_1.handleValidationResult)(result, spinner, cliConsole, "Function");
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
spinner.fail("Validation failed");
|
|
107
|
-
throw error;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async function deployFunction(options, cliConsole) {
|
|
111
|
-
if (!options.functionId) {
|
|
112
|
-
throw new Error("Function ID is required for deployment");
|
|
113
|
-
}
|
|
114
|
-
const spinner = cliConsole.spinner({
|
|
115
|
-
text: "Building and deploying function...",
|
|
116
|
-
});
|
|
117
|
-
try {
|
|
118
|
-
// For CLI demo purposes, simulate deployment without Supabase
|
|
119
|
-
// In production, this would use the builder API directly
|
|
120
|
-
const buildId = `build-${Date.now()}`;
|
|
121
|
-
const result = {
|
|
122
|
-
buildId,
|
|
123
|
-
status: "IN_PROGRESS",
|
|
124
|
-
startTime: new Date().toISOString(),
|
|
125
|
-
};
|
|
126
|
-
spinner.succeed("Function deployment initiated!");
|
|
127
|
-
cliConsole.success(`Build ID: ${result.buildId}`);
|
|
128
|
-
cliConsole.info(`Initial Status: ${result.status}`);
|
|
129
|
-
// If wait flag is set, simulate deployment progress
|
|
130
|
-
if (options.wait) {
|
|
131
|
-
// Stop spinner and use rich progress reporter
|
|
132
|
-
spinner.stop();
|
|
133
|
-
const { RichProgressReporter } = await import("../utils/rich-progress.js");
|
|
134
|
-
const progressReporter = new RichProgressReporter();
|
|
135
|
-
progressReporter.start();
|
|
136
|
-
try {
|
|
137
|
-
// Simulate deployment progress for demo
|
|
138
|
-
const phases = [
|
|
139
|
-
{
|
|
140
|
-
phase: "validate",
|
|
141
|
-
message: "Validating function...",
|
|
142
|
-
progress: 0.1,
|
|
143
|
-
},
|
|
144
|
-
{ phase: "build", message: "Building function...", progress: 0.3 },
|
|
145
|
-
{
|
|
146
|
-
phase: "bundle",
|
|
147
|
-
message: "Creating deployment package...",
|
|
148
|
-
progress: 0.5,
|
|
149
|
-
metadata: { bundleSize: 85000, gzippedSize: 28000 },
|
|
150
|
-
},
|
|
151
|
-
{ phase: "upload", message: "Uploading to Lambda...", progress: 0.7 },
|
|
152
|
-
{
|
|
153
|
-
phase: "deploy",
|
|
154
|
-
message: "Configuring function...",
|
|
155
|
-
progress: 0.9,
|
|
156
|
-
},
|
|
157
|
-
{ phase: "complete", message: "Deployment complete!", progress: 1.0 },
|
|
158
|
-
];
|
|
159
|
-
// Simulate progress updates
|
|
160
|
-
for (const update of phases) {
|
|
161
|
-
await new Promise((resolve) => setTimeout(resolve, 800));
|
|
162
|
-
progressReporter.updateProgress(update);
|
|
163
|
-
}
|
|
164
|
-
const functionUrl = `https://api.ollie.shop/functions/${options.functionId}`;
|
|
165
|
-
const duration = 4.8; // simulated duration
|
|
166
|
-
progressReporter.stop(true);
|
|
167
|
-
cliConsole.success(`\nFunction URL: ${functionUrl}`);
|
|
168
|
-
cliConsole.info(`Duration: ${duration}s`);
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
progressReporter.stop(false);
|
|
172
|
-
throw error;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
// Async mode - just show next steps
|
|
177
|
-
cliConsole.nextSteps("Monitor deployment", [
|
|
178
|
-
{
|
|
179
|
-
description: "Check deployment status",
|
|
180
|
-
command: `ollieshop function deploy-status ${result.buildId}`,
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
description: "Or deploy with --wait flag to wait for completion",
|
|
184
|
-
command: `ollieshop function deploy --id ${options.functionId} --wait`,
|
|
185
|
-
},
|
|
186
|
-
]);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
spinner.fail("Deployment failed");
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async function listFunctions(cliConsole) {
|
|
195
|
-
const spinner = cliConsole.spinner({ text: "Loading functions..." });
|
|
196
|
-
try {
|
|
197
|
-
// For CLI demo purposes, return mock functions
|
|
198
|
-
// In production, this would use the API directly
|
|
199
|
-
const rawFunctions = [
|
|
200
|
-
{
|
|
201
|
-
id: "func-1",
|
|
202
|
-
name: "validate-cart",
|
|
203
|
-
active: true,
|
|
204
|
-
createdAt: new Date().toISOString(),
|
|
205
|
-
invocation: "request",
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
id: "func-2",
|
|
209
|
-
name: "apply-discount",
|
|
210
|
-
active: true,
|
|
211
|
-
createdAt: new Date(Date.now() - 86400000).toISOString(),
|
|
212
|
-
invocation: "response",
|
|
213
|
-
},
|
|
214
|
-
];
|
|
215
|
-
// Map core function types to CLI display format
|
|
216
|
-
const functions = rawFunctions.map((func) => command_schema_1.FunctionListItemSchema.parse({
|
|
217
|
-
id: func.id,
|
|
218
|
-
name: func.name,
|
|
219
|
-
runtime: "nodejs18.x", // TODO: Get from function metadata
|
|
220
|
-
version: "1.0.0", // TODO: Get version from function metadata
|
|
221
|
-
enabled: func.active,
|
|
222
|
-
createdAt: func.createdAt,
|
|
223
|
-
invocation: "request",
|
|
224
|
-
priority: 0,
|
|
225
|
-
onError: "throw",
|
|
226
|
-
description: "Function description", // TODO: Get from metadata
|
|
227
|
-
}));
|
|
228
|
-
spinner.succeed();
|
|
229
|
-
if (functions.length === 0) {
|
|
230
|
-
cliConsole.warn("No functions found");
|
|
231
|
-
cliConsole.suggestions([
|
|
232
|
-
"Create your first function with: ollieshop function create",
|
|
233
|
-
"Check our documentation at: https://docs.ollie.shop/functions",
|
|
234
|
-
]);
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
cliConsole.info(`Found ${functions.length} function${functions.length === 1 ? "" : "s"}:\n`);
|
|
238
|
-
cliConsole.table(functions.map((f) => ({
|
|
239
|
-
ID: f.id,
|
|
240
|
-
Name: f.name,
|
|
241
|
-
Runtime: f.runtime || "nodejs18.x",
|
|
242
|
-
Version: f.version || "N/A",
|
|
243
|
-
Enabled: f.enabled ? "✓" : "✗",
|
|
244
|
-
Created: new Date(f.createdAt).toLocaleDateString(),
|
|
245
|
-
Invocation: f.invocation || "N/A",
|
|
246
|
-
Priority: f.priority || "N/A",
|
|
247
|
-
"On Error": f.onError || "N/A",
|
|
248
|
-
})));
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
spinner.fail("Failed to list functions");
|
|
252
|
-
throw error;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { InitOptions } from "../schemas/command.schema";
|
|
2
|
-
import type { CliConsole } from "../utils/console";
|
|
3
|
-
export declare function initProject(options: InitOptions, cliConsole: CliConsole): Promise<void>;
|
|
4
|
-
export declare function validateProject(options: {
|
|
5
|
-
path?: string;
|
|
6
|
-
strict?: boolean;
|
|
7
|
-
fix?: boolean;
|
|
8
|
-
}, cliConsole: CliConsole): Promise<void>;
|
|
9
|
-
export declare function buildProject(options: {
|
|
10
|
-
path?: string;
|
|
11
|
-
watch?: boolean;
|
|
12
|
-
}, cliConsole: CliConsole): Promise<void>;
|
|
13
|
-
export declare function startDevServer(options: {
|
|
14
|
-
port?: number;
|
|
15
|
-
open?: boolean;
|
|
16
|
-
}, cliConsole: CliConsole): Promise<void>;
|
|
17
|
-
//# sourceMappingURL=project.actions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.actions.d.ts","sourceRoot":"","sources":["../../src/actions/project.actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAuDf;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3D,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3C,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EAC1C,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAef"}
|