Skip to content

Commit

Permalink
Fix creating zip on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Jan 6, 2025
1 parent 68c81d9 commit 178857b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 49 deletions.
15 changes: 7 additions & 8 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for (const arg of argv._) {
}

// Current version.
const version = await $`git describe --always --tags`
const version = (await $`git describe --always --tags`).valueOf()

// Sync submodule.
await $`git submodule sync --recursive`
Expand Down Expand Up @@ -122,11 +122,10 @@ for (let f of files) {
}

// Create zip.
const yazl = require('./deps/yazl')
const zip = new yazl.ZipFile()
const distname = `yode-${version}-${process.platform}-${targetArch}.zip`
const distname = `out/${buildType}/yode-${version}-${process.platform}-${targetArch}.zip`
const filename = process.platform == 'win32' ? 'yode.exe' : 'yode'
zip.addFile('node/LICENSE', 'LICENSE')
zip.addFile(`out/${buildType}/${filename}`, filename)
zip.outputStream.pipe(fs.createWriteStream(`out/${buildType}/${distname}`))
zip.end()
await fs.emptyDir('dist')
await fs.copy('node/LICENSE', 'dist/LICENSE')
await fs.copy(`out/${buildType}/${filename}`, `dist/${filename}`)
await $`${python} -c "import shutil; shutil.make_archive('${distname}', 'zip', 'dist')"`
await fs.remove('dist')
Loading

0 comments on commit 178857b

Please sign in to comment.