@swell/cli 2.0.1-alpha.17 → 2.0.1-alpha.18
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/app-command.d.ts +1 -1
- package/dist/app-command.js +3 -3
- package/dist/commands/app/dev.d.ts +3 -5
- package/dist/commands/app/dev.js +3 -6
- package/dist/commands/app/frontend/deploy.d.ts +1 -3
- package/dist/commands/app/frontend/deploy.js +2 -5
- package/dist/commands/app/frontend/dev.d.ts +4 -6
- package/dist/commands/app/frontend/dev.js +12 -15
- package/dist/commands/app/info.js +1 -3
- package/dist/commands/app/init.js +2 -2
- package/dist/commands/app/install.js +0 -1
- package/dist/commands/app/pull.d.ts +3 -3
- package/dist/commands/app/pull.js +16 -16
- package/dist/commands/app/push.d.ts +4 -4
- package/dist/commands/app/push.js +28 -31
- package/dist/commands/app/release.d.ts +3 -3
- package/dist/commands/app/release.js +43 -45
- package/dist/commands/app/version.d.ts +4 -4
- package/dist/commands/app/version.js +28 -28
- package/dist/commands/create/app.d.ts +15 -15
- package/dist/commands/create/app.js +66 -66
- package/dist/commands/create/frontend.js +4 -7
- package/dist/commands/env.d.ts +12 -0
- package/dist/commands/env.js +31 -0
- package/dist/commands/login.js +1 -3
- package/dist/commands/logs.js +0 -2
- package/dist/commands/theme/dev.d.ts +6 -8
- package/dist/commands/theme/dev.js +30 -33
- package/dist/commands/theme/init.d.ts +1 -1
- package/dist/commands/theme/init.js +1 -1
- package/dist/commands/theme/pull.d.ts +7 -7
- package/dist/commands/theme/pull.js +21 -21
- package/dist/commands/theme/push.d.ts +7 -7
- package/dist/commands/theme/push.js +24 -27
- package/dist/create-app-command.d.ts +7 -7
- package/dist/create-app-command.js +146 -147
- package/dist/create-config-command.js +0 -2
- package/dist/env/local.d.ts +8 -0
- package/dist/env/local.js +7 -0
- package/dist/env/production.d.ts +8 -0
- package/dist/env/production.js +7 -0
- package/dist/env/review.d.ts +8 -0
- package/dist/env/review.js +7 -0
- package/dist/env/staging.d.ts +8 -0
- package/dist/env/staging.js +7 -0
- package/dist/lib/api.d.ts +3 -3
- package/dist/lib/api.js +35 -35
- package/dist/lib/app-config.d.ts +2 -2
- package/dist/lib/app-config.js +12 -11
- package/dist/lib/apps/app-config.d.ts +19 -19
- package/dist/lib/apps/app-config.js +59 -65
- package/dist/lib/apps/index.d.ts +56 -56
- package/dist/lib/apps/index.js +40 -42
- package/dist/lib/apps/paths.d.ts +1 -1
- package/dist/lib/apps/paths.js +4 -4
- package/dist/lib/config.d.ts +4 -1
- package/dist/lib/config.js +35 -1
- package/dist/lib/constants.js +7 -8
- package/dist/lib/create/index.js +2 -2
- package/dist/lib/stores.d.ts +4 -2
- package/dist/lib/stores.js +4 -2
- package/dist/push-app-command.d.ts +34 -34
- package/dist/push-app-command.js +391 -402
- package/dist/remote-app-command.d.ts +24 -24
- package/dist/remote-app-command.js +245 -259
- package/oclif.manifest.json +152 -119
- package/package.json +2 -1
package/dist/app-command.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare abstract class AppCommand extends SwellCommand {
|
|
|
14
14
|
static baseFlags: {
|
|
15
15
|
'app-path': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
16
|
};
|
|
17
|
-
swellConfig: any;
|
|
18
17
|
appPath: string;
|
|
18
|
+
swellConfig: any;
|
|
19
19
|
constructor(argv: string[], config: Config);
|
|
20
20
|
init(): Promise<void>;
|
|
21
21
|
protected initBaseFlags(): Promise<void>;
|
package/dist/app-command.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as path from 'node:path';
|
|
2
1
|
import { Flags } from '@oclif/core';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
3
|
import { default as swellConfig } from './lib/app-config.js';
|
|
4
4
|
import { SwellCommand } from './swell-command.js';
|
|
5
5
|
/**
|
|
@@ -20,10 +20,10 @@ export class AppCommand extends SwellCommand {
|
|
|
20
20
|
description: 'path to your app directory',
|
|
21
21
|
}),
|
|
22
22
|
};
|
|
23
|
-
// local app configuration, what developers define
|
|
24
|
-
swellConfig;
|
|
25
23
|
// the local path to the app directory
|
|
26
24
|
appPath = '';
|
|
25
|
+
// local app configuration, what developers define
|
|
26
|
+
swellConfig;
|
|
27
27
|
constructor(argv, config) {
|
|
28
28
|
super(argv, config);
|
|
29
29
|
this.swellConfig = swellConfig();
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { Config } from '@oclif/core';
|
|
2
1
|
import { PushAppCommand } from '../../push-app-command.js';
|
|
3
2
|
export default class AppDev extends PushAppCommand {
|
|
4
|
-
static
|
|
3
|
+
static delayOrientation: boolean;
|
|
5
4
|
static examples: string[];
|
|
6
5
|
static flags: {
|
|
7
6
|
'storefront-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
7
|
'storefront-select': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
|
-
port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
8
|
'no-push': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
|
+
port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
10
|
};
|
|
12
11
|
static orientation: {
|
|
13
12
|
env: string;
|
|
14
13
|
};
|
|
15
|
-
static
|
|
16
|
-
constructor(argv: string[], config: Config);
|
|
14
|
+
static summary: string;
|
|
17
15
|
run(): Promise<void>;
|
|
18
16
|
}
|
package/dist/commands/app/dev.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import { PushAppCommand } from '../../push-app-command.js';
|
|
3
3
|
import AppFrontendDev from './frontend/dev.js';
|
|
4
4
|
export default class AppDev extends PushAppCommand {
|
|
5
|
-
static
|
|
5
|
+
static delayOrientation = true;
|
|
6
6
|
static examples = [
|
|
7
7
|
'swell app dev',
|
|
8
8
|
'swell app dev --storefront-id <id>',
|
|
@@ -14,17 +14,14 @@ export default class AppDev extends PushAppCommand {
|
|
|
14
14
|
description: 'for storefront apps, identify a storefront to preview and push theme files to',
|
|
15
15
|
}),
|
|
16
16
|
'storefront-select': Flags.boolean({
|
|
17
|
-
description: 'for storefront apps, prompt to select a storefront to preview',
|
|
18
17
|
default: false,
|
|
18
|
+
description: 'for storefront apps, prompt to select a storefront to preview',
|
|
19
19
|
}),
|
|
20
20
|
};
|
|
21
21
|
static orientation = {
|
|
22
22
|
env: 'test',
|
|
23
23
|
};
|
|
24
|
-
static
|
|
25
|
-
constructor(argv, config) {
|
|
26
|
-
super(argv, config);
|
|
27
|
-
}
|
|
24
|
+
static summary = `Run an app in dev mode from your local machine.`;
|
|
28
25
|
async run() {
|
|
29
26
|
await this.config.runCommand('app:frontend:dev', this.argv);
|
|
30
27
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Config } from '@oclif/core';
|
|
2
1
|
import { PushAppCommand } from '../../../push-app-command.js';
|
|
3
2
|
export default class AppFrontendDeploy extends PushAppCommand {
|
|
4
|
-
static summary: string;
|
|
5
3
|
static description: string;
|
|
6
4
|
static examples: string[];
|
|
7
5
|
static flags: {
|
|
@@ -12,6 +10,6 @@ export default class AppFrontendDeploy extends PushAppCommand {
|
|
|
12
10
|
static orientation: {
|
|
13
11
|
env: string;
|
|
14
12
|
};
|
|
15
|
-
|
|
13
|
+
static summary: string;
|
|
16
14
|
run(): Promise<void>;
|
|
17
15
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { PushAppCommand } from '../../../push-app-command.js';
|
|
3
3
|
export default class AppFrontendDeploy extends PushAppCommand {
|
|
4
|
-
static summary = `Push frontend files to your Swell app.`;
|
|
5
4
|
static description = `Creates a new build using the relevant command depending on your frontend framework.
|
|
6
5
|
Once the build succeeds, this command will invoke Cloudflare Wrangler to upload
|
|
7
6
|
build assets using your own Cloudflare account. Once complete, Swell will update
|
|
@@ -20,16 +19,14 @@ the app's deployment URL and push the updated frontend files.`;
|
|
|
20
19
|
description: 'identify a storefront to preview deployment with',
|
|
21
20
|
}),
|
|
22
21
|
'storefront-select': Flags.boolean({
|
|
23
|
-
description: 'prompt to select a storefront to preview deployment with',
|
|
24
22
|
default: false,
|
|
23
|
+
description: 'prompt to select a storefront to preview deployment with',
|
|
25
24
|
}),
|
|
26
25
|
};
|
|
27
26
|
static orientation = {
|
|
28
27
|
env: 'test',
|
|
29
28
|
};
|
|
30
|
-
|
|
31
|
-
super(argv, config);
|
|
32
|
-
}
|
|
29
|
+
static summary = `Push frontend files to your Swell app.`;
|
|
33
30
|
async run() {
|
|
34
31
|
const { flags } = await this.parse(AppFrontendDeploy);
|
|
35
32
|
const { force } = flags;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { Config } from '@oclif/core';
|
|
2
|
-
import { PushAppCommand } from '../../../push-app-command.js';
|
|
3
1
|
import { FrontendProjectType } from '../../../lib/apps/index.js';
|
|
2
|
+
import { PushAppCommand } from '../../../push-app-command.js';
|
|
4
3
|
export default class AppFrontendDev extends PushAppCommand {
|
|
5
|
-
static summary: string;
|
|
6
4
|
static examples: string[];
|
|
7
5
|
static flags: {
|
|
8
|
-
port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
6
|
'no-push': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
|
+
port: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
8
|
'storefront-id': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
9
|
'storefront-select': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
12
10
|
};
|
|
13
11
|
static orientation: {
|
|
14
12
|
env: string;
|
|
15
13
|
};
|
|
16
|
-
|
|
14
|
+
static summary: string;
|
|
15
|
+
logAppLocalUrl(storeId: string, sessionId: string): void;
|
|
17
16
|
run(): Promise<void>;
|
|
18
17
|
startDevServer(projectType: FrontendProjectType, port?: number): Promise<void>;
|
|
19
18
|
updateLocalProxy(proxyUrl: string, spinner: any, storefrontId?: string): Promise<void>;
|
|
20
|
-
logAppLocalUrl(storeId: string, sessionId: string): void;
|
|
21
19
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import ngrok from 'ngrok';
|
|
3
2
|
import getPort, { portNumbers } from 'get-port';
|
|
3
|
+
import ngrok from 'ngrok';
|
|
4
4
|
import ora from 'ora';
|
|
5
5
|
import { default as localConfig } from '../../../lib/config.js';
|
|
6
|
-
import { PushAppCommand } from '../../../push-app-command.js';
|
|
7
6
|
import style from '../../../lib/style.js';
|
|
7
|
+
import { PushAppCommand } from '../../../push-app-command.js';
|
|
8
8
|
const FALLBACK_PORT = 3000;
|
|
9
9
|
export default class AppFrontendDev extends PushAppCommand {
|
|
10
|
-
static summary = `Run a frontend app in dev mode from your local machine.`;
|
|
11
10
|
static examples = [
|
|
12
11
|
'swell app frontend dev',
|
|
13
12
|
'swell app frontend dev --no-push',
|
|
@@ -16,26 +15,30 @@ export default class AppFrontendDev extends PushAppCommand {
|
|
|
16
15
|
'swell app frontend dev --storefront-id <id>',
|
|
17
16
|
];
|
|
18
17
|
static flags = {
|
|
18
|
+
'no-push': Flags.boolean({
|
|
19
|
+
description: 'skip pushing app files initially',
|
|
20
|
+
}),
|
|
19
21
|
port: Flags.integer({
|
|
20
22
|
char: 'p',
|
|
21
23
|
description: 'override the default port to run the app locally',
|
|
22
24
|
}),
|
|
23
|
-
'no-push': Flags.boolean({
|
|
24
|
-
description: 'skip pushing app files initially',
|
|
25
|
-
}),
|
|
26
25
|
'storefront-id': Flags.string({
|
|
27
26
|
description: 'identify a storefront to preview with and push theme files to',
|
|
28
27
|
}),
|
|
29
28
|
'storefront-select': Flags.boolean({
|
|
30
|
-
description: 'prompt to select a storefront to preview with',
|
|
31
29
|
default: false,
|
|
30
|
+
description: 'prompt to select a storefront to preview with',
|
|
32
31
|
}),
|
|
33
32
|
};
|
|
34
33
|
static orientation = {
|
|
35
34
|
env: 'test',
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
static summary = `Run a frontend app in dev mode from your local machine.`;
|
|
37
|
+
logAppLocalUrl(storeId, sessionId) {
|
|
38
|
+
const frontendAppRoute = this.app.type === 'storefront' && this.app.storefront?.external
|
|
39
|
+
? `/${this.app.private_id}`
|
|
40
|
+
: '';
|
|
41
|
+
this.log(`View it at ${style.link(`${this.localFrontendUrl(storeId, sessionId)}${frontendAppRoute}`)}\n`);
|
|
39
42
|
}
|
|
40
43
|
async run() {
|
|
41
44
|
const { flags } = await this.parse(AppFrontendDev);
|
|
@@ -102,10 +105,4 @@ export default class AppFrontendDev extends PushAppCommand {
|
|
|
102
105
|
},
|
|
103
106
|
}), () => spinner.fail('Error starting local proxy'));
|
|
104
107
|
}
|
|
105
|
-
logAppLocalUrl(storeId, sessionId) {
|
|
106
|
-
const frontendAppRoute = this.app.type === 'storefront' && this.app.storefront?.external
|
|
107
|
-
? `/${this.app.private_id}`
|
|
108
|
-
: '';
|
|
109
|
-
this.log(`View it at ${style.link(`${this.localFrontendUrl(storeId, sessionId)}${frontendAppRoute}`)}\n`);
|
|
110
|
-
}
|
|
111
108
|
}
|
|
@@ -45,9 +45,7 @@ it will output all versions of the app instead.`;
|
|
|
45
45
|
async showAppInfo() {
|
|
46
46
|
const spinner = ora();
|
|
47
47
|
spinner.start('Retrieving app info...');
|
|
48
|
-
const app = await this.getAppWithConfig().catch((
|
|
49
|
-
return null;
|
|
50
|
-
});
|
|
48
|
+
const app = await this.getAppWithConfig().catch(() => null);
|
|
51
49
|
this.app = app || this.swellConfig.store;
|
|
52
50
|
if (!this.app) {
|
|
53
51
|
spinner.fail('App not found');
|
|
@@ -24,10 +24,10 @@ export default class InitApp extends CreateApp {
|
|
|
24
24
|
const { yes: confirmYes } = flags;
|
|
25
25
|
const id = process.cwd().split(path.sep).pop() || 'Swell App';
|
|
26
26
|
await this.createSwellConfig({
|
|
27
|
+
allowOverwrite: false,
|
|
27
28
|
inputId: id,
|
|
28
|
-
inputYes: confirmYes,
|
|
29
29
|
inputType: this.appType,
|
|
30
|
-
|
|
30
|
+
inputYes: confirmYes,
|
|
31
31
|
nestedPath: false,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -124,7 +124,6 @@ Without a store specified, install the app in the Live environment of the curren
|
|
|
124
124
|
}
|
|
125
125
|
async confirmRemoveDevelopmentApp(storeToInstall) {
|
|
126
126
|
const existingSourcedApps = await this.api.get({ adminPath: `/client/apps` }, {
|
|
127
|
-
// eslint-disable-next-line camelcase
|
|
128
127
|
query: { source_id: this.app.id },
|
|
129
128
|
});
|
|
130
129
|
if (existingSourcedApps.results[0]?.id) {
|
|
@@ -4,12 +4,12 @@ export default class AppPull extends PushAppCommand {
|
|
|
4
4
|
appId: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
5
5
|
targetPath: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
6
6
|
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
7
9
|
static flags: {
|
|
8
10
|
force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
11
|
};
|
|
10
12
|
static summary: string;
|
|
11
|
-
static description: string;
|
|
12
|
-
static examples: string[];
|
|
13
|
-
run(): Promise<void>;
|
|
14
13
|
logPulledChanges(pulled: string[], removed: string[]): void;
|
|
14
|
+
run(): Promise<void>;
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as path from 'node:path';
|
|
2
1
|
import { Args, Flags } from '@oclif/core';
|
|
3
|
-
import
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { ConfigPaths } from '../../lib/apps/index.js';
|
|
4
4
|
import style from '../../lib/style.js';
|
|
5
5
|
import { PushAppCommand } from '../../push-app-command.js';
|
|
6
6
|
export default class AppPull extends PushAppCommand {
|
|
@@ -11,13 +11,6 @@ export default class AppPull extends PushAppCommand {
|
|
|
11
11
|
description: 'path to download app files into',
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
|
-
static flags = {
|
|
15
|
-
force: Flags.boolean({
|
|
16
|
-
description: 'force pull all files',
|
|
17
|
-
default: false,
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
static summary = 'Pull app files from Swell to your local machine.';
|
|
21
14
|
static description = `Pull all app files, a specific file, or a specific configuration
|
|
22
15
|
type from an app in your store's test environment to your local machine.
|
|
23
16
|
|
|
@@ -33,18 +26,25 @@ ${Object.values(ConfigPaths)
|
|
|
33
26
|
'swell app pull example_app example-folder',
|
|
34
27
|
'swell app pull --force',
|
|
35
28
|
];
|
|
29
|
+
static flags = {
|
|
30
|
+
force: Flags.boolean({
|
|
31
|
+
default: false,
|
|
32
|
+
description: 'force pull all files',
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
static summary = 'Pull app files from Swell to your local machine.';
|
|
36
|
+
logPulledChanges(pulled, removed) {
|
|
37
|
+
const typeLabel = this.appType === 'theme' ? 'theme' : 'app';
|
|
38
|
+
const changeCount = pulled.length + removed.length;
|
|
39
|
+
const pluralFiles = changeCount === 1 ? 'file' : 'files';
|
|
40
|
+
this.log(`Pulled ${changeCount} ${pluralFiles} from ${style.appConfigValue(this.app.name)} ${typeLabel} in ${style.path(path.resolve(this.appPath))}.`);
|
|
41
|
+
}
|
|
36
42
|
async run() {
|
|
37
43
|
const { args, flags } = await this.parse(AppPull);
|
|
38
44
|
const { force } = flags;
|
|
39
45
|
await this.ensureLoggedIn();
|
|
40
|
-
this.app = await this.getAppToPull(args);
|
|
46
|
+
this.app = (await this.getAppToPull(args));
|
|
41
47
|
const { pulled, removed } = await this.pullAppConfigs(force);
|
|
42
48
|
this.logPulledChanges(pulled, removed);
|
|
43
49
|
}
|
|
44
|
-
logPulledChanges(pulled, removed) {
|
|
45
|
-
const typeLabel = this.appType === 'theme' ? 'theme' : 'app';
|
|
46
|
-
const changeCount = pulled.length + removed.length;
|
|
47
|
-
const pluralFiles = changeCount !== 1 ? 'files' : 'file';
|
|
48
|
-
this.log(`Pulled ${changeCount} ${pluralFiles} from ${style.appConfigValue(this.app.name)} ${typeLabel} in ${style.path(path.resolve(this.appPath))}.`);
|
|
49
|
-
}
|
|
50
50
|
}
|
|
@@ -3,15 +3,15 @@ export default class AppPush extends PushAppCommand {
|
|
|
3
3
|
static args: {
|
|
4
4
|
file: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
|
+
static delayOrientation: boolean;
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
6
9
|
static flags: any;
|
|
7
10
|
static orientation: any;
|
|
8
11
|
static summary: string;
|
|
9
|
-
static description: string;
|
|
10
|
-
static examples: string[];
|
|
11
|
-
static delayOrientation: boolean;
|
|
12
|
-
run(): Promise<void>;
|
|
13
12
|
resolvePushPaths(file: string): {
|
|
14
13
|
filePath: string;
|
|
15
14
|
relativePath: string;
|
|
16
15
|
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import { ConfigPaths,
|
|
3
|
+
import { ConfigPaths, filePathExists, isPathDirectory, } from '../../lib/apps/index.js';
|
|
4
4
|
import style from '../../lib/style.js';
|
|
5
5
|
import { PushAppCommand } from '../../push-app-command.js';
|
|
6
6
|
export default class AppPush extends PushAppCommand {
|
|
@@ -10,19 +10,7 @@ export default class AppPush extends PushAppCommand {
|
|
|
10
10
|
description: 'relative path to a configuration file or directory to push',
|
|
11
11
|
}),
|
|
12
12
|
};
|
|
13
|
-
static
|
|
14
|
-
force: Flags.boolean({
|
|
15
|
-
description: 'force push all configurations',
|
|
16
|
-
default: false,
|
|
17
|
-
}),
|
|
18
|
-
'no-deploy': Flags.boolean({
|
|
19
|
-
description: 'skip deploying app frontend',
|
|
20
|
-
}),
|
|
21
|
-
};
|
|
22
|
-
static orientation = {
|
|
23
|
-
env: 'test',
|
|
24
|
-
};
|
|
25
|
-
static summary = 'Push local files to your Swell app.';
|
|
13
|
+
static delayOrientation = true;
|
|
26
14
|
static description = `Push all app files, a specific file, or a specific configuration
|
|
27
15
|
type to an app in your store's test environment.
|
|
28
16
|
|
|
@@ -42,7 +30,29 @@ ${Object.values(ConfigPaths)
|
|
|
42
30
|
'swell app push content',
|
|
43
31
|
'swell app push models/products.json',
|
|
44
32
|
];
|
|
45
|
-
static
|
|
33
|
+
static flags = {
|
|
34
|
+
force: Flags.boolean({
|
|
35
|
+
default: false,
|
|
36
|
+
description: 'force push all configurations',
|
|
37
|
+
}),
|
|
38
|
+
'no-deploy': Flags.boolean({
|
|
39
|
+
description: 'skip deploying app frontend',
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
static orientation = {
|
|
43
|
+
env: 'test',
|
|
44
|
+
};
|
|
45
|
+
static summary = 'Push local files to your Swell app.';
|
|
46
|
+
resolvePushPaths(file) {
|
|
47
|
+
// Join the appPath and file to get the absolute filePath
|
|
48
|
+
const filePath = path.resolve(process.cwd(), file);
|
|
49
|
+
// Check if filePath is outside of appPath
|
|
50
|
+
const relativePath = path.relative(this.appPath, filePath);
|
|
51
|
+
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
|
52
|
+
this.error(`Path ${style.path(file)} is outside of the current app directory.`);
|
|
53
|
+
}
|
|
54
|
+
return { filePath, relativePath };
|
|
55
|
+
}
|
|
46
56
|
async run() {
|
|
47
57
|
const { args, flags } = await this.parse(AppPush);
|
|
48
58
|
const { file } = args;
|
|
@@ -68,12 +78,9 @@ ${Object.values(ConfigPaths)
|
|
|
68
78
|
this.error(`Path ${style.path(file)} does not exist.`);
|
|
69
79
|
}
|
|
70
80
|
// Targeting a directory
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
else {
|
|
75
|
-
await this.pushFile(relativePath);
|
|
76
|
-
}
|
|
81
|
+
await (isPathDirectory(filePath)
|
|
82
|
+
? this.pushFilePath(relativePath, force)
|
|
83
|
+
: this.pushFile(relativePath));
|
|
77
84
|
this.log();
|
|
78
85
|
this.logDashboardUrl(flags);
|
|
79
86
|
return;
|
|
@@ -86,14 +93,4 @@ ${Object.values(ConfigPaths)
|
|
|
86
93
|
}
|
|
87
94
|
this.logDashboardUrl(flags);
|
|
88
95
|
}
|
|
89
|
-
resolvePushPaths(file) {
|
|
90
|
-
// Join the appPath and file to get the absolute filePath
|
|
91
|
-
const filePath = path.resolve(process.cwd(), file);
|
|
92
|
-
// Check if filePath is outside of appPath
|
|
93
|
-
const relativePath = path.relative(this.appPath, filePath);
|
|
94
|
-
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
|
|
95
|
-
this.error(`Path ${style.path(file)} is outside of the current app directory.`);
|
|
96
|
-
}
|
|
97
|
-
return { filePath, relativePath };
|
|
98
|
-
}
|
|
99
96
|
}
|
|
@@ -3,11 +3,11 @@ export default class AppRelease extends PushAppCommand {
|
|
|
3
3
|
static args: {
|
|
4
4
|
version: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
|
-
static flags: any;
|
|
7
|
-
static summary: string;
|
|
8
6
|
static description: string;
|
|
9
7
|
static examples: string[];
|
|
8
|
+
static flags: any;
|
|
9
|
+
static summary: string;
|
|
10
10
|
run(): Promise<void>;
|
|
11
|
-
private validateCreateVersion;
|
|
12
11
|
validateReleaseDetails(): void;
|
|
12
|
+
private validateCreateVersion;
|
|
13
13
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
1
2
|
import { Args, Flags } from '@oclif/core';
|
|
2
3
|
import { CLIError } from '@oclif/errors';
|
|
3
|
-
import { confirm } from '@inquirer/prompts';
|
|
4
|
-
import ora from 'ora';
|
|
5
4
|
import * as fs from 'node:fs';
|
|
5
|
+
import ora from 'ora';
|
|
6
6
|
import * as semver from 'semver';
|
|
7
7
|
import style from '../../lib/style.js';
|
|
8
8
|
import { PushAppCommand } from '../../push-app-command.js';
|
|
@@ -19,25 +19,6 @@ export default class AppRelease extends PushAppCommand {
|
|
|
19
19
|
},
|
|
20
20
|
}),
|
|
21
21
|
};
|
|
22
|
-
static flags = {
|
|
23
|
-
'release-notes': Flags.string({
|
|
24
|
-
description: 'relative path to a file containing release notes',
|
|
25
|
-
}),
|
|
26
|
-
message: Flags.string({
|
|
27
|
-
char: 'm',
|
|
28
|
-
description: 'description of the changes in this version for internal use',
|
|
29
|
-
}),
|
|
30
|
-
amend: Flags.boolean({
|
|
31
|
-
description: 'amend the description or release notes of an existing release',
|
|
32
|
-
}),
|
|
33
|
-
'not-supported': Flags.boolean({
|
|
34
|
-
description: 'indicates the version is not officially supported by the developer',
|
|
35
|
-
}),
|
|
36
|
-
'no-git-tag': Flags.boolean({
|
|
37
|
-
description: 'if the version is being created, do not create a git tag',
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
40
|
-
static summary = 'Release a new version of your an app for publishing to the App Store.';
|
|
41
22
|
static description = `App released are reviewed by the Swell team for quality and functionality before publishing.
|
|
42
23
|
|
|
43
24
|
If the version does not exist, you will be prompted to create it.
|
|
@@ -52,9 +33,28 @@ The app must be connected to a partner account with access to publish.`;
|
|
|
52
33
|
'swell app release 2.0.0',
|
|
53
34
|
'swell app release 2.0.0 --amend --release-notes ./releases/v2.0.0.md',
|
|
54
35
|
];
|
|
36
|
+
static flags = {
|
|
37
|
+
amend: Flags.boolean({
|
|
38
|
+
description: 'amend the description or release notes of an existing release',
|
|
39
|
+
}),
|
|
40
|
+
message: Flags.string({
|
|
41
|
+
char: 'm',
|
|
42
|
+
description: 'description of the changes in this version for internal use',
|
|
43
|
+
}),
|
|
44
|
+
'no-git-tag': Flags.boolean({
|
|
45
|
+
description: 'if the version is being created, do not create a git tag',
|
|
46
|
+
}),
|
|
47
|
+
'not-supported': Flags.boolean({
|
|
48
|
+
description: 'indicates the version is not officially supported by the developer',
|
|
49
|
+
}),
|
|
50
|
+
'release-notes': Flags.string({
|
|
51
|
+
description: 'relative path to a file containing release notes',
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
static summary = 'Release a new version of your an app for publishing to the App Store.';
|
|
55
55
|
async run() {
|
|
56
56
|
const { args, flags } = await this.parse(AppRelease);
|
|
57
|
-
const { amend, '
|
|
57
|
+
const { amend, message, 'not-supported': notSupported, 'release-notes': releaseNotesFile, } = flags;
|
|
58
58
|
if (!(await this.ensureAppExists(undefined, false))) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -75,7 +75,7 @@ The app must be connected to a partner account with access to publish.`;
|
|
|
75
75
|
throw new Error(`Version ${appVersion.version} has already been released. Use --amend to update version details.`);
|
|
76
76
|
}
|
|
77
77
|
const releaseData = {
|
|
78
|
-
description:
|
|
78
|
+
description: message || appVersion.description,
|
|
79
79
|
release_notes: releaseNotesFile ? releaseNotes : appVersion.release_notes,
|
|
80
80
|
supported: notSupported
|
|
81
81
|
? false
|
|
@@ -100,6 +100,22 @@ The app must be connected to a partner account with access to publish.`;
|
|
|
100
100
|
}, spinner);
|
|
101
101
|
spinner.succeed(`${style.appConfigValue(this.app.name)} release ${appVersion.version} ${amend ? 'updated' : 'released'}.`);
|
|
102
102
|
}
|
|
103
|
+
validateReleaseDetails() {
|
|
104
|
+
if (!this.app.description) {
|
|
105
|
+
throw new Error('App must have a description');
|
|
106
|
+
}
|
|
107
|
+
const requiresPreviewImages = this.app.type === 'storefront' &&
|
|
108
|
+
(!this.app.kind || this.app.kind === 'shop') &&
|
|
109
|
+
this.app.storefront?.theme.provider !== 'app';
|
|
110
|
+
if (requiresPreviewImages) {
|
|
111
|
+
if (!this.app.preview_image) {
|
|
112
|
+
throw new Error('Storefront app must have a preview image to release');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (this.app.type !== 'theme' && !this.app.logo_icon) {
|
|
116
|
+
throw new Error('App must have a logo icon to release');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
103
119
|
async validateCreateVersion(inputVersion, flags) {
|
|
104
120
|
let version = inputVersion;
|
|
105
121
|
if (!version) {
|
|
@@ -111,7 +127,10 @@ The app must be connected to a partner account with access to publish.`;
|
|
|
111
127
|
this.validateReleaseDetails();
|
|
112
128
|
let appVersion = await this.getVersion(version);
|
|
113
129
|
if (!appVersion) {
|
|
114
|
-
if (
|
|
130
|
+
if (flags.amend) {
|
|
131
|
+
throw new Error(`Version ${version} does not exist.`);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
115
134
|
await this.config.runCommand('app:version', [
|
|
116
135
|
version,
|
|
117
136
|
...(flags.message ? [`-m ${JSON.stringify(flags.message)}`] : []),
|
|
@@ -123,28 +142,7 @@ The app must be connected to a partner account with access to publish.`;
|
|
|
123
142
|
throw new Error(`An error occurred while creating version ${version}.`);
|
|
124
143
|
}
|
|
125
144
|
}
|
|
126
|
-
else {
|
|
127
|
-
throw new Error(`Version ${version} does not exist.`);
|
|
128
|
-
}
|
|
129
145
|
}
|
|
130
146
|
return appVersion;
|
|
131
147
|
}
|
|
132
|
-
validateReleaseDetails() {
|
|
133
|
-
if (!this.app.description) {
|
|
134
|
-
throw new Error('App must have a description');
|
|
135
|
-
}
|
|
136
|
-
const requiresPreviewImages = this.app.type === 'storefront' &&
|
|
137
|
-
(!this.app.kind || this.app.kind === 'shop') &&
|
|
138
|
-
this.app.storefront?.theme.provider !== 'app';
|
|
139
|
-
if (requiresPreviewImages) {
|
|
140
|
-
if (!this.app.preview_image) {
|
|
141
|
-
throw new Error('Storefront app must have a preview image to release');
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
if (this.app.type !== 'theme' && !this.app.logo_icon) {
|
|
146
|
-
throw new Error('App must have a logo icon to release');
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
148
|
}
|
|
@@ -3,17 +3,17 @@ export default class AppVersion extends PushAppCommand {
|
|
|
3
3
|
static args: {
|
|
4
4
|
nextVersion: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
6
8
|
static flags: {
|
|
7
|
-
message: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
9
|
amend: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
|
+
message: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
11
|
'no-git-tag': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
12
|
};
|
|
11
13
|
static summary: string;
|
|
12
|
-
static description: string;
|
|
13
|
-
static examples: string[];
|
|
14
14
|
run(): Promise<void>;
|
|
15
|
+
private createRemoteVersion;
|
|
15
16
|
private gitCommit;
|
|
16
17
|
private gitTag;
|
|
17
|
-
private createRemoteVersion;
|
|
18
18
|
private validateAndComputeVersion;
|
|
19
19
|
}
|