Skip to content

Commit

Permalink
💚 support folder compression, upgrade github action node version
Browse files Browse the repository at this point in the history
  • Loading branch information
JavanShen committed Jan 4, 2025
1 parent 3b6c55c commit 22fb34b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'
cache: 'pnpm'

- name: Cache
Expand Down
14 changes: 10 additions & 4 deletions scripts/zipDist.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import archiver from 'archiver'
import { resPath } from './utils.js'
import { createWriteStream, readdirSync, createReadStream } from 'fs'
import { createWriteStream, readdirSync, createReadStream, lstatSync } from 'fs'

const output = createWriteStream(resPath('../text-camera-extension.zip'))
const archive = archiver('zip')
Expand All @@ -10,9 +10,15 @@ archive.pipe(output)
const dirPath = resPath('../dist')
const files = readdirSync(dirPath)

for (const path of files) {
const file = createReadStream(dirPath + '/' + path)
archive.append(file, { name: path })
for (const fileName of files) {
const path = dirPath + '/' + fileName

if (lstatSync(path).isFile()) {
const file = createReadStream(path)
archive.append(file, { name: fileName })
} else {
archive.directory(path, fileName)
}
}

archive.finalize()
Binary file modified text-camera-extension.zip
Binary file not shown.

0 comments on commit 22fb34b

Please sign in to comment.