@swell/cli 2.1.0 → 2.2.1
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/dist/commands/api/delete.d.ts +15 -0
- package/dist/commands/api/delete.js +26 -0
- package/dist/commands/api/get.d.ts +15 -0
- package/dist/commands/api/get.js +31 -0
- package/dist/commands/api/index.d.ts +7 -0
- package/dist/commands/api/index.js +16 -0
- package/dist/commands/api/post.d.ts +16 -0
- package/dist/commands/api/post.js +33 -0
- package/dist/commands/api/put.d.ts +16 -0
- package/dist/commands/api/put.js +33 -0
- package/dist/commands/app/dev.d.ts +9 -9
- package/dist/commands/app/dev.js +163 -139
- package/dist/commands/app/frontend/dev.d.ts +1 -1
- package/dist/commands/app/frontend/dev.js +84 -78
- package/dist/commands/app/install.js +3 -3
- package/dist/commands/app/pull.d.ts +1 -1
- package/dist/commands/app/pull.js +6 -6
- package/dist/commands/app/push.d.ts +3 -3
- package/dist/commands/app/push.js +8 -6
- package/dist/commands/app/release.d.ts +1 -1
- package/dist/commands/app/release.js +1 -1
- package/dist/commands/app/version.d.ts +1 -1
- package/dist/commands/app/version.js +5 -3
- package/dist/commands/create/app.d.ts +10 -2
- package/dist/commands/create/app.js +226 -57
- package/dist/commands/create/content.d.ts +4 -0
- package/dist/commands/create/content.js +83 -15
- package/dist/commands/create/function.js +27 -5
- package/dist/commands/create/index.js +5 -1
- package/dist/commands/create/model.d.ts +4 -0
- package/dist/commands/create/model.js +120 -25
- package/dist/commands/create/tests.d.ts +15 -0
- package/dist/commands/create/tests.js +79 -0
- package/dist/commands/inspect/content.d.ts +25 -0
- package/dist/commands/inspect/content.js +159 -0
- package/dist/commands/inspect/index.d.ts +7 -0
- package/dist/commands/inspect/index.js +16 -0
- package/dist/commands/inspect/models.d.ts +27 -0
- package/dist/commands/inspect/models.js +197 -0
- package/dist/commands/schema.d.ts +27 -0
- package/dist/commands/schema.js +231 -0
- package/dist/commands/theme/dev.d.ts +1 -1
- package/dist/commands/theme/dev.js +2 -2
- package/dist/commands/theme/init.d.ts +1 -1
- package/dist/commands/theme/init.js +1 -1
- package/dist/commands/theme/pull.d.ts +2 -2
- package/dist/commands/theme/pull.js +2 -2
- package/dist/commands/theme/push.d.ts +1 -1
- package/dist/commands/theme/push.js +1 -1
- package/dist/create-app-command.d.ts +12 -2
- package/dist/create-app-command.js +103 -80
- package/dist/create-collection-command.js +4 -1
- package/dist/create-config-command.js +4 -0
- package/dist/env/local.d.ts +1 -0
- package/dist/env/local.js +1 -0
- package/dist/env/production.d.ts +1 -0
- package/dist/env/production.js +1 -0
- package/dist/env/review.d.ts +1 -0
- package/dist/env/review.js +1 -0
- package/dist/env/staging.d.ts +1 -0
- package/dist/env/staging.js +1 -0
- package/dist/lib/api.d.ts +16 -5
- package/dist/lib/api.js +67 -25
- package/dist/lib/app-config.js +1 -0
- package/dist/lib/apps/index.d.ts +2 -0
- package/dist/lib/apps/index.js +20 -14
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/constants.d.ts +1 -0
- package/dist/lib/constants.js +1 -0
- package/dist/lib/create/content.d.ts +5 -1
- package/dist/lib/create/content.js +8 -1
- package/dist/lib/create/function.d.ts +2 -1
- package/dist/lib/create/function.js +7 -3
- package/dist/lib/create/model.d.ts +1 -0
- package/dist/lib/create/schemas.d.ts +6 -0
- package/dist/lib/create/schemas.js +6 -0
- package/dist/lib/create/tests/templates/env-dts.d.ts +1 -0
- package/dist/lib/create/tests/templates/env-dts.js +14 -0
- package/dist/lib/create/tests/templates/index.d.ts +8 -0
- package/dist/lib/create/tests/templates/index.js +8 -0
- package/dist/lib/create/tests/templates/integration-test.d.ts +1 -0
- package/dist/lib/create/tests/templates/integration-test.js +19 -0
- package/dist/lib/create/tests/templates/mock-request.d.ts +2 -0
- package/dist/lib/create/tests/templates/mock-request.js +112 -0
- package/dist/lib/create/tests/templates/setup-globals.d.ts +1 -0
- package/dist/lib/create/tests/templates/setup-globals.js +23 -0
- package/dist/lib/create/tests/templates/swell-client.d.ts +1 -0
- package/dist/lib/create/tests/templates/swell-client.js +126 -0
- package/dist/lib/create/tests/templates/tsconfig.d.ts +1 -0
- package/dist/lib/create/tests/templates/tsconfig.js +15 -0
- package/dist/lib/create/tests/templates/unit-test.d.ts +1 -0
- package/dist/lib/create/tests/templates/unit-test.js +42 -0
- package/dist/lib/create/tests/templates/vitest-config.d.ts +2 -0
- package/dist/lib/create/tests/templates/vitest-config.js +121 -0
- package/dist/lib/create/tests/types.d.ts +21 -0
- package/dist/lib/create/tests/types.js +1 -0
- package/dist/lib/create/tests.d.ts +4 -0
- package/dist/lib/create/tests.js +113 -0
- package/dist/lib/sessions.js +4 -3
- package/dist/lib/style.js +0 -1
- package/dist/lib/theme-sync.d.ts +6 -6
- package/dist/lib/theme-sync.js +49 -39
- package/dist/push-app-command.d.ts +7 -7
- package/dist/push-app-command.js +38 -36
- package/dist/remote-app-command.d.ts +1 -1
- package/dist/remote-app-command.js +4 -2
- package/dist/swell-api-command.d.ts +13 -0
- package/dist/swell-api-command.js +75 -0
- package/dist/swell-command.d.ts +1 -1
- package/dist/swell-command.js +9 -9
- package/oclif.manifest.json +639 -46
- package/package.json +8 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
2
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
3
|
+
export default class ApiDelete extends SwellApiCommand {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static args: {
|
|
7
|
+
path: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
live: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static examples: string[];
|
|
13
|
+
get method(): HttpMethod;
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
3
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
4
|
+
export default class ApiDelete extends SwellApiCommand {
|
|
5
|
+
static summary = 'Send a DELETE request to the Swell API.';
|
|
6
|
+
static description = 'Remove existing resources from the Swell Backend API.';
|
|
7
|
+
static args = {
|
|
8
|
+
path: Args.string({
|
|
9
|
+
description: 'API endpoint path (must start with /)',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static flags = {
|
|
14
|
+
live: Flags.boolean({
|
|
15
|
+
description: 'Use live environment instead of test',
|
|
16
|
+
default: false,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
static examples = ['swell api delete /products/abc123'];
|
|
20
|
+
get method() {
|
|
21
|
+
return HttpMethod.DELETE;
|
|
22
|
+
}
|
|
23
|
+
async run() {
|
|
24
|
+
await this.request(ApiDelete);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
2
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
3
|
+
export default class ApiGet extends SwellApiCommand {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static args: {
|
|
7
|
+
path: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
live: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static examples: string[];
|
|
13
|
+
get method(): HttpMethod;
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
3
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
4
|
+
export default class ApiGet extends SwellApiCommand {
|
|
5
|
+
static summary = 'Send a GET request to the Swell API.';
|
|
6
|
+
static description = `Retrieve data from the Swell Backend API.
|
|
7
|
+
The command performs a GET request to the specified endpoint path.`;
|
|
8
|
+
static args = {
|
|
9
|
+
path: Args.string({
|
|
10
|
+
description: 'API endpoint path (must start with /)',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
static flags = {
|
|
15
|
+
live: Flags.boolean({
|
|
16
|
+
description: 'Use live environment instead of test',
|
|
17
|
+
default: false,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static examples = [
|
|
21
|
+
'swell api get /products',
|
|
22
|
+
'swell api get "/products?limit=10&category=shoes"',
|
|
23
|
+
'swell api get /products/abc123',
|
|
24
|
+
];
|
|
25
|
+
get method() {
|
|
26
|
+
return HttpMethod.GET;
|
|
27
|
+
}
|
|
28
|
+
async run() {
|
|
29
|
+
await this.request(ApiGet);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Api extends Command {
|
|
3
|
+
static summary = 'Send requests directly to the Swell Backend API.';
|
|
4
|
+
static description = `Run Swell API requests directly from the command line.
|
|
5
|
+
Supports GET, POST, PUT, and DELETE methods with optional test/live environments.`;
|
|
6
|
+
static examples = [
|
|
7
|
+
'swell api get /products',
|
|
8
|
+
'swell api post /products --body \'{"name":"New product"}\'',
|
|
9
|
+
'swell api put /products/abc123 --body ./update.json',
|
|
10
|
+
'swell api delete /products/abc123',
|
|
11
|
+
];
|
|
12
|
+
async run() {
|
|
13
|
+
this.log('Use "swell api get|post|put|delete" to interact with the Swell API.');
|
|
14
|
+
this.log('Run "swell api --help" for more information.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
2
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
3
|
+
export default class ApiPost extends SwellApiCommand {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static args: {
|
|
7
|
+
path: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
body: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
live: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
static examples: string[];
|
|
14
|
+
get method(): HttpMethod;
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
3
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
4
|
+
export default class ApiPost extends SwellApiCommand {
|
|
5
|
+
static summary = 'Send a POST request to the Swell API.';
|
|
6
|
+
static description = `Create new resources in the Swell Backend API.
|
|
7
|
+
You can provide a JSON body directly or specify a file path containing JSON data.`;
|
|
8
|
+
static args = {
|
|
9
|
+
path: Args.string({
|
|
10
|
+
description: 'API endpoint path (must start with /)',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
static flags = {
|
|
15
|
+
body: Flags.string({
|
|
16
|
+
description: 'Request body (inline JSON or file path)',
|
|
17
|
+
}),
|
|
18
|
+
live: Flags.boolean({
|
|
19
|
+
description: 'Use live environment instead of test',
|
|
20
|
+
default: false,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
static examples = [
|
|
24
|
+
'swell api post /products --body \'{"name": "Product", "price": 100}\'',
|
|
25
|
+
'swell api post /products --body ./product.json',
|
|
26
|
+
];
|
|
27
|
+
get method() {
|
|
28
|
+
return HttpMethod.POST;
|
|
29
|
+
}
|
|
30
|
+
async run() {
|
|
31
|
+
await this.request(ApiPost);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
2
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
3
|
+
export default class ApiPut extends SwellApiCommand {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static args: {
|
|
7
|
+
path: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
body: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
live: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
static examples: string[];
|
|
14
|
+
get method(): HttpMethod;
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { HttpMethod } from '../../lib/api.js';
|
|
3
|
+
import { SwellApiCommand } from '../../swell-api-command.js';
|
|
4
|
+
export default class ApiPut extends SwellApiCommand {
|
|
5
|
+
static summary = 'Send a PUT request to the Swell API.';
|
|
6
|
+
static description = `Update existing resources in the Swell Backend API.
|
|
7
|
+
You can provide a JSON body directly or specify a file path containing JSON data.`;
|
|
8
|
+
static args = {
|
|
9
|
+
path: Args.string({
|
|
10
|
+
description: 'API endpoint path (must start with /)',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
static flags = {
|
|
15
|
+
body: Flags.string({
|
|
16
|
+
description: 'Request body (inline JSON or file path)',
|
|
17
|
+
}),
|
|
18
|
+
live: Flags.boolean({
|
|
19
|
+
description: 'Use live environment instead of test',
|
|
20
|
+
default: false,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
static examples = [
|
|
24
|
+
'swell api put /products/{id} --body \'{"id": "abc123", "name": "Updated"}\'',
|
|
25
|
+
'swell api put /products/abc123 --body ./product.json',
|
|
26
|
+
];
|
|
27
|
+
get method() {
|
|
28
|
+
return HttpMethod.PUT;
|
|
29
|
+
}
|
|
30
|
+
async run() {
|
|
31
|
+
await this.request(ApiPut);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PushAppCommand } from '../../push-app-command.js';
|
|
2
2
|
export default class AppDev extends PushAppCommand {
|
|
3
|
+
static delayOrientation: boolean;
|
|
3
4
|
static examples: string[];
|
|
4
5
|
static flags: {
|
|
5
6
|
'no-push': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
@@ -8,23 +9,22 @@ export default class AppDev extends PushAppCommand {
|
|
|
8
9
|
'storefront-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
10
|
'storefront-select': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
11
|
};
|
|
11
|
-
static summary: string;
|
|
12
|
-
static delayOrientation: boolean;
|
|
13
12
|
static orientation: {
|
|
14
13
|
env: string;
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
functionPorts: Map<string, number>;
|
|
15
|
+
static summary: string;
|
|
18
16
|
functionErrors: Map<string, string>;
|
|
17
|
+
functionPorts: Map<string, number>;
|
|
18
|
+
tmpDir: string;
|
|
19
19
|
run(): Promise<void>;
|
|
20
|
-
private startAppFunctionServer;
|
|
21
20
|
runAppFrontendDevIfApplicable(frontendPort?: number): Promise<number | void>;
|
|
21
|
+
private createFunctionRouter;
|
|
22
|
+
private createTmpDirectory;
|
|
23
|
+
private generateWranglerConfig;
|
|
22
24
|
private getAppFunctions;
|
|
23
25
|
private logAllFunctions;
|
|
24
26
|
private logFunction;
|
|
25
|
-
private createTmpDirectory;
|
|
26
|
-
private startFunctionServers;
|
|
27
|
-
private generateWranglerConfig;
|
|
28
|
-
private createFunctionRouter;
|
|
29
27
|
private onChangeFunctionWatcher;
|
|
28
|
+
private startAppFunctionServer;
|
|
29
|
+
private startFunctionServers;
|
|
30
30
|
}
|