@swell/cli
Version:
Swell's command line interface/utility
42 lines (41 loc) • 1.64 kB
JavaScript
import { Flags } from '@oclif/core';
import { PushAppCommand } from '../../../push-app-command.js';
export default class AppFrontendDeploy extends PushAppCommand {
static description = `Creates a new build using the relevant command depending on your frontend framework.
Once the build succeeds, this command will invoke Cloudflare Wrangler to upload
build assets using your own Cloudflare account. Once complete, Swell will update
the app's deployment URL and push the updated frontend files.`;
static examples = [
'swell app frontend deploy',
'swell app frontend deploy --force',
'swell app frontend deploy --storefront-select',
'swell app frontend deploy --storefront-id <id>',
];
static flags = {
force: Flags.boolean({
description: 'force push and build all frontend files',
}),
'storefront-id': Flags.string({
description: 'identify a storefront to preview deployment with',
}),
'storefront-select': Flags.boolean({
default: false,
description: 'prompt to select a storefront to preview deployment with',
}),
};
static orientation = {
env: 'test',
};
static summary = `Push frontend files to your Swell app.`;
async run() {
const { flags } = await this.parse(AppFrontendDeploy);
const { force } = flags;
if (!(await this.ensureAppExists())) {
return;
}
if (this.app.type === 'storefront') {
await this.getStorefrontToPush(flags);
}
await this.deployAppFrontend(force);
}
}