Skip to content

Commit a62ff7a

Browse files
committed
Build: fix scripts for new shelljs
- Also refactored a few things to help testing mid-release
1 parent 82f3f22 commit a62ff7a

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

lib/bootstrap.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ Release.define( {
6363
} else {
6464
console.log( "This is a real release. GitHub and npm will be updated." );
6565
}
66+
67+
Release.dir = { base: process.cwd() + "/__release" };
68+
Release.dir.repo = Release.dir.base + "/repo";
6669
},
6770

6871
_parseRemote: function() {
@@ -87,10 +90,6 @@ Release.define( {
8790
},
8891

8992
_createReleaseDirectory: function() {
90-
console.log( "Determining directories..." );
91-
Release.dir = { base: process.cwd() + "/__release" };
92-
Release.dir.repo = Release.dir.base + "/repo";
93-
9493
if ( fs.existsSync( Release.dir.base ) ) {
9594
console.log( "The directory '" + Release.dir.base + "' already exists." );
9695
console.log( "Aborting." );

lib/npm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = function( Release ) {
2222
if ( result.code !== 0 ) {
2323

2424
// The npm package may not exist yet
25-
if ( result.output.split( "\n" ).some(
25+
if ( result.stdout.split( /\r?\n/ ).some(
2626
function( line ) {
2727
return ( /ERR! 404/ ).test( line );
2828
} )
@@ -33,7 +33,7 @@ module.exports = function( Release ) {
3333
Release.abort( "Error getting npm owners." );
3434
}
3535

36-
return result.output.trim().split( "\n" ).map( function( owner ) {
36+
return result.stdout.trim().split( /\r?\n/ ).map( function( owner ) {
3737
return owner.split( " " )[ 0 ];
3838
} );
3939
},

lib/repo.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ module.exports = function( Release ) {
77

88
Release.define( {
99
_jsonFiles: [ "package.json", "package-lock.json", "bower.json" ],
10+
1011
_cloneRepo: function() {
11-
var projectRelease, releaseDependencies;
12+
var releaseDependencies, projectRelease;
1213

1314
Release.chdir( Release.dir.base );
1415
console.log( "Cloning " + chalk.cyan( Release.remote ) + "..." );
@@ -25,16 +26,18 @@ Release.define( {
2526
console.log();
2627

2728
projectRelease = require( Release.dir.repo + "/build/release" );
28-
2929
if ( projectRelease.dependencies ) {
3030
console.log( "Installing release dependencies..." );
3131
releaseDependencies = projectRelease.dependencies.join( " " );
3232
Release.exec( "npm install --no-save " + releaseDependencies,
3333
"Error installing release dependencies." );
3434
console.log();
3535
}
36+
},
3637

38+
_loadReleaseScript: function() {
3739
console.log( "Loading project-specific release script..." );
40+
var projectRelease = require( Release.dir.repo + "/build/release" );
3841
projectRelease( Release );
3942
console.log();
4043
},
@@ -62,18 +65,18 @@ Release.define( {
6265

6366
_checkAuthorsTxt: function() {
6467
console.log( "Checking AUTHORS.txt..." );
68+
Release.chdir( Release.dir.repo );
6569
var result, lastActualAuthor,
6670
lastListedAuthor = fs.readFileSync( "AUTHORS.txt", "utf8" )
6771
.trim()
6872
.split( /\r?\n/ )
6973
.pop();
7074

71-
Release.chdir( Release.dir.repo );
7275
result = Release.exec( {
73-
command: "grunt authors",
76+
command: "npx grunt authors",
7477
silent: true
7578
}, "Error getting list of authors." );
76-
lastActualAuthor = result.split( /\r?\n/ ).splice( -4, 1 )[ 0 ];
79+
lastActualAuthor = result.split( /\r?\n/ ).splice( -3, 1 )[ 0 ];
7780

7881
if ( lastListedAuthor !== lastActualAuthor ) {
7982
console.log( "Last listed author is " + chalk.red( lastListedAuthor ) + "." );

lib/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Release.define( {
2626
Release.abort( errorMessage );
2727
}
2828

29-
return result.output;
29+
return result.stdout.trim();
3030
},
3131

3232
chdir: function( directory ) {

release.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ commonTasks = [
3434
Release._parseArguments,
3535
Release.confirm,
3636

37-
Release._createReleaseDirectory,
38-
3937
Release._section( "setting up repo" ),
38+
Release._createReleaseDirectory,
4039
Release._cloneRepo,
40+
Release._loadReleaseScript,
4141
Release._checkRepoState,
4242
Release._checkNpmCredentials,
4343

0 commit comments

Comments
 (0)