assets-manager
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -197,3 +197,3 @@ 'use strict'; | ||
log: console.log, | ||
ignore: true | ||
ignoreError: true | ||
}, options); | ||
@@ -214,3 +214,3 @@ | ||
return _this6.remove(target, opts).then(log(_chalk2.default.red('Removing: ') + target)).catch(function (err) { | ||
if (options.ignore === false) { | ||
if (options.ignoreError === false) { | ||
reject('Cannot clean \'' + target + '\': ' + err.code); | ||
@@ -217,0 +217,0 @@ } |
@@ -155,7 +155,9 @@ 'use strict'; | ||
if (pkg === null) { | ||
throw new Error('Package ' + name + ' is not exists'); | ||
throw new Error('Package ' + name + ' is not exists.'); | ||
} | ||
if (!pkg.isInstalled()) { | ||
throw new Error('Package ' + name + ' is not installed'); | ||
throw new Error('Package ' + pkg.options.registry + ':' + name + ' is not installed. Please ' + pkg.getInstallCmd() + '.'); | ||
} | ||
var dests = Object.assign(this.dests, pkg.getDests()); | ||
@@ -209,2 +211,6 @@ var typedFiles = pkg.getTypedFiles(); | ||
options = Object.assign({ | ||
ignoreError: this.getConfigure('ignoreError') | ||
}, options); | ||
var promises = []; | ||
@@ -223,21 +229,30 @@ for (var pkg in this.packages) { | ||
options = Object.assign({ | ||
verbose: this.getConfigure('verbose'), | ||
override: this.getConfigure('override'), | ||
ignoreError: false, | ||
log: console.log | ||
}, options); | ||
var log = options.verbose ? options.log : function () {}; | ||
return new Promise(function (resolve, reject) { | ||
if (!_this2.hasPackage(name)) { | ||
if (options.ignoreError) { | ||
log(_chalk2.default.red('Package ' + name + ' is not exists.')); | ||
return resolve(); | ||
} | ||
return reject(new Error('Package ' + name + ' is not exists.')); | ||
} | ||
var pkg = _this2.getPackage(name); | ||
if (pkg === null) { | ||
reject(new Error('Package ' + name + ' is not exists')); | ||
} | ||
if (!pkg.isInstalled()) { | ||
reject(new Error('Package ' + name + ' is not installed')); | ||
if (options.ignoreError) { | ||
log(_chalk2.default.red('Package ' + pkg.options.registry + ':' + name + ' is not installed.') + (' Please ' + pkg.getInstallCmd() + '.')); | ||
return resolve(); | ||
} | ||
return reject(new Error('Package ' + pkg.options.registry + ':' + name + ' is not installed. Please ' + pkg.getInstallCmd() + '.')); | ||
} | ||
options = Object.assign({ | ||
verbose: _this2.getConfigure('verbose'), | ||
override: _this2.getConfigure('override'), | ||
log: console.log | ||
}, options); | ||
var log = options.verbose ? options.log : function () {}; | ||
if (options.verbose) { | ||
@@ -247,3 +262,8 @@ log(_chalk2.default.blue('Copying Package ') + name + ':'); | ||
var files = _this2.getPackageFileMapping(name); | ||
var files = void 0; | ||
try { | ||
files = _this2.getPackageFileMapping(name); | ||
} catch (error) { | ||
reject(error); | ||
} | ||
@@ -261,2 +281,6 @@ _file2.default.copyFiles(files, Object.assign({ | ||
options = Object.assign({ | ||
ignoreError: this.getConfigure('ignoreError') | ||
}, options); | ||
var promises = []; | ||
@@ -275,20 +299,29 @@ for (var pkg in this.packages) { | ||
options = Object.assign({ | ||
verbose: this.getConfigure('verbose'), | ||
log: console.log, | ||
ignoreError: false | ||
}, options); | ||
var log = options.verbose ? options.log : function () {}; | ||
return new Promise(function (resolve, reject) { | ||
if (!_this3.hasPackage(name)) { | ||
if (options.ignoreError) { | ||
log(_chalk2.default.red('Package ' + name + ' is not exists.')); | ||
return resolve(); | ||
} | ||
return reject(new Error('Package ' + name + ' is not exists.')); | ||
} | ||
var pkg = _this3.getPackage(name); | ||
if (pkg === null) { | ||
reject(new Error('Package ' + name + ' is not exists')); | ||
} | ||
if (!pkg.isInstalled()) { | ||
reject(new Error('Package ' + name + ' is not installed')); | ||
if (options.ignoreError) { | ||
log(_chalk2.default.red('Package ' + pkg.options.registry + ':' + name + ' is not installed.') + (' Please ' + pkg.getInstallCmd() + '.')); | ||
return resolve(); | ||
} | ||
return reject(new Error('Package ' + pkg.options.registry + ':' + name + ' is not installed. Please ' + pkg.getInstallCmd() + '.')); | ||
} | ||
options = Object.assign({ | ||
verbose: _this3.getConfigure('verbose'), | ||
log: console.log | ||
}, options); | ||
var log = options.verbose ? options.log : function () {}; | ||
if (options.verbose) { | ||
@@ -298,3 +331,9 @@ log(_chalk2.default.magenta('Clean Package ') + name + ":"); | ||
var files = _this3.getPackageFileMapping(name); | ||
var files = void 0; | ||
try { | ||
files = _this3.getPackageFileMapping(name); | ||
} catch (error) { | ||
reject(error); | ||
} | ||
var destFiles = []; | ||
@@ -378,2 +417,3 @@ | ||
this.setConfigure('override', this.data.override, true); | ||
this.setConfigure('ignoreError', this.data.ignoreError, true); | ||
this.setConfigure('defaultRegistry', this.data.defaultRegistry, 'npm'); | ||
@@ -451,3 +491,2 @@ this.setConfigure('flattenPackages', this.data.flattenPackages, true); | ||
/* todo */ | ||
if (Object.hasOwnProperty.call(packages, name)) { | ||
@@ -454,0 +493,0 @@ if (Array.isArray(packages[name])) { |
@@ -173,2 +173,7 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'getInstallCmd', | ||
value: function getInstallCmd() { | ||
return this.registry.getPackageInstallCmd(this.name); | ||
} | ||
}]); | ||
@@ -175,0 +180,0 @@ |
@@ -83,2 +83,7 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'getPackageInstallCmd', | ||
value: function getPackageInstallCmd(packageName) { | ||
return '\'bower install ' + packageName + ' --save\''; | ||
} | ||
}]); | ||
@@ -85,0 +90,0 @@ |
@@ -87,2 +87,8 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'getPackageInstallCmd', | ||
value: function getPackageInstallCmd(packageName) { | ||
var packagePath = this.getPackagePath(packageName); | ||
return 'check ' + packagePath + ' path'; | ||
} | ||
}]); | ||
@@ -89,0 +95,0 @@ |
@@ -76,2 +76,7 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'getPackageInstallCmd', | ||
value: function getPackageInstallCmd(packageName) { | ||
return '\'npm install ' + packageName + ' --save\''; | ||
} | ||
}]); | ||
@@ -78,0 +83,0 @@ |
{ | ||
"name": "assets-manager", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Copy packages files based on manifest file", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/amazingSurge/assets-manager", |
@@ -36,2 +36,5 @@ # assets-manager [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] | ||
// check if package defined in manifest | ||
assets.hasPackage('jquery'); | ||
// get package handler | ||
@@ -82,2 +85,3 @@ const pkg = assets.getPackage('bootstrap'); | ||
"override": true, | ||
"ignoreError": true, | ||
"flattenPackages": true, | ||
@@ -140,2 +144,6 @@ "flattenTypes": false, | ||
### ignoreError | ||
Whether to ignore errors when do copy and clean task. If set to false will break the proceeding. | ||
Defaults to true. | ||
### defaultRegistry | ||
@@ -340,3 +348,3 @@ Set default registry when package dont have a registry specify. | ||
- Hooks | ||
- Npm package versions | ||
- Package name duplicate in different registries | ||
- File collections | ||
@@ -343,0 +351,0 @@ - Dependencies |
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
69488
1503
361