Skip to content

Commit

Permalink
Merge pull request #469 from nobkd/fix/create
Browse files Browse the repository at this point in the history
catch error downloading template
  • Loading branch information
tipiirai authored Jan 31, 2025
2 parents 81e5ed7 + 32db763 commit 5964c54
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/nuekit/src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export async function create({ root, name = 'simple-blog', port }) {
// download archive
console.info('Loading template...')
const archive_name = join(root, `${name}-source.tar.gz`)
const archive = await fetch(`https://${name}.nuejs.org/${debug ? 'test' : 'source'}.tar.gz`)
const archive_web = `https://${name}.nuejs.org/${debug ? 'test' : 'source'}.tar.gz`
const archive = await fetch(archive_web)

// catch download issues
if (archive.status != 200) return console.error(`Downloading template "${archive_web}" failed with "${archive.statusText}".`)
await fs.writeFile(archive_name, Buffer.from(await archive.arrayBuffer()))

// uncompress
Expand Down

0 comments on commit 5964c54

Please sign in to comment.