mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
chore(package): generate dist package.json from root package.json
Closes #6854
This commit is contained in:
26
gulpfile.js
26
gulpfile.js
@ -814,7 +814,6 @@ gulp.task('git-pull-latest', function() {
|
|||||||
* Copies npm package and tooling files to dist.
|
* Copies npm package and tooling files to dist.
|
||||||
*/
|
*/
|
||||||
gulp.task('package', function(done){
|
gulp.task('package', function(done){
|
||||||
var _ = require('lodash');
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var distDir = 'dist';
|
var distDir = 'dist';
|
||||||
|
|
||||||
@ -825,12 +824,24 @@ gulp.task('package', function(done){
|
|||||||
])
|
])
|
||||||
.pipe(gulp.dest(distDir));
|
.pipe(gulp.dest(distDir));
|
||||||
|
|
||||||
var templateVars = {};
|
var templatePackageJSON = require('./scripts/npm/package.json');
|
||||||
var packageJSON = require('./package.json');
|
var sourcePackageJSON = require('./package.json');
|
||||||
templateVars.ionicVersion = packageJSON.version;
|
var sourceDependencies = sourcePackageJSON.dependencies;
|
||||||
templateVars.angularVersion = packageJSON.dependencies['@angular/core'];
|
|
||||||
var packageTemplate = _.template(fs.readFileSync('scripts/npm/package.json'));
|
// copy source package.json data to template
|
||||||
fs.writeFileSync(distDir + '/package.json', packageTemplate(templateVars));
|
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();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -903,7 +914,6 @@ gulp.task('nightly', ['package'], function(done) {
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var packageJSON = require('./dist/package.json');
|
var packageJSON = require('./dist/package.json');
|
||||||
var hashLength = 8;
|
|
||||||
|
|
||||||
// Generate a unique id formatted from current timestamp
|
// Generate a unique id formatted from current timestamp
|
||||||
function createTimestamp() {
|
function createTimestamp() {
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
"private": "true",
|
"private": "true",
|
||||||
"name": "ionic2",
|
"name": "ionic2",
|
||||||
"version": "2.0.0-beta.10",
|
"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",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -16,9 +18,10 @@
|
|||||||
"@angular/common": "2.0.0-rc.3",
|
"@angular/common": "2.0.0-rc.3",
|
||||||
"@angular/compiler": "2.0.0-rc.3",
|
"@angular/compiler": "2.0.0-rc.3",
|
||||||
"@angular/core": "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": "2.0.0-rc.3",
|
||||||
"@angular/platform-browser-dynamic": "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",
|
"colors": "^1.1.2",
|
||||||
"es6-shim": "^0.35.0",
|
"es6-shim": "^0.35.0",
|
||||||
"inquirer": "0.11.0",
|
"inquirer": "0.11.0",
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "ionic-angular",
|
"name": "ionic-angular",
|
||||||
"version": "<%= ionicVersion %>",
|
"version": "`gulp package` generates dist/package.json from this template using the root ./package.json",
|
||||||
"description": "An advanced HTML5 mobile app framework built on Angular2",
|
"description": "",
|
||||||
"license": "MIT",
|
"keywords": [],
|
||||||
"keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp", "cordova"],
|
|
||||||
"main": "index.js",
|
|
||||||
"jsnext:main": "esm/index.js",
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/driftyco/ionic.git"
|
"url": "https://github.com/driftyco/ionic.git"
|
||||||
},
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"jsnext:main": "esm/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"colors": "^1.1.2",
|
"colors": "^1.1.2",
|
||||||
"inquirer": "0.11.0",
|
"inquirer": "0.11.0",
|
||||||
@ -18,11 +18,12 @@
|
|||||||
"q": "1.4.1"
|
"q": "1.4.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "^<%= angularVersion %>",
|
"@angular/common": "// versions dynamically pulled from root ./package.json",
|
||||||
"@angular/compiler": "^<%= angularVersion %>",
|
"@angular/compiler": "",
|
||||||
"@angular/core": "^<%= angularVersion %>",
|
"@angular/core": "",
|
||||||
"@angular/platform-browser": "^<%= angularVersion %>",
|
"@angular/forms": "",
|
||||||
"@angular/platform-browser-dynamic": "^<%= angularVersion %>",
|
"@angular/http": "",
|
||||||
"@angular/http": "^<%= angularVersion %>"
|
"@angular/platform-browser": "",
|
||||||
|
"@angular/platform-browser-dynamic": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user