Comparing version 1.5.1 to 1.6.0
13
index.js
@@ -130,2 +130,15 @@ var path = require('path'); | ||
// overwrite tiapp | ||
if (newPkg['appc-npm'].tiapp) { | ||
pkg['appc-npm'].tiapp = newPkg['appc-npm'].tiapp; | ||
// sort for testing | ||
pkg['appc-npm'].tiapp.sort(); | ||
} | ||
// overwrite config | ||
if (newPkg['appc-npm'].config) { | ||
pkg['appc-npm'].config = newPkg['appc-npm'].config; | ||
} | ||
// overwrite target | ||
@@ -132,0 +145,0 @@ if (newPkg['appc-npm'].target) { |
var path = require('path'); | ||
var fs = require('fs'); | ||
var registry = require('npm-stats')(); | ||
var _ = require('underscore'); | ||
@@ -62,5 +63,6 @@ var semver = require('semver'); | ||
// append files | ||
pkg['appc-npm'].unzip.push(platformPkg['appc-npm'].unzip[0]); | ||
pkg.files.push(platformPkg.files[1]); | ||
// append | ||
pkg['appc-npm'].unzip = pkg['appc-npm'].unzip.concat(platformPkg['appc-npm'].unzip); | ||
pkg['appc-npm'].tiapp = pkg['appc-npm'].tiapp.concat(platformPkg['appc-npm'].tiapp); | ||
pkg.files = pkg.files.concat(platformPkg.files); | ||
} | ||
@@ -72,7 +74,3 @@ | ||
// sort for testing | ||
pkg['appc-npm'].unzip.sort(); | ||
pkg.files.sort(); | ||
return callback(null, pkg); | ||
return finalize(pkg, callback); | ||
}); | ||
@@ -82,8 +80,26 @@ | ||
// sort for testing | ||
pkg.files.sort(); | ||
return finalize(pkg, callback); | ||
}); | ||
}; | ||
function finalize(pkg, callback) { | ||
// whitelist installer | ||
pkg.files.push('appc-npm'); | ||
// sort for testing | ||
pkg['appc-npm'].unzip.sort(); | ||
pkg.files.sort(); | ||
// check availability | ||
return registry.module(pkg.name).info(function (err, data) { | ||
// already exists | ||
if (!err || err.message !== 'missing') { | ||
pkg.name = exports.prefix + '-' + pkg.name; | ||
} | ||
return callback(null, pkg); | ||
}); | ||
}; | ||
} | ||
@@ -141,3 +157,3 @@ function analyzePlatform(basePath, platformDir, callback) { | ||
var pkg = _.extend(_.pick(manifest, 'version', 'description', 'author', 'license'), { | ||
name: exports.prefix + '-' + manifest.moduleid, | ||
name: manifest.moduleid.toLowerCase(), | ||
'appc-npm': { | ||
@@ -148,7 +164,12 @@ target: { | ||
}, | ||
unzip: [distPath] | ||
unzip: [distPath], | ||
tiapp: [{ | ||
name: manifest.moduleid, | ||
version: manifest.version, | ||
platform: manifest.platform | ||
}] | ||
}, | ||
// opposite of .npmignore | ||
files: ['appc-npm', distPath] | ||
files: [distPath] | ||
}); | ||
@@ -155,0 +176,0 @@ |
@@ -9,3 +9,3 @@ var path = require('path'); | ||
var pkg = { | ||
name: exports.prefix + '-' + parentDir, | ||
name: 'alloy-theme-' + parentDir, | ||
'appc-npm': { | ||
@@ -12,0 +12,0 @@ target: { |
var path = require('path'); | ||
var registry = require('npm-stats')(); | ||
var _ = require('underscore'); | ||
@@ -20,17 +21,35 @@ | ||
if (!widgetJson.version) { | ||
return callback(new Error('Could not find version in widget.json')); | ||
} | ||
var pkg = _.extend(_.pick(widgetJson, 'version', 'description', 'author', 'license'), { | ||
name: exports.prefix + '-' + widgetJson.id, | ||
name: widgetJson.id, | ||
'appc-npm': { | ||
target: { | ||
alloy: 'app/widgets/' + widgetJson.id | ||
alloy: 'app/widgets/' + widgetJson.id.toLowerCase() | ||
}, | ||
ignore: ['package.json'] | ||
ignore: ['package.json'], | ||
config: {} | ||
} | ||
}); | ||
pkg['appc-npm'].config[widgetJson.id] = widgetJson.version; | ||
if (widgetJson.tags) { | ||
pkg.keywords = widgetJson.tags.split(/\s*,\s*/); | ||
// sort for testing | ||
pkg.keywords = widgetJson.tags.split(/\s*,\s*/).sort(); | ||
} | ||
return callback(null, pkg); | ||
// check availability | ||
return registry.module(pkg.name).info(function (err, data) { | ||
// already exists | ||
if (!err || err.message !== 'missing') { | ||
pkg.name = exports.prefix + '-' + pkg.name; | ||
} | ||
return callback(null, pkg); | ||
}); | ||
}; |
{ | ||
"name": "appc-npm", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "Package components for Appcelerator Titanium, Alloy and Arrow projects for distribution via NPM.", | ||
@@ -55,5 +55,7 @@ "main": "index.js", | ||
"glob": "^5.0.10", | ||
"npm-stats": "^1.1.0", | ||
"semver": "^4.3.6", | ||
"underscore": "^1.8.3" | ||
"underscore": "^1.8.3", | ||
"update-notifier": "^0.5.0" | ||
} | ||
} |
@@ -1,9 +0,9 @@ | ||
# Appcelerator NPM Distribution ![EXPERIMENTAL](https://img.shields.io/badge/status-experimental-green.svg?style=flat-square) | ||
Package components for Appcelerator Titanium, Alloy and Arrow projects for distribution via NPM. | ||
# Appcelerator Packager for NPM | ||
Package [many types of components](#commands--types) for Appcelerator Titanium, Alloy and Arrow projects for distribution via NPM, including [modules](#module) and [support for nested dependencies](#support-for-nested-dependencies). | ||
* [Browse Appcelerator Components on NPM](https://www.npmjs.com/browse/keyword/appc-npm) | ||
> **NOTE:** Running `appc-npm <type>` for your component only updates/adds a `package.json` and `appc-npm` postinstall executable. It adds **no dependencies** and does not change your code. | ||
> **NOTE:** The packager only updates/adds a `package.json` and `appc-npm` postinstall executable. It adds **no dependencies** and does not change your code. | ||
## Install ![NPM](https://img.shields.io/npm/v/appc-npm.svg?style=flat-square) | ||
## Install the packager ![NPM](https://img.shields.io/npm/v/appc-npm.svg?style=flat-square) | ||
@@ -14,3 +14,3 @@ ``` | ||
## Package & Publish | ||
## Package & Publish to NPM | ||
Simply navigate to your Titanium module or library, Alloy widget, sync adapter, Arrow connector or other component and run the CLI with the command for that component and optional path (defaulting to CWD). | ||
@@ -28,5 +28,5 @@ | ||
> **NOTE:** You probably want to check `package.json` before you publish and set or update [fields](https://docs.npmjs.com/files/package.json) like `description`, `homepage`, `bugs`, `license`, `repository`. | ||
You probably want to check `package.json` before you publish and set [fields](https://docs.npmjs.com/files/package.json) like `description`, `homepage`, `bugs`, `license` and `repository`. | ||
## Use | ||
## Install a package from NPM | ||
@@ -48,3 +48,5 @@ ``` | ||
## Nested dependencies | ||
For modules and widgets the bundled installer will also update the `tiapp.xml` and `app/config.json` to add the dependency. | ||
## Support for nested dependencies | ||
You can add dependencies to other Appcelerator dependencies on NPM to the `package.json` of your packaged component. So if your Alloy widget depends on a library, module or other widget then you can install them all in one go. | ||
@@ -72,4 +74,4 @@ | ||
## Update | ||
Run the command again to update the packaged installer, update the version (for components like Alloy widgets) and add missing files to copy. | ||
## Update a package | ||
Run the command again to update the packaged installer and update the `package.json`'s version (for modules and widgets) and list of files to ignore or unzip by the installer. It will not overwrite any other changes you made to the `package.json`. | ||
@@ -81,3 +83,3 @@ ``` | ||
## Commands/Types | ||
## Commands / Types | ||
You can use the following commands or types of components: | ||
@@ -88,5 +90,5 @@ | ||
Reads the `manifest` to populate the `package.json`, using `ti-module-<moduleid>` as name. It wil sum the versions of all platforms to be the package version. | ||
Reads the `manifest` to populate the `package.json`. It will check if the `moduleid` is available on NPM and fall back to `ti-module-<moduleid>` as name. It wil sum the versions of all platforms to be the package version. | ||
> **NOTE:** Only the most recent ZIP file of each platform and the `appc-npm` installer are added to the `package.json`'s `files` property so that only these will be packaged and published to NPM and not the full module source. | ||
Only the most recent ZIP file of each platform and the `appc-npm` installer are added to the `package.json`'s `files` property so that only these will be packaged and published to NPM and not the full module source. | ||
@@ -101,3 +103,3 @@ * [Browse Titanium modules on NPM](https://www.npmjs.com/browse/keyword/ti-module) | ||
### `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. | ||
Alloy Widgets. Uses `widget.json` to populate the `package.json` and ignores that same file for the installer. It will check if the widget `id` is available on NPM and fall back to `alloy-widget-<id>` as the package name. | ||
@@ -130,7 +132,8 @@ * [Browse Alloy widgets on NPM](https://www.npmjs.com/browse/keyword/alloy-widget) | ||
## Test | ||
To lint and run all tests: | ||
## Test [![TRAVIS](https://img.shields.io/travis/FokkeZB/appc-npm.svg?style=flat-square)](https://travis-ci.org/FokkeZB/appc-npm) | ||
To lint and run all tests you need Grunt and a recent version of NPM: | ||
``` | ||
$ [sudo] npm install -g grunt | ||
$ [sudo] npm install -g npm | ||
$ npm install | ||
@@ -137,0 +140,0 @@ $ npm test |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
33297
16
521
151
7
+ Addednpm-stats@^1.1.0
+ Addedupdate-notifier@^0.5.0
+ AddedJSONStream@0.6.4(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedasn1@0.1.110.2.6(transitive)
+ Addedassert-plus@0.1.51.0.0(transitive)
+ Addedasync@0.9.2(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.5.00.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbl@0.9.5(transitive)
+ Addedboom@0.4.2(transitive)
+ Addedbrowser-request@0.3.3(transitive)
+ Addedcaseless@0.12.00.6.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcloudant-follow@0.17.0(transitive)
+ Addedcombined-stream@0.0.71.0.8(transitive)
+ Addedconfigstore@1.4.0(transitive)
+ Addedcore-util-is@1.0.21.0.3(transitive)
+ Addedcryptiles@0.2.2(transitive)
+ Addedctype@0.5.3(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddebug@2.6.93.2.7(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddelayed-stream@0.0.51.0.0(transitive)
+ Addedduplexer@0.1.2(transitive)
+ Addedduplexify@3.7.1(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addederrs@0.3.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedevent-stream@3.0.20(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.5.20.6.1(transitive)
+ Addedform-data@0.1.42.3.3(transitive)
+ Addedfrom@0.1.7(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedgot@3.3.1(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@1.1.1(transitive)
+ Addedhoek@0.9.1(transitive)
+ Addedhttp-signature@0.10.11.2.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinfinity-agent@2.0.3(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedis-npm@1.0.0(transitive)
+ Addedis-redirect@1.0.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@0.0.11.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsonparse@0.0.5(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlatest-version@1.0.1(transitive)
+ Addedlodash._arraycopy@3.0.0(transitive)
+ Addedlodash._arrayeach@3.0.0(transitive)
+ Addedlodash._basecopy@3.0.1(transitive)
+ Addedlodash._basefor@3.0.3(transitive)
+ Addedlodash._bindcallback@3.0.1(transitive)
+ Addedlodash._createassigner@3.1.1(transitive)
+ Addedlodash._getnative@3.9.1(transitive)
+ Addedlodash._isiterateecall@3.0.9(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.isempty@4.4.0(transitive)
+ Addedlodash.isplainobject@3.2.0(transitive)
+ Addedlodash.istypedarray@3.0.6(transitive)
+ Addedlodash.keys@3.1.2(transitive)
+ Addedlodash.keysin@3.0.8(transitive)
+ Addedlodash.merge@3.3.2(transitive)
+ Addedlodash.restparam@3.6.1(transitive)
+ Addedlodash.toplainobject@3.0.0(transitive)
+ Addedlowercase-keys@1.0.1(transitive)
+ Addedmap-stream@0.0.7(transitive)
+ Addedmime@1.2.11(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@1.0.22.1.35(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.0.02.1.3(transitive)
+ Addednano@6.4.4(transitive)
+ Addednested-error-stacks@1.0.2(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addednpm-stats@1.2.0(transitive)
+ Addedoauth-sign@0.4.00.9.0(transitive)
+ Addedobject-assign@3.0.04.1.1(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedosenv@0.1.5(transitive)
+ Addedpackage-json@1.2.0(transitive)
+ Addedpause-stream@0.0.11(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprepend-http@1.0.4(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedpsl@1.13.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@1.2.26.5.3(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedread-all-stream@3.1.0(transitive)
+ Addedreadable-stream@1.0.342.3.8(transitive)
+ Addedregistry-url@3.1.0(transitive)
+ Addedrepeating@1.1.3(transitive)
+ Addedrequest@2.45.02.88.2(transitive)
+ Addedsafe-buffer@5.1.25.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsemver-diff@2.1.0(transitive)
+ Addedslide@1.1.6(transitive)
+ Addedsntp@0.2.4(transitive)
+ Addedsplit@0.2.10(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstream-combiner@0.0.4(transitive)
+ Addedstream-reduce@1.0.3(transitive)
+ Addedstream-shift@1.0.3(transitive)
+ Addedstring-length@1.0.1(transitive)
+ Addedstring_decoder@0.10.311.1.1(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedthrough@2.2.72.3.8(transitive)
+ Addedtimed-out@2.0.0(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.4.30.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedupdate-notifier@0.5.0(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addeduuid@2.0.33.4.0(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedwrite-file-atomic@1.3.4(transitive)
+ Addedxdg-basedir@2.0.0(transitive)