-
Notifications
You must be signed in to change notification settings - Fork 103
/
deploy.ts
62 lines (57 loc) · 2.03 KB
/
deploy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import {hydrogenFlags} from '../../flags.js'
import {deployToOxygen} from '../../services/deploy.js'
import {output, cli, environment, path} from '@shopify/cli-kit'
import Command from '@shopify/cli-kit/node/base-command'
import {Flags} from '@oclif/core'
export default class Deploy extends Command {
static description = 'Deploy your Hydrogen app to Oxygen hosting'
static hidden = true
static flags = {
...cli.globalFlags,
...hydrogenFlags,
deploymentToken: Flags.string({
required: true,
env: 'SHOPIFY_HYDROGEN_FLAG_DEPLOYMENT_TOKEN',
description: 'Specify your Oxygen deployment token.',
}),
commitMessage: Flags.string({
env: 'SHOPIFY_HYDROGEN_FLAG_COMMIT_MESSAGE',
description: 'Override the default Git commit message.',
}),
commitAuthor: Flags.string({
env: 'SHOPIFY_HYDROGEN_FLAG_COMMIT_AUTHOR',
description: 'Override the default Git commit author.',
}),
pathToBuild: Flags.string({
hidden: true,
env: 'SHOPIFY_HYDROGEN_FLAG_PATH_TO_BUILD',
description: 'Skip build process and use provided value as build',
}),
healthCheck: Flags.boolean({
// env: 'SHOPIFY_HYDROGEN_FLAG_HEALTH_CHECK',
default: true,
description: 'Require a health check before the deployment succeeds.',
}),
assumeYes: Flags.boolean({
char: 'y',
env: 'SHOPIFY_HYDROGEN_FLAG_ASSUME_YES',
default: false,
description: 'Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively.',
}),
oxygenAddress: Flags.string({
hidden: true,
env: 'SHOPIFY_HYDROGEN_FLAG_OXYGEN_ADDRESS',
default: 'oxygen-dms.shopifycloud.com',
}),
}
public async run(): Promise<void> {
const isShopify = await environment.local.isShopify()
if (!isShopify) {
output.warn('Command coming soon...')
return
}
const {flags} = await this.parse(Deploy)
const dir = flags.path ? path.resolve(flags.path) : process.cwd()
await deployToOxygen({...flags, path: dir})
}
}