mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Release: Add support for pre-releases.
This commit is contained in:
parent
7a45a47b7e
commit
1f5dd8d68e
@ -1,9 +1,13 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
/*global cat:true cd:true echo:true exec:true exit:true*/
|
/*global cat:true cd:true echo:true exec:true exit:true*/
|
||||||
|
|
||||||
|
// Usage:
|
||||||
|
// stable release: node release.js
|
||||||
|
// pre-release: node release.js --pre-release {version}
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var baseDir, repoDir, prevVersion, newVersion, nextVersion, tagTime,
|
var baseDir, repoDir, prevVersion, newVersion, nextVersion, tagTime, preRelease,
|
||||||
fs = require( "fs" ),
|
fs = require( "fs" ),
|
||||||
path = require( "path" ),
|
path = require( "path" ),
|
||||||
// support: node <0.8
|
// support: node <0.8
|
||||||
@ -67,9 +71,13 @@ function cloneRepo() {
|
|||||||
if ( exec( "npm install" ).code !== 0 ) {
|
if ( exec( "npm install" ).code !== 0 ) {
|
||||||
abort( "Error installing dependencies." );
|
abort( "Error installing dependencies." );
|
||||||
}
|
}
|
||||||
|
// We need download.jqueryui.com in order to generate themes.
|
||||||
|
// We only generate themes for stable releases.
|
||||||
|
if ( !preRelease ) {
|
||||||
if ( exec( "npm install download.jqueryui.com" ).code !== 0 ) {
|
if ( exec( "npm install download.jqueryui.com" ).code !== 0 ) {
|
||||||
abort( "Error installing dependencies." );
|
abort( "Error installing dependencies." );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo();
|
echo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,32 +112,37 @@ function getVersions() {
|
|||||||
abort( "The version must be a pre version." );
|
abort( "The version must be a pre version." );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( preRelease ) {
|
||||||
|
newVersion = preRelease;
|
||||||
|
// Note: prevVersion is not currently used for pre-releases. The TODO
|
||||||
|
// below about 1.10.0 applies here as well.
|
||||||
|
prevVersion = nextVersion = currentVersion;
|
||||||
|
} else {
|
||||||
newVersion = currentVersion.substr( 0, currentVersion.length - 3 );
|
newVersion = currentVersion.substr( 0, currentVersion.length - 3 );
|
||||||
parts = newVersion.split( "." );
|
parts = newVersion.split( "." );
|
||||||
major = parseInt( parts[ 0 ], 10 );
|
major = parseInt( parts[ 0 ], 10 );
|
||||||
minor = parseInt( parts[ 1 ], 10 );
|
minor = parseInt( parts[ 1 ], 10 );
|
||||||
patch = parseInt( parts[ 2 ], 10 );
|
patch = parseInt( parts[ 2 ], 10 );
|
||||||
|
|
||||||
// TODO: handle 2.0.0
|
// TODO: handle 1.10.0
|
||||||
|
// Also see comment above about pre-releases
|
||||||
if ( minor === 0 ) {
|
if ( minor === 0 ) {
|
||||||
abort( "This script is not smart enough to handle the 2.0.0 release." );
|
abort( "This script is not smart enough to handle the 1.10.0 release." );
|
||||||
}
|
}
|
||||||
|
|
||||||
prevVersion = patch === 0 ?
|
prevVersion = patch === 0 ?
|
||||||
[ major, minor - 1, 0 ].join( "." ) :
|
[ major, minor - 1, 0 ].join( "." ) :
|
||||||
[ major, minor, patch - 1 ].join( "." );
|
[ major, minor, patch - 1 ].join( "." );
|
||||||
// TODO: Remove version hack after 1.9.0 release
|
|
||||||
if ( prevVersion === "1.8.0" ) {
|
|
||||||
prevVersion = "1.8";
|
|
||||||
}
|
|
||||||
nextVersion = [ major, minor, patch + 1 ].join( "." ) + "pre";
|
nextVersion = [ major, minor, patch + 1 ].join( "." ) + "pre";
|
||||||
|
}
|
||||||
|
|
||||||
echo( "We are going from " + prevVersion.cyan + " to " + newVersion.cyan + "." );
|
echo( "We are going from " + prevVersion.cyan + " to " + newVersion.cyan + "." );
|
||||||
echo( "After the release, the version will be " + nextVersion.cyan + "." );
|
echo( "After the release, the version will be " + nextVersion.cyan + "." );
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildRelease() {
|
function buildRelease() {
|
||||||
var pkg;
|
var pkg,
|
||||||
|
releaseTask = preRelease ? "release" : "release_cdn";
|
||||||
|
|
||||||
echo( "Creating " + "release".cyan + " branch..." );
|
echo( "Creating " + "release".cyan + " branch..." );
|
||||||
git( "checkout -b release", "Error creating release branch." );
|
git( "checkout -b release", "Error creating release branch." );
|
||||||
@ -151,7 +164,7 @@ function buildRelease() {
|
|||||||
echo();
|
echo();
|
||||||
|
|
||||||
echo( "Building release..." );
|
echo( "Building release..." );
|
||||||
if ( exec( "grunt release_cdn" ).code !== 0 ) {
|
if ( exec( "grunt " + releaseTask ).code !== 0 ) {
|
||||||
abort( "Error building release." );
|
abort( "Error building release." );
|
||||||
}
|
}
|
||||||
echo();
|
echo();
|
||||||
@ -173,6 +186,11 @@ function pushRelease() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateBranchVersion() {
|
function updateBranchVersion() {
|
||||||
|
// Pre-releases don't change the master version
|
||||||
|
if ( preRelease ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var pkg;
|
var pkg;
|
||||||
|
|
||||||
echo( "Checking out " + branch.cyan + " branch..." );
|
echo( "Checking out " + branch.cyan + " branch..." );
|
||||||
@ -189,11 +207,20 @@ function updateBranchVersion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pushBranch() {
|
function pushBranch() {
|
||||||
|
// Pre-releases don't change the master version
|
||||||
|
if ( preRelease ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
echo( "Pushing " + branch.cyan + " to GitHub..." );
|
echo( "Pushing " + branch.cyan + " to GitHub..." );
|
||||||
git( "push", "Error pushing to GitHub." );
|
git( "push", "Error pushing to GitHub." );
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateChangelog() {
|
function generateChangelog() {
|
||||||
|
if ( preRelease ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var commits,
|
var commits,
|
||||||
changelogPath = baseDir + "/changelog",
|
changelogPath = baseDir + "/changelog",
|
||||||
changelog = cat( "build/release/changelog-shell" ) + "\n",
|
changelog = cat( "build/release/changelog-shell" ) + "\n",
|
||||||
@ -232,6 +259,10 @@ function generateChangelog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gatherContributors() {
|
function gatherContributors() {
|
||||||
|
if ( preRelease ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var contributors,
|
var contributors,
|
||||||
contributorsPath = baseDir + "/contributors";
|
contributorsPath = baseDir + "/contributors";
|
||||||
|
|
||||||
@ -262,7 +293,9 @@ function gatherContributors() {
|
|||||||
|
|
||||||
function updateTrac() {
|
function updateTrac() {
|
||||||
echo( newVersion.cyan + " was tagged at " + tagTime.cyan + "." );
|
echo( newVersion.cyan + " was tagged at " + tagTime.cyan + "." );
|
||||||
|
if ( !preRelease ) {
|
||||||
echo( "Close the " + newVersion.cyan + " Milestone." );
|
echo( "Close the " + newVersion.cyan + " Milestone." );
|
||||||
|
}
|
||||||
echo( "Create the " + newVersion.cyan + " Version." );
|
echo( "Create the " + newVersion.cyan + " Version." );
|
||||||
echo( "When Trac asks for date and time, match the above. Should only change minutes and seconds." );
|
echo( "When Trac asks for date and time, match the above. Should only change minutes and seconds." );
|
||||||
echo( "Create a Milestone for the next minor release." );
|
echo( "Create a Milestone for the next minor release." );
|
||||||
@ -329,6 +362,16 @@ function writePackage( pkg ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bootstrap( fn ) {
|
function bootstrap( fn ) {
|
||||||
|
console.log( "Determining release type..." );
|
||||||
|
preRelease = process.argv.indexOf( "--pre-release" );
|
||||||
|
if ( preRelease !== -1 ) {
|
||||||
|
preRelease = process.argv[ preRelease + 1 ];
|
||||||
|
console.log( "pre-release" );
|
||||||
|
} else {
|
||||||
|
preRelease = null;
|
||||||
|
console.log( "stable release" );
|
||||||
|
}
|
||||||
|
|
||||||
console.log( "Determining directories..." );
|
console.log( "Determining directories..." );
|
||||||
baseDir = process.cwd() + "/__release";
|
baseDir = process.cwd() + "/__release";
|
||||||
repoDir = baseDir + "/repo";
|
repoDir = baseDir + "/repo";
|
||||||
|
Loading…
Reference in New Issue
Block a user