archive-tool
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -11,2 +11,3 @@ 'use strict'; | ||
const co = require('co'); | ||
const merge = require('lodash.merge'); | ||
const formatDate = require('date-fns/format'); | ||
@@ -17,3 +18,3 @@ const install = require('nodeinstall').install; | ||
constructor(config = {}) { | ||
this.config = { | ||
this.config = merge({ | ||
cwd: process.cwd(), | ||
@@ -26,5 +27,4 @@ format: 'zip', // support zip or tar | ||
installDeps: false, | ||
archive: {}, | ||
...config | ||
}; | ||
archive: {} | ||
}, config); | ||
} | ||
@@ -57,11 +57,10 @@ | ||
const cwd = target || this.config.target; | ||
const installNode = { ...this.config.installNode, ...options }; | ||
const installNode = merge(this.config.installNode, options); | ||
return co(function *() { | ||
return yield install({ | ||
return yield install(merge({ | ||
cwd, | ||
version: '^8.10.0', | ||
cache: true, | ||
china: true, | ||
...installNode | ||
}); | ||
china: true | ||
}, installNode)); | ||
}); | ||
@@ -71,9 +70,8 @@ } | ||
installDeps(target, options) { | ||
const { cwd, mode, registry } = { | ||
const installDeps = merge(this.config.installDeps, options); | ||
const { cwd, mode, registry } = merge({ | ||
cwd: target || this.config.target, | ||
mode: 'npm', | ||
registry: 'https://registry.npm.taobao.org', | ||
...this.config.installDeps, | ||
...options | ||
}; | ||
registry: 'https://registry.npm.taobao.org' | ||
}, installDeps); | ||
console.log(chalk.green(`------ start ${mode} install --production dependencies ------ `)); | ||
@@ -98,3 +96,3 @@ const cmdArgs = [`${mode} install --production`]; | ||
console.log(chalk.green(`------ start create ${archiveFormat} file ------`)); | ||
const archive = { ...this.config.archive, ...options }; | ||
const archive = merge(this.config.archive, options); | ||
const ac = archiver(archiveFormat, archive); | ||
@@ -117,6 +115,5 @@ const output = fs.createWriteStream(target); | ||
create(options, callback) { | ||
const { cwd, filename, source, installDeps, installNode, format } = { | ||
...this.config, | ||
...options | ||
}; | ||
const _options = merge(this.config, options); | ||
const { cwd, filename, source, installDeps, installNode, format } = merge({ | ||
}, _options); | ||
const archiveDir = path.join(this.config.target, filename); | ||
@@ -123,0 +120,0 @@ const ext = EXT[format]; |
{ | ||
"name": "archive-tool", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "archive files to zip/tar", | ||
@@ -16,2 +16,3 @@ "keywords": [ | ||
"fs-extra": "^5.0.0", | ||
"lodash.merge": "^4.6.1", | ||
"nodeinstall": "^0.1.3", | ||
@@ -18,0 +19,0 @@ "shelljs": "^0.8.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13805
10
7
243
+ Addedlodash.merge@^4.6.1
+ Addedlodash.merge@4.6.2(transitive)