-
Notifications
You must be signed in to change notification settings - Fork 464
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
6 changed files
with
153 additions
and
59 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 |
---|---|---|
|
@@ -101,23 +101,30 @@ cnpm 是 npm(node 包管理工具)的中国镜像,可以提高下载依赖 | |
cnpm i -g windows-build-tools | ||
``` | ||
|
||
还需要下载make.exe,放到 `C:\windows\` 目录下 | ||
|
||
[make.exe(64位版本)](http://luogc.oss-cn-hangzhou.aliyuncs.com/oss-browser-publish/windows-tools/64/make.exe) | ||
|
||
[make.exe(32位版本)](http://luogc.oss-cn-hangzhou.aliyuncs.com/oss-browser-publish/windows-tools/32/make.exe) | ||
|
||
|
||
### (4) 下载代码 | ||
|
||
``` | ||
git clone [email protected]:aliyun/oss-browser.git | ||
``` | ||
|
||
安装依赖(请使用cnpm): | ||
安装依赖: | ||
|
||
``` | ||
cnpm i | ||
make i | ||
``` | ||
|
||
|
||
### (5) 运行 | ||
|
||
``` | ||
npm run dev # 开发模式运行, command+option+i 可用打开调试界面, win或linux按 F12. | ||
make run # 开发模式运行, command+option+i 可用打开调试界面, win或linux按 F12. | ||
``` | ||
|
||
开发模式下,会自动监听源码,如有修改,会自动build 前端代码到dist目录。 | ||
|
@@ -126,11 +133,11 @@ npm run dev # 开发模式运行, command+option+i 可用打开调试界面, wi | |
### (6) 打包 | ||
|
||
``` | ||
npm run build # build前端代码到dist目录 | ||
make build # build前端代码到dist目录 | ||
``` | ||
|
||
``` | ||
npm run win64 # 打包win64程序, 可选: mac, linux64 等 | ||
make win64 # 打包win64程序, 可选: mac, linux64,linux32,win32,win64,all. | ||
``` | ||
|
||
|
||
|
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
Binary file not shown.
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,81 @@ | ||
// require modules | ||
var fs = require('fs'); | ||
var archiver = require('archiver'); | ||
var pkg = require('./package'); | ||
var sh = require('shelljs') | ||
var app_name = process.env.name || pkg.name; | ||
var app_version = process.env.version || pkg.version; | ||
|
||
if(process.argv.length>3){ | ||
var dest = process.argv[2].trim(); | ||
var src = process.argv[3].trim(); | ||
zip(src+'**/*', dest) | ||
// var fileName=''; | ||
// sh.mkdir('-p',`releases/${app_version}`) | ||
// switch(type){ | ||
// case 'mac': fileName = `${app_name}-darwin-x64`; break; | ||
// case 'win32': fileName = `${app_name}-win32-ia32`; break; | ||
// case 'win64': fileName= `${app_name}-win32-x64`; break; | ||
// case 'linux32': fileName = `${app_name}-linux-ia32`; break; | ||
// case 'linux64': fileName= `${app_name}-linux-x64`; break; | ||
// } | ||
// sh.rm('-rf',`releases/${app_version}/${fileName}`) | ||
// zip(`./build/${fileName}/**/*`, `./releases/${app_version}/${fileName}.zip`); | ||
} | ||
|
||
|
||
|
||
/** | ||
* @param src 'subdir/*.txt' | ||
* @param dest 'a.zip' | ||
*/ | ||
function zip(src, dest){ | ||
return new Promise((a,b)=>{ | ||
// create a file to stream archive data to. | ||
var output = fs.createWriteStream(dest);//__dirname + '/example.zip' | ||
var archive = archiver('zip', { | ||
zlib: { level: 9 } // Sets the compression level. | ||
}); | ||
|
||
// listen for all archive data to be written | ||
// 'close' event is fired only when a file descriptor is involved | ||
output.on('close', function() { | ||
console.log(archive.pointer() + ' total bytes'); | ||
console.log('archiver has been finalized and the output file descriptor has closed.'); | ||
a(); | ||
}); | ||
|
||
// This event is fired when the data source is drained no matter what was the data source. | ||
// It is not part of this library but rather from the NodeJS Stream API. | ||
// @see: https://nodejs.org/api/stream.html#stream_event_end | ||
output.on('end', function() { | ||
console.log('Data has been drained'); | ||
}); | ||
|
||
// good practice to catch warnings (ie stat failures and other non-blocking errors) | ||
archive.on('warning', function(err) { | ||
if (err.code === 'ENOENT') { | ||
// log warning | ||
console.warning(err); | ||
} else { | ||
// throw error | ||
b(err) | ||
} | ||
}); | ||
|
||
// good practice to catch this error explicitly | ||
archive.on('error', function(err) { | ||
b(err); | ||
}); | ||
|
||
// pipe archive data to the file | ||
archive.pipe(output); | ||
|
||
// append files from a glob pattern | ||
archive.glob(src, false); | ||
|
||
// finalize the archive (ie we are done appending files but streams have to finish yet) | ||
// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand | ||
archive.finalize(); | ||
}); | ||
} |