@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,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 +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"}
|
|
@@ -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"}
|