@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.
Files changed (139) hide show
  1. package/.turbo/turbo-build.log +14 -2
  2. package/CHANGELOG.md +48 -0
  3. package/__tests__/mocks/core.ts +1 -1
  4. package/dist/index.d.ts +0 -2
  5. package/dist/index.js +40631 -75
  6. package/package.json +7 -6
  7. package/src/actions/component.actions.ts +148 -204
  8. package/src/actions/function.actions.ts +78 -171
  9. package/src/actions/project.actions.ts +16 -11
  10. package/src/commands/__tests__/component.test.ts +4 -7
  11. package/src/commands/__tests__/function.test.ts +1 -1
  12. package/src/commands/__tests__/store-version.test.ts +1 -4
  13. package/src/commands/component.ts +0 -10
  14. package/src/commands/function.ts +5 -56
  15. package/src/schemas/command.schema.ts +296 -6
  16. package/src/utils/__tests__/rich-progress.test.ts +22 -11
  17. package/src/utils/cli-progress-reporter.ts +2 -2
  18. package/src/utils/command-parser.ts +0 -5
  19. package/src/utils/console.ts +33 -4
  20. package/src/utils/constants.ts +32 -0
  21. package/src/utils/deploy-helpers.ts +357 -0
  22. package/src/utils/errors.ts +133 -2
  23. package/src/utils/interactive-builder.ts +61 -7
  24. package/src/utils/rich-progress.ts +25 -14
  25. package/src/utils/validation-helpers.ts +145 -12
  26. package/tsup.config.ts +15 -0
  27. package/dist/__tests__/helpers/cli-test-helper.d.ts +0 -89
  28. package/dist/__tests__/helpers/cli-test-helper.d.ts.map +0 -1
  29. package/dist/__tests__/helpers/cli-test-helper.js +0 -220
  30. package/dist/__tests__/mocks/index.d.ts +0 -69
  31. package/dist/__tests__/mocks/index.d.ts.map +0 -1
  32. package/dist/__tests__/mocks/index.js +0 -77
  33. package/dist/actions/component.actions.d.ts +0 -14
  34. package/dist/actions/component.actions.d.ts.map +0 -1
  35. package/dist/actions/component.actions.js +0 -273
  36. package/dist/actions/function.actions.d.ts +0 -15
  37. package/dist/actions/function.actions.d.ts.map +0 -1
  38. package/dist/actions/function.actions.js +0 -254
  39. package/dist/actions/project.actions.d.ts +0 -17
  40. package/dist/actions/project.actions.d.ts.map +0 -1
  41. package/dist/actions/project.actions.js +0 -97
  42. package/dist/actions/version.actions.d.ts +0 -19
  43. package/dist/actions/version.actions.d.ts.map +0 -1
  44. package/dist/actions/version.actions.js +0 -216
  45. package/dist/commands/component.d.ts +0 -3
  46. package/dist/commands/component.d.ts.map +0 -1
  47. package/dist/commands/component.js +0 -192
  48. package/dist/commands/docs.d.ts +0 -3
  49. package/dist/commands/docs.d.ts.map +0 -1
  50. package/dist/commands/docs.js +0 -16
  51. package/dist/commands/function.d.ts +0 -3
  52. package/dist/commands/function.d.ts.map +0 -1
  53. package/dist/commands/function.js +0 -243
  54. package/dist/commands/help.d.ts +0 -3
  55. package/dist/commands/help.d.ts.map +0 -1
  56. package/dist/commands/help.js +0 -20
  57. package/dist/commands/index.d.ts +0 -3
  58. package/dist/commands/index.d.ts.map +0 -1
  59. package/dist/commands/index.js +0 -26
  60. package/dist/commands/login.d.ts +0 -3
  61. package/dist/commands/login.d.ts.map +0 -1
  62. package/dist/commands/login.js +0 -175
  63. package/dist/commands/project.d.ts +0 -3
  64. package/dist/commands/project.d.ts.map +0 -1
  65. package/dist/commands/project.js +0 -78
  66. package/dist/commands/store-version.d.ts +0 -3
  67. package/dist/commands/store-version.d.ts.map +0 -1
  68. package/dist/commands/store-version.js +0 -241
  69. package/dist/commands/version.d.ts +0 -3
  70. package/dist/commands/version.d.ts.map +0 -1
  71. package/dist/commands/version.js +0 -46
  72. package/dist/commands/whoami.d.ts +0 -3
  73. package/dist/commands/whoami.d.ts.map +0 -1
  74. package/dist/commands/whoami.js +0 -41
  75. package/dist/index.d.ts.map +0 -1
  76. package/dist/prompts/component.prompts.d.ts +0 -14
  77. package/dist/prompts/component.prompts.d.ts.map +0 -1
  78. package/dist/prompts/component.prompts.js +0 -75
  79. package/dist/prompts/function.prompts.d.ts +0 -21
  80. package/dist/prompts/function.prompts.d.ts.map +0 -1
  81. package/dist/prompts/function.prompts.js +0 -127
  82. package/dist/schemas/command.schema.d.ts +0 -516
  83. package/dist/schemas/command.schema.d.ts.map +0 -1
  84. package/dist/schemas/command.schema.js +0 -267
  85. package/dist/types/index.d.ts +0 -147
  86. package/dist/types/index.d.ts.map +0 -1
  87. package/dist/types/index.js +0 -18
  88. package/dist/utils/auth.d.ts +0 -4
  89. package/dist/utils/auth.d.ts.map +0 -1
  90. package/dist/utils/auth.js +0 -26
  91. package/dist/utils/cli-progress-reporter.d.ts +0 -12
  92. package/dist/utils/cli-progress-reporter.d.ts.map +0 -1
  93. package/dist/utils/cli-progress-reporter.js +0 -77
  94. package/dist/utils/command-builder.d.ts +0 -22
  95. package/dist/utils/command-builder.d.ts.map +0 -1
  96. package/dist/utils/command-builder.js +0 -268
  97. package/dist/utils/command-helpers.d.ts +0 -19
  98. package/dist/utils/command-helpers.d.ts.map +0 -1
  99. package/dist/utils/command-helpers.js +0 -79
  100. package/dist/utils/command-parser.d.ts +0 -146
  101. package/dist/utils/command-parser.d.ts.map +0 -1
  102. package/dist/utils/command-parser.js +0 -179
  103. package/dist/utils/command-suggestions.d.ts +0 -35
  104. package/dist/utils/command-suggestions.d.ts.map +0 -1
  105. package/dist/utils/command-suggestions.js +0 -152
  106. package/dist/utils/console.d.ts +0 -44
  107. package/dist/utils/console.d.ts.map +0 -1
  108. package/dist/utils/console.js +0 -233
  109. package/dist/utils/constants.d.ts +0 -8
  110. package/dist/utils/constants.d.ts.map +0 -1
  111. package/dist/utils/constants.js +0 -10
  112. package/dist/utils/context-detector.d.ts +0 -12
  113. package/dist/utils/context-detector.d.ts.map +0 -1
  114. package/dist/utils/context-detector.js +0 -155
  115. package/dist/utils/enhanced-error-handler.d.ts +0 -47
  116. package/dist/utils/enhanced-error-handler.d.ts.map +0 -1
  117. package/dist/utils/enhanced-error-handler.js +0 -221
  118. package/dist/utils/error-handler.d.ts +0 -3
  119. package/dist/utils/error-handler.d.ts.map +0 -1
  120. package/dist/utils/error-handler.js +0 -55
  121. package/dist/utils/errors.d.ts +0 -44
  122. package/dist/utils/errors.d.ts.map +0 -1
  123. package/dist/utils/errors.js +0 -76
  124. package/dist/utils/interactive-builder.d.ts +0 -22
  125. package/dist/utils/interactive-builder.d.ts.map +0 -1
  126. package/dist/utils/interactive-builder.js +0 -246
  127. package/dist/utils/rich-progress.d.ts +0 -59
  128. package/dist/utils/rich-progress.d.ts.map +0 -1
  129. package/dist/utils/rich-progress.js +0 -234
  130. package/dist/utils/store.d.ts +0 -11
  131. package/dist/utils/store.d.ts.map +0 -1
  132. package/dist/utils/store.js +0 -19
  133. package/dist/utils/validation-error-formatter.d.ts +0 -25
  134. package/dist/utils/validation-error-formatter.d.ts.map +0 -1
  135. package/dist/utils/validation-error-formatter.js +0 -258
  136. package/dist/utils/validation-helpers.d.ts +0 -60
  137. package/dist/utils/validation-helpers.d.ts.map +0 -1
  138. package/dist/utils/validation-helpers.js +0 -152
  139. package/src/commands/__tests__/version.test.ts +0 -71
