Skip to content

Commit 6c3219c

Browse files
committed
refactor
1 parent d839b2e commit 6c3219c

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040
"axios": "^1.6.5",
4141
"cosmiconfig": "^9.0.0",
4242
"debug": "^4.3.4",
43-
"js-yaml": "^4.1.0",
4443
"pkce-challenge": "^4.0.1",
45-
"pluralize": "^8.0.0",
4644
"underscore.string": "^3.3.6"
4745
},
4846
"devDependencies": {
@@ -52,10 +50,8 @@
5250
"@types/archiver": "^6.0.2",
5351
"@types/chai": "^4",
5452
"@types/debug": "^4.1.12",
55-
"@types/js-yaml": "^4.0.9",
5653
"@types/mocha": "^10",
5754
"@types/node": "^18",
58-
"@types/pluralize": "^0.0.33",
5955
"@types/underscore.string": "^0.0.41",
6056
"chai": "^4",
6157
"eslint": "^8",

src/commands/generate.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ For now you can open \`./${appDirRelative}\` in your favorite IDE like VS Code.
236236
description,
237237
})
238238
const { headAppDefinitionPresignedUrl, getAppDefinitionPresignedUrl } = output.data.data
239-
await sleep(20000) // It takes at least 20s to generate a definition; chill before polling
240-
await this.pollS3ObjectExistence({ headObjectPresignedUrl: headAppDefinitionPresignedUrl, timeout: 120_000 })
239+
await sleep(30_000) // It takes at least 30s to generate a definition; chill before polling
240+
await this.pollS3ObjectExistence({ headObjectPresignedUrl: headAppDefinitionPresignedUrl, interval: 3000, timeout: 120_000 })
241241
const response = await axios.get(getAppDefinitionPresignedUrl, { responseType: 'arraybuffer' })
242242
const zip = new AdmZip(response.data)
243243
const overwrite = true
@@ -317,17 +317,17 @@ For now you can open \`./${appDirRelative}\` in your favorite IDE like VS Code.
317317

318318
async pollS3ObjectExistence({
319319
headObjectPresignedUrl,
320+
interval,
320321
timeout,
321322
startTime = Date.now(),
322323
attempt = 1,
323324
}: {
324325
headObjectPresignedUrl: string
326+
interval: number
325327
timeout: number
326328
startTime?: number
327329
attempt?: number
328330
}) {
329-
const interval = 3000
330-
331331
// If timeout is reached, stop polling
332332
if (Date.now() - startTime >= timeout) {
333333
this.error('Timed out waiting for app to generate.', {
@@ -357,7 +357,7 @@ For now you can open \`./${appDirRelative}\` in your favorite IDE like VS Code.
357357
// Wait before polling again
358358
await sleep(interval)
359359

360-
await this.pollS3ObjectExistence({ headObjectPresignedUrl, startTime, attempt: attempt + 1, timeout })
360+
await this.pollS3ObjectExistence({ headObjectPresignedUrl, startTime, attempt: attempt + 1, interval, timeout })
361361
return
362362
}
363363
}
@@ -379,12 +379,12 @@ For now you can open \`./${appDirRelative}\` in your favorite IDE like VS Code.
379379
appDir: string
380380
}): Promise<undefined> {
381381
ux.action.start('🏗️ Generating project')
382-
await this.pollS3ObjectExistence({ headObjectPresignedUrl: headOutputPresignedUrl, timeout: 30_000 })
382+
await this.pollS3ObjectExistence({ headObjectPresignedUrl: headOutputPresignedUrl, interval: 1000, timeout: 30_000 })
383383
ux.action.stop('✅')
384384
ux.action.start('⬇️📦 Downloading project')
385385
const response = await axios.get(getOutputPresignedUrl, { responseType: 'arraybuffer' })
386386
const zip = new AdmZip(response.data)
387-
const overwrite = false
387+
const overwrite = true
388388
zip.extractAllTo(appDir, overwrite)
389389
ux.action.stop('✅')
390390
}

0 commit comments

Comments
 (0)