Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(projects): add compress script [添加压缩命令]
- Loading branch information
1 parent
61a43b8
commit be6d431
Showing
7 changed files
with
152 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ VITE_COMPRESS=N | |
|
||
# gzip | brotliCompress | deflate | deflateRaw | ||
VITE_COMPRESS_TYPE=gzip | ||
|
||
VITE_PWA=N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ node_modules | |
.DS_Store | ||
dist | ||
dist-ssr | ||
dist.zip | ||
coverage | ||
*.local | ||
stats.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createWriteStream } from 'fs'; | ||
import { zip } from 'compressing'; | ||
|
||
/** | ||
* 压缩目录或者文件 | ||
* @param paths 目录或者文件的路径 | ||
* @param destinationName 压缩产物的名称 | ||
*/ | ||
function zipDirsOrFile(paths: string[], destinationName = 'dist.zip') { | ||
const stream = new zip.Stream(); | ||
|
||
paths.forEach(path => { | ||
stream.addEntry(path); | ||
}); | ||
|
||
const destination = createWriteStream(destinationName); | ||
|
||
stream.pipe(destination); | ||
} | ||
|
||
zipDirsOrFile(['dist']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
be6d431
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
soybean-admin – ./
soybean-admin-git-main-honghuangdc.vercel.app
soybean.pro
soybean-admin.vercel.app
soybean-admin-honghuangdc.vercel.app
www.soybean.pro