Comparing version 1.0.1 to 1.1.0
67
index.js
@@ -20,2 +20,3 @@ var path = require('path'); | ||
var info; | ||
var pkg = {}; | ||
@@ -60,13 +61,14 @@ | ||
copyInstaller: function (next) { | ||
analyze: function (next) { | ||
return fs.copy(path.join(__dirname, 'assets', 'appc-npm'), path.join(src, 'appc-npm'), function (err) { | ||
return type.analyze(src, function (err, res) { | ||
if (err) { | ||
return next(new Error('Failed to copy the installer')); | ||
return next(err); | ||
} | ||
info = res; | ||
return next(); | ||
}); | ||
}, | ||
@@ -98,31 +100,37 @@ | ||
updatePackage: function (next) { | ||
var mod; | ||
return type.analyze(src, function (err, info) { | ||
// don't overwrite... | ||
_.defaults(pkg, info); | ||
if (err) { | ||
return next(err); | ||
} | ||
// only version, falling back to 1.0.0 | ||
pkg.version = info.version || pkg.version || '1.0.0'; | ||
// don't overwrite... | ||
_.defaults(pkg, info); | ||
// fallback for name | ||
pkg.name = pkg.name || type.prefix + '-' + path.dirname(src); | ||
// only version, falling back to 1.0.0 | ||
pkg.version = info.version || pkg.version || '1.0.0'; | ||
if (typeof pkg.scripts !== 'object') { | ||
pkg.scripts = {}; | ||
} | ||
// fallback for name | ||
pkg.name = pkg.name || type.prefix + path.dirname(src); | ||
// don't overwrite postinstall | ||
if (!pkg.scripts.postinstall) { | ||
pkg.scripts.postinstall = 'node ./appc-npm'; | ||
} | ||
if (typeof pkg.scripts !== 'object') { | ||
pkg.scripts = {}; | ||
// ensure keywords | ||
if (!_.isArray(pkg.keywords)) { | ||
pkg.keywords = ['appc-npm', type.prefix]; | ||
} else { | ||
if (pkg.keywords.indexOf('appc-npm') === -1) { | ||
pkg.keywords.push('appc-npm'); | ||
} | ||
// don't overwrite postinstall | ||
if (!pkg.scripts.postinstall) { | ||
pkg.scripts.postinstall = 'node ./appc-npm'; | ||
if (pkg.keywords.indexOf(type.prefix) === -1) { | ||
pkg.keywords.push(type.prefix); | ||
} | ||
} | ||
return next(); | ||
}); | ||
return next(); | ||
}, | ||
@@ -141,2 +149,15 @@ | ||
}, | ||
copyInstaller: function (next) { | ||
return fs.copy(path.join(__dirname, 'assets', 'appc-npm'), path.join(src, 'appc-npm'), function (err) { | ||
if (err) { | ||
return next(new Error('Failed to copy the installer')); | ||
} | ||
return next(); | ||
}); | ||
} | ||
@@ -143,0 +164,0 @@ |
@@ -6,3 +6,3 @@ var path = require('path'); | ||
exports.prefix = 'alloy-widget-'; | ||
exports.prefix = 'alloy-widget'; | ||
@@ -27,3 +27,3 @@ exports.analyze = function analyze(src, callback) { | ||
var pkg = _.extend(_.pick(widgetJson, 'version', 'description', 'author', 'license'), { | ||
name: exports.prefix + widgetJson.id, | ||
name: exports.prefix + '-' + widgetJson.id, | ||
'appc-npm': { | ||
@@ -30,0 +30,0 @@ target: { |
{ | ||
"name": "appc-npm", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Use NPM to distrbute Appcelerator Titanium, Alloy and Arrow components", | ||
"main": "index.js", | ||
"bin": { | ||
"appc-npm": "./bin/appc-bin" | ||
"appc-npm": "./bin/appc-npm" | ||
}, | ||
@@ -9,0 +9,0 @@ "directories": { |
# Appcelerator NPM Distribution | ||
Package components for Appcelerator Titanium, Alloy and Arrow projects for distribution and dependencies via NPM. | ||
Package components for Appcelerator Titanium, Alloy and Arrow projects for distribution and dependency via NPM. | ||
* [Browse Appcelerator Components on NPM](https://www.npmjs.com/browse/keyword/appc-npm) | ||
## Install | ||
@@ -87,10 +89,10 @@ | ||
### DONE: `widget` | ||
Alloy Widgets. Searches for `widget.json` to determine the base path and adds `controllers`, `views`, `styles`, `lib`, `assets` and `i18n` directories to the list of paths to copy to the project. The default package name is `alloy-widget-<id>` and the version is read from `widget.json` as well. | ||
### `widget` | ||
Alloy Widgets. Uses `widget.json` to populate the `package.json`, ignores that same file for the installer and uses `alloy-widget-<id>` as the package name. | ||
### TODO: `sync` | ||
Alloy sync adapters. Searches for the first `.js` to determine the base path and adds that file to the list of paths to copy to the project. The default package name is `alloy-sync-<filename>` and version is `1.0.0`. | ||
### `sync` | ||
Alloy sync adapters. Searches for the first `.js` and uses `alloy-sync-<filename>` as the package name and `1.0.0` for the version. All other files are ignored for the installer. | ||
### TODO `lib` | ||
Titanium, Alloy or Arrow CommonJS libraries. Searches for the first `.js` to determine the base path and adds that file to the list of paths to copy to the project. The default package name is `appc-lib-<filename>` and version is `1.0.0`. | ||
### `lib` | ||
Titanium, Alloy or Arrow CommonJS libraries. Searches for the first `.js` and uses `alloy-sync-<filename>` as the package name and `1.0.0` for the version. All other files are ignored for the installer. | ||
@@ -97,0 +99,0 @@ ### TODO: `module` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15785
10
236
105
0
6