/
index.ts
33 lines (28 loc) · 896 Bytes
/
index.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
import {Command, Flags} from '@oclif/core'
import Site, {nameDescription} from '../../site'
export default class Deploy extends Command {
static description = 'Deploy branch to netlify staging subdomain';
static examples = ['$ netlify-git-branch deploy my-site --dir dist'];
static args = [
{name: 'name', description: nameDescription, required: true},
];
static flags = {
dir: Flags.string({
description: 'Deploy site from <dir>',
default: 'dist',
}),
assert: Flags.string({
description: 'Check deployed site using CSS <selector>',
required: false,
}),
};
async run() {
const {args, flags} = await this.parse(Deploy)
const site = new Site(args.name, this.debug)
const url = await site.deploy(flags.dir)
if (flags.assert) {
await site.checkDeploy(url, flags.assert)
}
this.debug('Deployed:', url)
}
}