diff --git a/gulpfile.js b/gulpfile.js index 7c0e0a6c15..855aa479b0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -814,7 +814,6 @@ gulp.task('git-pull-latest', function() { * Copies npm package and tooling files to dist. */ gulp.task('package', function(done){ - var _ = require('lodash'); var fs = require('fs'); var distDir = 'dist'; @@ -825,12 +824,24 @@ gulp.task('package', function(done){ ]) .pipe(gulp.dest(distDir)); - var templateVars = {}; - var packageJSON = require('./package.json'); - templateVars.ionicVersion = packageJSON.version; - templateVars.angularVersion = packageJSON.dependencies['@angular/core']; - var packageTemplate = _.template(fs.readFileSync('scripts/npm/package.json')); - fs.writeFileSync(distDir + '/package.json', packageTemplate(templateVars)); + var templatePackageJSON = require('./scripts/npm/package.json'); + var sourcePackageJSON = require('./package.json'); + var sourceDependencies = sourcePackageJSON.dependencies; + + // copy source package.json data to template + templatePackageJSON.version = sourcePackageJSON.version + templatePackageJSON.description = sourcePackageJSON.description + templatePackageJSON.keywords = sourcePackageJSON.keywords + + // copy source dependencies versions to the template's peerDependencies + // only copy dependencies that show up as peerDependencies in the template + for (var dependency in sourceDependencies) { + if (dependency in templatePackageJSON.peerDependencies) { + templatePackageJSON.peerDependencies[dependency] = sourceDependencies[dependency]; + } + } + + fs.writeFileSync(distDir + '/package.json', JSON.stringify(templatePackageJSON, null, 2)); done(); }); @@ -903,7 +914,6 @@ gulp.task('nightly', ['package'], function(done) { var fs = require('fs'); var spawn = require('child_process').spawn; var packageJSON = require('./dist/package.json'); - var hashLength = 8; // Generate a unique id formatted from current timestamp function createTimestamp() { diff --git a/package.json b/package.json index f33285dbf5..93c9753203 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,8 @@ "private": "true", "name": "ionic2", "version": "2.0.0-beta.10", + "description": "An advanced HTML5 mobile app framework built on Angular2", + "keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp", "cordova", "progressive web app", "pwa"], "license": "MIT", "repository": { "type": "git", @@ -16,9 +18,10 @@ "@angular/common": "2.0.0-rc.3", "@angular/compiler": "2.0.0-rc.3", "@angular/core": "2.0.0-rc.3", + "@angular/forms": "0.1.1", + "@angular/http": "2.0.0-rc.3", "@angular/platform-browser": "2.0.0-rc.3", "@angular/platform-browser-dynamic": "2.0.0-rc.3", - "@angular/http": "2.0.0-rc.3", "colors": "^1.1.2", "es6-shim": "^0.35.0", "inquirer": "0.11.0", diff --git a/scripts/npm/package.json b/scripts/npm/package.json index b1f0e7fd3a..e01d1dc114 100644 --- a/scripts/npm/package.json +++ b/scripts/npm/package.json @@ -1,15 +1,15 @@ { "name": "ionic-angular", - "version": "<%= ionicVersion %>", - "description": "An advanced HTML5 mobile app framework built on Angular2", - "license": "MIT", - "keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp", "cordova"], - "main": "index.js", - "jsnext:main": "esm/index.js", + "version": "`gulp package` generates dist/package.json from this template using the root ./package.json", + "description": "", + "keywords": [], "repository": { "type": "git", "url": "https://github.com/driftyco/ionic.git" }, + "license": "MIT", + "main": "index.js", + "jsnext:main": "esm/index.js", "dependencies": { "colors": "^1.1.2", "inquirer": "0.11.0", @@ -18,11 +18,12 @@ "q": "1.4.1" }, "peerDependencies": { - "@angular/common": "^<%= angularVersion %>", - "@angular/compiler": "^<%= angularVersion %>", - "@angular/core": "^<%= angularVersion %>", - "@angular/platform-browser": "^<%= angularVersion %>", - "@angular/platform-browser-dynamic": "^<%= angularVersion %>", - "@angular/http": "^<%= angularVersion %>" + "@angular/common": "// versions dynamically pulled from root ./package.json", + "@angular/compiler": "", + "@angular/core": "", + "@angular/forms": "", + "@angular/http": "", + "@angular/platform-browser": "", + "@angular/platform-browser-dynamic": "" } }