@ollie-shop/cli 0.3.0 → 0.3.3
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 +48 -0
- package/__tests__/mocks/core.ts +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +40631 -75
- package/package.json +7 -6
- package/src/actions/component.actions.ts +148 -204
- package/src/actions/function.actions.ts +78 -171
- package/src/actions/project.actions.ts +16 -11
- package/src/commands/__tests__/component.test.ts +4 -7
- package/src/commands/__tests__/function.test.ts +1 -1
- package/src/commands/__tests__/store-version.test.ts +1 -4
- package/src/commands/component.ts +0 -10
- package/src/commands/function.ts +5 -56
- package/src/schemas/command.schema.ts +296 -6
- package/src/utils/__tests__/rich-progress.test.ts +22 -11
- package/src/utils/cli-progress-reporter.ts +2 -2
- package/src/utils/command-parser.ts +0 -5
- package/src/utils/console.ts +33 -4
- package/src/utils/constants.ts +32 -0
- package/src/utils/deploy-helpers.ts +357 -0
- package/src/utils/errors.ts +133 -2
- package/src/utils/interactive-builder.ts +61 -7
- package/src/utils/rich-progress.ts +25 -14
- package/src/utils/validation-helpers.ts +145 -12
- 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,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.registerComponentCommands = registerComponentCommands;
|
|
37
|
-
const componentActions = __importStar(require("../actions/component.actions"));
|
|
38
|
-
const command_schema_1 = require("../schemas/command.schema");
|
|
39
|
-
const command_builder_1 = require("../utils/command-builder");
|
|
40
|
-
const command_parser_1 = require("../utils/command-parser");
|
|
41
|
-
function registerComponentCommands(program) {
|
|
42
|
-
const cmd = (0, command_builder_1.buildCommandGroup)(program, "component", "Manage Ollie Shop components", ["comp"]);
|
|
43
|
-
// Create component command
|
|
44
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
45
|
-
name: "create",
|
|
46
|
-
description: "Create a new component",
|
|
47
|
-
options: [
|
|
48
|
-
command_parser_1.COMMON_OPTIONS.componentName,
|
|
49
|
-
command_parser_1.COMMON_OPTIONS.componentSlot,
|
|
50
|
-
command_parser_1.COMMON_OPTIONS.tests,
|
|
51
|
-
command_parser_1.COMMON_OPTIONS.noTests,
|
|
52
|
-
{
|
|
53
|
-
flags: "-i, --interactive",
|
|
54
|
-
description: "Use interactive mode",
|
|
55
|
-
defaultValue: false,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
schema: command_schema_1.ComponentCreateOptionsSchema,
|
|
59
|
-
examples: [
|
|
60
|
-
{
|
|
61
|
-
description: "Create a header component",
|
|
62
|
-
command: "ollieshop component create --name header --slot header",
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
description: "Create a component with TypeScript",
|
|
66
|
-
command: "ollieshop component create --name product-list --typescript",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
description: "Interactive mode",
|
|
70
|
-
command: "ollieshop component create --interactive",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
description: "Create with tests",
|
|
74
|
-
command: "ollieshop component create --name product-list",
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
handler: async (options, console) => {
|
|
78
|
-
// Use interactive mode if requested
|
|
79
|
-
if ("interactive" in options && options.interactive) {
|
|
80
|
-
const { runInteractiveCommand } = await import("../utils/interactive-builder.js");
|
|
81
|
-
await runInteractiveCommand("component-create", console);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
await componentActions.createComponent(options, console);
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
// Validate component command
|
|
88
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
89
|
-
name: "validate",
|
|
90
|
-
description: "Validate a component",
|
|
91
|
-
options: [command_parser_1.COMMON_OPTIONS.path],
|
|
92
|
-
schema: command_schema_1.ComponentValidateOptionsSchema,
|
|
93
|
-
examples: [
|
|
94
|
-
{
|
|
95
|
-
description: "Validate current directory",
|
|
96
|
-
command: "ollieshop component validate",
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
description: "Validate specific component",
|
|
100
|
-
command: "ollieshop component validate --path ./components/header",
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
handler: async (options, console) => {
|
|
104
|
-
await componentActions.validateComponent({
|
|
105
|
-
path: options.path || process.cwd(),
|
|
106
|
-
strict: options.strict ?? false,
|
|
107
|
-
fix: options.fix ?? false,
|
|
108
|
-
}, console);
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
// Build component command
|
|
112
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
113
|
-
name: "build",
|
|
114
|
-
description: "Build a component",
|
|
115
|
-
options: [command_parser_1.COMMON_OPTIONS.path, command_parser_1.COMMON_OPTIONS.watch],
|
|
116
|
-
schema: command_schema_1.ComponentBuildOptionsSchema,
|
|
117
|
-
examples: [
|
|
118
|
-
{
|
|
119
|
-
description: "Build current directory",
|
|
120
|
-
command: "ollieshop component build",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
description: "Build specific component",
|
|
124
|
-
command: "ollieshop component build --path ./components/header",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
description: "Build with watch mode",
|
|
128
|
-
command: "ollieshop component build --watch",
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
handler: async (options, console) => {
|
|
132
|
-
await componentActions.buildComponent({
|
|
133
|
-
path: options.path || process.cwd(),
|
|
134
|
-
watch: options.watch ?? false,
|
|
135
|
-
}, console);
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
// Deploy component command
|
|
139
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
140
|
-
name: "deploy",
|
|
141
|
-
description: "Deploy a component",
|
|
142
|
-
options: [
|
|
143
|
-
{
|
|
144
|
-
flags: "--id <id>",
|
|
145
|
-
description: "Component ID",
|
|
146
|
-
required: true,
|
|
147
|
-
},
|
|
148
|
-
command_parser_1.COMMON_OPTIONS.path,
|
|
149
|
-
{
|
|
150
|
-
flags: "--wait",
|
|
151
|
-
description: "Wait for deployment to complete",
|
|
152
|
-
defaultValue: false,
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
schema: command_schema_1.ComponentDeployOptionsSchema,
|
|
156
|
-
examples: [
|
|
157
|
-
{
|
|
158
|
-
description: "Deploy a component",
|
|
159
|
-
command: "ollieshop component deploy --id comp-123",
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
description: "Deploy and wait for completion",
|
|
163
|
-
command: "ollieshop component deploy --id comp-123 --wait",
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
handler: async (options, console) => {
|
|
167
|
-
// Map id to componentId if provided
|
|
168
|
-
const deployOptions = {
|
|
169
|
-
path: options.path,
|
|
170
|
-
componentId: options.id || options.componentId,
|
|
171
|
-
wait: options.wait,
|
|
172
|
-
};
|
|
173
|
-
await componentActions.deployComponent(deployOptions, console);
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
// List components command
|
|
177
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
178
|
-
name: "list",
|
|
179
|
-
description: "List all components",
|
|
180
|
-
aliases: ["ls"],
|
|
181
|
-
examples: [
|
|
182
|
-
{
|
|
183
|
-
description: "List all components",
|
|
184
|
-
command: "ollieshop component list",
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
handler: async (_, console) => {
|
|
188
|
-
await componentActions.listComponents(console);
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
// Add more commands as needed
|
|
192
|
-
}
|
package/dist/commands/docs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoB3D"}
|
package/dist/commands/docs.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureDocsCommand = configureDocsCommand;
|
|
4
|
-
const console_1 = require("../utils/console");
|
|
5
|
-
function configureDocsCommand(program) {
|
|
6
|
-
program
|
|
7
|
-
.command("docs")
|
|
8
|
-
.description("Show documentation links for Ollie Shop")
|
|
9
|
-
.action(() => {
|
|
10
|
-
console_1.console.info("Ollie Shop Documentation\n");
|
|
11
|
-
console_1.console.info(`${"Main Docs:".padEnd(20)} https://docs.ollie.shop/ollie-shop`);
|
|
12
|
-
console_1.console.info(`${"Components:".padEnd(20)} https://docs.ollie.shop/ollie-shop/concepts/component`);
|
|
13
|
-
console_1.console.info(`${"Functions:".padEnd(20)} https://docs.ollie.shop/ollie-shop/concepts/function`);
|
|
14
|
-
console_1.console.info(`${"Versions:".padEnd(20)} https://docs.ollie.shop/ollie-shop/concepts/version\n`);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/commands/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAa3D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8O/D"}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.registerFunctionCommands = registerFunctionCommands;
|
|
37
|
-
const functionActions = __importStar(require("../actions/function.actions"));
|
|
38
|
-
const command_schema_1 = require("../schemas/command.schema");
|
|
39
|
-
const command_builder_1 = require("../utils/command-builder");
|
|
40
|
-
const command_parser_1 = require("../utils/command-parser");
|
|
41
|
-
function registerFunctionCommands(program) {
|
|
42
|
-
const cmd = (0, command_builder_1.buildCommandGroup)(program, "function", "Manage Ollie Shop functions", ["func"]);
|
|
43
|
-
// Create function command
|
|
44
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
45
|
-
name: "create",
|
|
46
|
-
description: "Create a new function",
|
|
47
|
-
options: [
|
|
48
|
-
command_parser_1.COMMON_OPTIONS.functionName,
|
|
49
|
-
command_parser_1.COMMON_OPTIONS.functionInvocation,
|
|
50
|
-
command_parser_1.COMMON_OPTIONS.priority,
|
|
51
|
-
{
|
|
52
|
-
flags: "--on-error <strategy>",
|
|
53
|
-
description: "Error handling strategy (throw|skip)",
|
|
54
|
-
defaultValue: "throw",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
flags: "-d, --description <description>",
|
|
58
|
-
description: "Function description",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
flags: "--template <template>",
|
|
62
|
-
description: "Function template to use",
|
|
63
|
-
},
|
|
64
|
-
command_parser_1.COMMON_OPTIONS.tests,
|
|
65
|
-
command_parser_1.COMMON_OPTIONS.noTests,
|
|
66
|
-
],
|
|
67
|
-
schema: command_schema_1.FunctionCreateOptionsSchema,
|
|
68
|
-
examples: [
|
|
69
|
-
{
|
|
70
|
-
description: "Create a function to validate orders",
|
|
71
|
-
command: "ollieshop function create --name validate-order --event order --timing before",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
description: "Create a discount function for cart",
|
|
75
|
-
command: "ollieshop function create --name apply-discount --event cart --description 'Apply bulk discounts'",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
description: "Create a JavaScript function without tests",
|
|
79
|
-
command: "ollieshop function create --name check-inventory --language javascript --no-tests",
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
handler: async (options, console) => {
|
|
83
|
-
await functionActions.createFunction(options, console);
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
// Validate function command
|
|
87
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
88
|
-
name: "validate",
|
|
89
|
-
description: "Validate a function",
|
|
90
|
-
options: [command_parser_1.COMMON_OPTIONS.path],
|
|
91
|
-
schema: command_schema_1.FunctionValidateOptionsSchema,
|
|
92
|
-
examples: [
|
|
93
|
-
{
|
|
94
|
-
description: "Validate current directory",
|
|
95
|
-
command: "ollieshop function validate",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
description: "Validate specific function",
|
|
99
|
-
command: "ollieshop function validate --path ./functions/validate-order",
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
handler: async (options, console) => {
|
|
103
|
-
await functionActions.validateFunction({
|
|
104
|
-
path: options.path || process.cwd(),
|
|
105
|
-
strict: options.strict ?? false,
|
|
106
|
-
fix: options.fix ?? false,
|
|
107
|
-
}, console);
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
// Test function command
|
|
111
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
112
|
-
name: "test",
|
|
113
|
-
description: "Test a function locally",
|
|
114
|
-
options: [
|
|
115
|
-
command_parser_1.COMMON_OPTIONS.path,
|
|
116
|
-
{
|
|
117
|
-
flags: "-w, --watch",
|
|
118
|
-
description: "Watch for changes",
|
|
119
|
-
defaultValue: false,
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
flags: "--payload <json>",
|
|
123
|
-
description: "Test payload (JSON string)",
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
flags: "--timeout <ms>",
|
|
127
|
-
description: "Timeout in milliseconds",
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
schema: command_schema_1.FunctionTestOptionsSchema,
|
|
131
|
-
examples: [
|
|
132
|
-
{
|
|
133
|
-
description: "Test function in current directory",
|
|
134
|
-
command: "ollieshop function test",
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
description: "Test with custom payload",
|
|
138
|
-
command: `ollieshop function test --payload '{"items": [{"id": "123", "quantity": 2}]}'`,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
description: "Test in watch mode",
|
|
142
|
-
command: "ollieshop function test --watch",
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
handler: async (options, console) => {
|
|
146
|
-
await functionActions.testFunction({
|
|
147
|
-
path: options.path || process.cwd(),
|
|
148
|
-
payload: options.payload,
|
|
149
|
-
timeout: options.timeout,
|
|
150
|
-
watch: options.watch ?? false,
|
|
151
|
-
coverage: options.coverage ?? false,
|
|
152
|
-
}, console);
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
// Deploy function command
|
|
156
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
157
|
-
name: "deploy",
|
|
158
|
-
description: "Build and deploy a function to cloud",
|
|
159
|
-
options: [
|
|
160
|
-
command_parser_1.COMMON_OPTIONS.path,
|
|
161
|
-
{
|
|
162
|
-
flags: "--id <id>",
|
|
163
|
-
description: "Function ID for deployment",
|
|
164
|
-
required: true,
|
|
165
|
-
},
|
|
166
|
-
command_parser_1.COMMON_OPTIONS.wait,
|
|
167
|
-
],
|
|
168
|
-
schema: command_schema_1.FunctionDeployOptionsSchema,
|
|
169
|
-
examples: [
|
|
170
|
-
{
|
|
171
|
-
description: "Deploy current directory",
|
|
172
|
-
command: "ollieshop function deploy",
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
description: "Deploy specific function and wait",
|
|
176
|
-
command: "ollieshop function deploy --path ./my-function --wait",
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
description: "Deploy with function ID",
|
|
180
|
-
command: "ollieshop function deploy --id func_123abc",
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
handler: async (options, console) => {
|
|
184
|
-
// Map id to functionId if provided
|
|
185
|
-
const deployOptions = {
|
|
186
|
-
path: options.path || process.cwd(),
|
|
187
|
-
functionId: options.id || options.functionId,
|
|
188
|
-
wait: options.wait,
|
|
189
|
-
};
|
|
190
|
-
await functionActions.deployFunction(deployOptions, console);
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
// List functions command
|
|
194
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
195
|
-
name: "list",
|
|
196
|
-
description: "List all functions",
|
|
197
|
-
aliases: ["ls"],
|
|
198
|
-
examples: [
|
|
199
|
-
{
|
|
200
|
-
description: "List all functions",
|
|
201
|
-
command: "ollieshop function list",
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
handler: async (_, console) => {
|
|
205
|
-
await functionActions.listFunctions(console);
|
|
206
|
-
},
|
|
207
|
-
});
|
|
208
|
-
// Deploy status command
|
|
209
|
-
cmd
|
|
210
|
-
.command("deploy-status <buildId>")
|
|
211
|
-
.description("Check the status of a function deployment")
|
|
212
|
-
.action(async (buildId) => {
|
|
213
|
-
try {
|
|
214
|
-
const { getBuildStatus } = await import("@ollie-shop/core");
|
|
215
|
-
const { console: cliConsole } = await import("../utils/console.js");
|
|
216
|
-
const spinner = cliConsole.spinner("Checking deployment status...");
|
|
217
|
-
const build = await getBuildStatus(buildId);
|
|
218
|
-
if (!build) {
|
|
219
|
-
spinner.fail("Build not found");
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
spinner.succeed();
|
|
223
|
-
cliConsole.info("Deployment Status:");
|
|
224
|
-
cliConsole.log(` Build ID: ${build.id}`);
|
|
225
|
-
cliConsole.log(` Status: ${build.status}`);
|
|
226
|
-
cliConsole.log(` Started: ${new Date(build.startTime).toLocaleString()}`);
|
|
227
|
-
if (build.endTime) {
|
|
228
|
-
cliConsole.log(` Completed: ${new Date(build.endTime).toLocaleString()}`);
|
|
229
|
-
}
|
|
230
|
-
if (build.deploymentUrl) {
|
|
231
|
-
cliConsole.success(`\nFunction URL: ${build.deploymentUrl}`);
|
|
232
|
-
}
|
|
233
|
-
if (build.error) {
|
|
234
|
-
cliConsole.error(`\nError: ${build.error}`);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
catch (error) {
|
|
238
|
-
const { console: cliConsole } = await import("../utils/console.js");
|
|
239
|
-
cliConsole.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
240
|
-
process.exit(1);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
package/dist/commands/help.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAc3D"}
|
package/dist/commands/help.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureHelpCommand = configureHelpCommand;
|
|
4
|
-
const console_1 = require("../utils/console");
|
|
5
|
-
function configureHelpCommand(program) {
|
|
6
|
-
program
|
|
7
|
-
.command("help [command]")
|
|
8
|
-
.description("Display help for a specific command or list all commands")
|
|
9
|
-
.action((cmdName) => {
|
|
10
|
-
if (cmdName) {
|
|
11
|
-
// For specific command help, show the program help with the command
|
|
12
|
-
console_1.console.info(`\nHelp for command: ${cmdName}`);
|
|
13
|
-
console_1.console.info("Use 'ollieshop <command> --help' for detailed help\n");
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
// Show general help
|
|
17
|
-
program.help();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
package/dist/commands/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAW3D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAevD"}
|
package/dist/commands/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerCommands = registerCommands;
|
|
4
|
-
const component_1 = require("./component");
|
|
5
|
-
const docs_1 = require("./docs");
|
|
6
|
-
const function_1 = require("./function");
|
|
7
|
-
const help_1 = require("./help");
|
|
8
|
-
const login_1 = require("./login");
|
|
9
|
-
const project_1 = require("./project");
|
|
10
|
-
const store_version_1 = require("./store-version");
|
|
11
|
-
const version_1 = require("./version");
|
|
12
|
-
const whoami_1 = require("./whoami");
|
|
13
|
-
function registerCommands(program) {
|
|
14
|
-
// Register simple commands that don't need heavy services
|
|
15
|
-
(0, docs_1.configureDocsCommand)(program);
|
|
16
|
-
(0, help_1.configureHelpCommand)(program);
|
|
17
|
-
(0, login_1.configureLoginCommand)(program);
|
|
18
|
-
(0, whoami_1.configureWhoamiCommand)(program);
|
|
19
|
-
// Register new commands
|
|
20
|
-
(0, store_version_1.registerStoreVersionCommands)(program);
|
|
21
|
-
(0, version_1.configureVersionCommand)(program);
|
|
22
|
-
// Register complex commands with lazy service loading
|
|
23
|
-
(0, component_1.registerComponentCommands)(program);
|
|
24
|
-
(0, function_1.registerFunctionCommands)(program);
|
|
25
|
-
(0, project_1.registerProjectCommands)(program);
|
|
26
|
-
}
|
package/dist/commands/login.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAO3D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CA+B/D"}
|