@@ -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"}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initProject = initProject;
4
- exports.validateProject = validateProject;
5
- exports.buildProject = buildProject;
6
- exports.startDevServer = startDevServer;
7
- const validation_helpers_1 = require("../utils/validation-helpers");
8
- async function initProject(options, cliConsole) {
9
- // Lazy import - only loaded when this function is called
10
- const { initProject: initProjectService } = await import("@ollie-shop/core");
11
- const spinner = cliConsole.spinner({
12
- text: "Initializing project...",
13
- });
14
- try {
15
- // Map our template names to core service expected names
16
- const templateMap = {
17
- default: "default",
18
- grocery: "grocery",
19
- sales: "sales",
20
- };
21
- const coreTemplate = templateMap[options.template] || "default";
22
- const result = await initProjectService({
23
- name: options.name || "my-ollie-shop",
24
- template: coreTemplate,
25
- typescript: true, // Always use TypeScript
26
- git: options.git ?? true,
27
- installDeps: options.install ?? true,
28
- components: [],
29
- platformStoreId: "local",
30
- platform: "custom",
31
- });
32
- spinner.succeed("Project initialized successfully!");
33
- cliConsole.success(`Project created at: ${result.projectPath}`);
34
- if (options.git) {
35
- cliConsole.info("Git repository initialized");
36
- }
37
- cliConsole.nextSteps("Next steps", [
38
- {
39
- description: "Navigate to project directory",
40
- command: `cd ${result.projectPath}`,
41
- },
42
- {
43
- description: "Install dependencies",
44
- command: "npm install",
45
- },
46
- {
47
- description: "Start development server",
48
- command: "npm run dev",
49
- },
50
- ]);
51
- }
52
- catch (error) {
53
- spinner.fail("Failed to initialize project");
54
- throw error;
55
- }
56
- }
57
- async function validateProject(options, cliConsole) {
58
- // Lazy import - only loaded when this function is called
59
- const { validateProject: validateProjectService } = await import("@ollie-shop/core");
60
- const targetPath = options.path || process.cwd();
61
- const spinner = cliConsole.spinner({ text: "Validating project..." });
62
- try {
63
- const result = await validateProjectService(targetPath);
64
- (0, validation_helpers_1.handleValidationResult)(result, spinner, cliConsole, "Project");
65
- }
66
- catch (error) {
67
- spinner.fail("Validation failed");
68
- throw error;
69
- }
70
- }
71
- async function buildProject(options, cliConsole) {
72
- // TODO: Implement project building functionality
73
- // This function needs to be implemented in the core package
74
- const targetPath = options.path || process.cwd();
75
- cliConsole.warn("Project building is not yet implemented");
76
- cliConsole.info(`Target path: ${targetPath}`);
77
- if (options.watch) {
78
- cliConsole.info("Watch mode would be enabled when implemented");
79
- }
80
- cliConsole.suggestions([
81
- "Build components individually with: ollieshop component build",
82
- "Build functions individually with: ollieshop function build",
83
- ]);
84
- }
85
- async function startDevServer(options, cliConsole) {
86
- // TODO: Implement development server functionality
87
- // This function needs to be implemented in the core package
88
- cliConsole.warn("Development server is not yet implemented");
89
- cliConsole.info(`Would start server on port ${options.port || 3000}`);
90
- if (options.open) {
91
- cliConsole.info("Would open browser when implemented");
92
- }
93
- cliConsole.suggestions([
94
- "Start component development with: cd components/[name] && npm run dev",
95
- "Start function development with: cd functions/[name] && npm run dev",
96
- ]);
97
- }
@@ -1,19 +0,0 @@
1
- interface CreateOptions {
2
- store: string;
3
- name: string;
4
- template?: string;
5
- active?: boolean;
6
- }
7
- interface ListOptions {
8
- store: string;
9
- }
10
- export declare function create(options: CreateOptions): Promise<void>;
11
- export declare function list(options: ListOptions): Promise<void>;
12
- export declare function get(versionId: string): Promise<void>;
13
- export declare function setDefault(versionId: string): Promise<void>;
14
- export declare function activate(versionId: string): Promise<void>;
15
- export declare function deactivate(versionId: string): Promise<void>;
16
- export declare function clone(sourceId: string, name: string): Promise<void>;
17
- export declare function deleteVersion(versionId: string, force?: boolean): Promise<void>;
18
- export {};
19
- //# sourceMappingURL=version.actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.actions.d.ts","sourceRoot":"","sources":["../../src/actions/version.actions.ts"],"names":[],"mappings":"AAKA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgClE;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC9D;AAED,wBAAsB,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsC1D;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAejE;AAED,wBAAsB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/D;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAejE;AAED,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBzE;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CAuBf"}
@@ -1,216 +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.create = create;
37
- exports.list = list;
38
- exports.get = get;
39
- exports.setDefault = setDefault;
40
- exports.activate = activate;
41
- exports.deactivate = deactivate;
42
- exports.clone = clone;
43
- exports.deleteVersion = deleteVersion;
44
- const core = __importStar(require("@ollie-shop/core"));
45
- const console_1 = require("../utils/console");
46
- const error_handler_1 = require("../utils/error-handler");
47
- async function create(options) {
48
- const spinner = console_1.console.spinner("Creating version...");
49
- try {
50
- const version = await core.createVersion({
51
- storeId: options.store,
52
- name: options.name,
53
- template: options.template || "default",
54
- active: options.active ?? true,
55
- });
56
- spinner.succeed(`Version "${version.name}" created successfully`);
57
- console_1.console.info("\nVersion details:");
58
- console_1.console.table([
59
- {
60
- ID: version.id,
61
- Name: version.name,
62
- Template: version.template || "default",
63
- Active: version.active ? "✓" : "✗",
64
- Default: version.default ? "✓" : "✗",
65
- },
66
- ]);
67
- if (!version.active) {
68
- console_1.console.dim("\nNote: This version is inactive. Activate it with:");
69
- console_1.console.dim(` ollieshop version activate ${version.id}`);
70
- }
71
- }
72
- catch (error) {
73
- spinner.fail("Failed to create version");
74
- (0, error_handler_1.handleError)(error);
75
- }
76
- }
77
- async function list(options) {
78
- const spinner = console_1.console.spinner("Loading versions...");
79
- try {
80
- const versions = await core.listVersions(options.store);
81
- spinner.succeed();
82
- if (versions.length === 0) {
83
- console_1.console.warn("No versions found for this store");
84
- console_1.console.dim("\nCreate a version with:");
85
- console_1.console.dim(` ollieshop version create --store ${options.store} --name "My Version"`);
86
- return;
87
- }
88
- console_1.console.info(`Found ${versions.length} version${versions.length === 1 ? "" : "s"}:\n`);
89
- console_1.console.table(versions.map((v) => ({
90
- ID: v.id,
91
- Name: v.name,
92
- Template: v.template || "default",
93
- Active: v.active ? "✓" : "✗",
94
- Default: v.default ? "✓" : "✗",
95
- Created: new Date(v.createdAt).toLocaleDateString(),
96
- })));
97
- }
98
- catch (error) {
99
- spinner.fail("Failed to list versions");
100
- (0, error_handler_1.handleError)(error);
101
- }
102
- }
103
- async function get(versionId) {
104
- const spinner = console_1.console.spinner("Loading version...");
105
- try {
106
- const version = await core.getVersion(versionId);
107
- spinner.succeed();
108
- console_1.console.info("Version details:\n");
109
- const details = {
110
- ID: version.id,
111
- Name: version.name,
112
- "Store ID": version.storeId,
113
- Template: version.template || "default",
114
- Active: version.active ? "Yes" : "No",
115
- Default: version.default ? "Yes" : "No",
116
- Created: new Date(version.createdAt).toLocaleString(),
117
- Updated: new Date(version.updatedAt).toLocaleString(),
118
- };
119
- for (const [key, value] of Object.entries(details)) {
120
- console_1.console.log(`${console_1.console.bold(`${key}:`)} ${value}`);
121
- }
122
- if (version.theme) {
123
- console_1.console.info("\nTheme configuration:");
124
- console_1.console.json(version.theme);
125
- }
126
- if (version.props) {
127
- console_1.console.info("\nProps configuration:");
128
- console_1.console.json(version.props);
129
- }
130
- }
131
- catch (error) {
132
- spinner.fail("Failed to get version");
133
- (0, error_handler_1.handleError)(error);
134
- }
135
- }
136
- async function setDefault(versionId) {
137
- const spinner = console_1.console.spinner("Setting default version...");
138
- try {
139
- await core.setDefaultVersion(versionId);
140
- spinner.succeed("Version set as default successfully");
141
- console_1.console.dim("\nThis version will now be used for all new checkout sessions.");
142
- }
143
- catch (error) {
144
- spinner.fail("Failed to set default version");
145
- (0, error_handler_1.handleError)(error);
146
- }
147
- }
148
- async function activate(versionId) {
149
- const spinner = console_1.console.spinner("Activating version...");
150
- try {
151
- const version = await core.activateVersion(versionId);
152
- spinner.succeed(`Version "${version.name}" activated successfully`);
153
- if (!version.default) {
154
- console_1.console.dim("\nTo make this the default version, run:");
155
- console_1.console.dim(` ollieshop version set-default ${versionId}`);
156
- }
157
- }
158
- catch (error) {
159
- spinner.fail("Failed to activate version");
160
- (0, error_handler_1.handleError)(error);
161
- }
162
- }
163
- async function deactivate(versionId) {
164
- const spinner = console_1.console.spinner("Deactivating version...");
165
- try {
166
- const version = await core.deactivateVersion(versionId);
167
- spinner.succeed(`Version "${version.name}" deactivated successfully`);
168
- console_1.console.warn("\nWarning: This version can no longer be used for checkout sessions.");
169
- }
170
- catch (error) {
171
- spinner.fail("Failed to deactivate version");
172
- (0, error_handler_1.handleError)(error);
173
- }
174
- }
175
- async function clone(sourceId, name) {
176
- const spinner = console_1.console.spinner("Cloning version...");
177
- try {
178
- const newVersion = await core.cloneVersion(sourceId, name);
179
- spinner.succeed(`Version cloned successfully as "${newVersion.name}"`);
180
- console_1.console.info("\nCloned version details:");
181
- console_1.console.table([
182
- {
183
- ID: newVersion.id,
184
- Name: newVersion.name,
185
- Template: newVersion.template || "default",
186
- Active: newVersion.active ? "✓" : "✗",
187
- Default: newVersion.default ? "✓" : "✗",
188
- },
189
- ]);
190
- console_1.console.dim("\nNote: The cloned version is inactive. To activate it:");
191
- console_1.console.dim(` ollieshop version activate ${newVersion.id}`);
192
- }
193
- catch (error) {
194
- spinner.fail("Failed to clone version");
195
- (0, error_handler_1.handleError)(error);
196
- }
197
- }
198
- async function deleteVersion(versionId, force) {
199
- // Confirm deletion if not forced
200
- if (!force) {
201
- const confirmed = await console_1.console.confirm("Are you sure you want to delete this version? This action cannot be undone.");
202
- if (!confirmed) {
203
- console_1.console.info("Deletion cancelled");
204
- return;
205
- }
206
- }
207
- const spinner = console_1.console.spinner("Deleting version...");
208
- try {
209
- await core.deleteVersion(versionId);
210
- spinner.succeed("Version deleted successfully");
211
- }
212
- catch (error) {
213
- spinner.fail("Failed to delete version");
214
- (0, error_handler_1.handleError)(error);
215
- }
216
- }
@@ -1,3 +0,0 @@
1
- import type { Command } from "@commander-js/extra-typings";
2
- export declare function registerComponentCommands(program: Command): void;
3
- //# sourceMappingURL=component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/commands/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAa3D,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8KhE"}