| 50 | } |
| 51 | |
| 52 | async execute() { |
| 53 | await Promise.all([ |
| 54 | this.bundler.bundle(), |
| 55 | this.site ? this.site.init() : Promise.resolve(), |
| 56 | this.kv.init() |
| 57 | ]); |
| 58 | |
| 59 | logger.progress('Getting subdomain...'); |
| 60 | const subdomain = await getWorkersDevSubdomain( |
| 61 | this.accountId, |
| 62 | this.apiKey, |
| 63 | this.accountEmail |
| 64 | ); |
| 65 | const url = `https://${this.project}.${subdomain}.workers.dev`; |
| 66 | |
| 67 | if (this.watch) { |
| 68 | const update = () => this.deploy(url); |
| 69 | this.bundler.on('bundle-end', update); |
| 70 | if (this.site) { |
| 71 | this.site.on('change', update); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | await this.deploy(url); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @param {string} url |