-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 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
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,39 @@ | ||
import * as zCompresser from '7zip-min' | ||
import { _, packageHelper, exit, exec, getCurrentBranchName, consoleColor, cwd, io } from '../lib' | ||
|
||
/** | ||
* 忽略node_modules与.git对当前工程压缩成一个zip包放置在dist文件夹下 | ||
*/ | ||
export default { | ||
/** | ||
* 启动 | ||
*/ | ||
async start({ file }) { | ||
const filePath = `${file}`.endsWith('.7z') ? `${file}` : `${file}.7z` | ||
const newFilePath = io.pathTool.isAbsolute(filePath) ? filePath : io.pathTool.resolve(cwd, filePath) | ||
const destDir = newFilePath.replace(/\.7z$/, '') | ||
|
||
io.empty(destDir) | ||
consoleColor.yellow(`文件路径:${newFilePath}`) | ||
consoleColor.yellow(`压解到:${destDir}...`) | ||
|
||
await new Promise((resolve, reject) => { | ||
zCompresser.unpack(newFilePath, destDir, err => { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(true) | ||
} | ||
}) | ||
} | ||
) | ||
consoleColor.green(`解压完成,文件夹:${destDir}`, true) | ||
}, | ||
command: [ | ||
'<file>', | ||
'对.7z文件进行解压缩', | ||
{ | ||
|
||
} | ||
] | ||
} |
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