Skip to content

Commit 1ef3335

Browse files
authored
Refactor the project
* switch from JSHint to ESLint * get rid of Grunt * update most dependencies * assume Node.js >=10, test on it instead of 0.10 Closes gh-101
1 parent a9823df commit 1ef3335

File tree

140 files changed

+6668
-4902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+6668
-4902
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__release/**

.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"root": true,
3+
4+
"extends": "jquery",
5+
6+
"parserOptions": {
7+
"ecmaVersion": 2018
8+
},
9+
10+
"env": {
11+
"es6": true,
12+
"node": true
13+
},
14+
15+
"rules": {
16+
"strict": [ "error", "global" ]
17+
}
18+
}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
node_modules/grunt
2-
node_modules/grunt-contrib-jshint
31
test-*.sh
42
package-lock.json

.jshintrc

Lines changed: 0 additions & 16 deletions
This file was deleted.

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact=true

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
language: node_js
22
node_js:
3-
- "0.10"
4-
before_script:
5-
- npm install -g grunt-cli
3+
- "10"

Gruntfile.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

lib/bootstrap.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,44 @@
1+
"use strict";
2+
13
var fs = require( "fs" ),
24
path = require( "path" ),
35
semver = require( "semver" ),
46
which = require( "which" );
57

68
module.exports = function( Release ) {
79

8-
Release.define({
10+
Release.define( {
911
isTest: true,
1012

1113
_showUsage: function() {
1214
console.log( fs.readFileSync( path.resolve( __dirname, "../docs/usage.txt" ), "utf8" ) );
1315
},
1416

1517
_checkExecutables: function() {
16-
[ "git", "npm", "grunt", "curl" ].forEach(function( command ) {
18+
[ "git", "npm", "curl" ].forEach( function( command ) {
1719
try {
1820
which.sync( command );
19-
} catch( e ) {
21+
} catch ( e ) {
2022
Release.abort( "Missing required executable: " + command );
2123
}
22-
});
24+
} );
2325
},
2426

2527
_parseArguments: function() {
2628
Release.args = {};
2729

28-
process.argv.forEach(function( arg ) {
30+
process.argv.forEach( function( arg ) {
2931
var name, value,
3032
matches = /--([^=]+)(=(.+))?/.exec( arg );
3133

3234
if ( matches ) {
33-
name = matches[ 1 ].replace( /-([a-z])/gi, function( all, letter ) {
35+
name = matches[ 1 ].replace( /-([a-z])/gi, function( _all, letter ) {
3436
return letter.toUpperCase();
35-
});
37+
} );
3638
value = matches[ 3 ] || true;
3739
Release.args[ name ] = value;
3840
}
39-
});
41+
} );
4042

4143
Release._parseRemote();
4244
Release.branch = Release.args.branch || "master";
@@ -45,13 +47,13 @@ Release.define({
4547
Release.isTest = true;
4648
}
4749

48-
if ( Release.preRelease && !semver.valid( Release.preRelease) ) {
50+
if ( Release.preRelease && !semver.valid( Release.preRelease ) ) {
4951
Release.abort( "Invalid --pre-release argument, not valid semver: " +
5052
Release.preRelease );
5153
}
5254

5355
console.log();
54-
console.log( "\tRelease type: " + (Release.preRelease ? "pre-release" : "stable") );
56+
console.log( "\tRelease type: " + ( Release.preRelease ? "pre-release" : "stable" ) );
5557
console.log( "\tRemote: " + Release.remote );
5658
console.log( "\tBranch: " + Release.branch );
5759
console.log();
@@ -98,6 +100,6 @@ Release.define({
98100
console.log( "Creating directory..." );
99101
fs.mkdirSync( Release.dir.base );
100102
}
101-
});
103+
} );
102104

103105
};

lib/cdn.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
var shell = require( "shelljs" ),
24
fs = require( "fs" ),
35
chalk = require( "chalk" );
@@ -29,7 +31,7 @@ module.exports = function( Release ) {
2931
return jqueryCdn + "/" + project + "/" + Release.newVersion;
3032
}
3133

32-
Release.define({
34+
Release.define( {
3335
cdnPublish: "dist/cdn",
3436
_cloneCdnRepo: function() {
3537
var local = Release.dir.base + "/codeorigin.jquery.com",
@@ -54,21 +56,22 @@ module.exports = function( Release ) {
5456
commitMessage = npmPackage + ": Added version " + Release.newVersion;
5557

5658
Release.chdir( Release.dir.base );
57-
console.log( "Copying files from " + chalk.cyan( releaseCdn ) + " to " + chalk.cyan( targetCdn ) + "." );
59+
console.log( "Copying files from " + chalk.cyan( releaseCdn ) +
60+
" to " + chalk.cyan( targetCdn ) + "." );
5861
shell.mkdir( "-p", targetCdn );
5962
shell.cp( "-r", releaseCdn + "/*", targetCdn );
6063

6164
console.log( "Adding files..." );
6265
Release.chdir( targetCdn );
63-
Release.exec( "git add ." , "Error adding files." );
64-
Release.exec( "git commit -m \"" + commitMessage + "\"" , "Error commiting files." );
66+
Release.exec( "git add .", "Error adding files." );
67+
Release.exec( "git commit -m \"" + commitMessage + "\"", "Error commiting files." );
6568
},
6669

6770
_pushToCdn: function() {
6871
Release.chdir( projectCdn() );
69-
Release.exec( "git push" + (Release.isTest ? " --dry-run" : ""),
72+
Release.exec( "git push" + ( Release.isTest ? " --dry-run" : "" ),
7073
"Error pushing to CDN." );
7174
console.log();
7275
}
73-
});
76+
} );
7477
};

lib/changelog.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
"use strict";
2+
13
var fs = require( "fs" ),
24
changelogplease = require( "changelogplease" ),
35
chalk = require( "chalk" );
46

57
module.exports = function( Release ) {
68

7-
Release.define({
9+
Release.define( {
810
_generateChangelog: function( callback ) {
9-
Release._generateCommitChangelog(function( commitChangelog ) {
10-
Release._generateIssueChangelog(function( issueChangelog ) {
11+
Release._generateCommitChangelog( function( commitChangelog ) {
12+
Release._generateIssueChangelog( function( issueChangelog ) {
1113
var changelogPath = Release.dir.base + "/changelog",
1214
changelog = Release.changelogShell() +
1315
commitChangelog +
@@ -19,8 +21,8 @@ Release.define({
1921
console.log( "Stored changelog in " + chalk.cyan( changelogPath ) + "." );
2022

2123
callback();
22-
});
23-
});
24+
} );
25+
} );
2426
},
2527

2628
changelogShell: function() {
@@ -34,7 +36,7 @@ Release.define({
3436
_generateCommitChangelog: function( callback ) {
3537
console.log( "Adding commits..." );
3638

37-
changelogplease({
39+
changelogplease( {
3840
ticketUrl: Release._ticketUrl() + "{id}",
3941
commitUrl: Release._repositoryUrl() + "/commit/{id}",
4042
repo: Release.dir.repo,
@@ -45,14 +47,14 @@ Release.define({
4547
}
4648

4749
callback( log );
48-
});
50+
} );
4951
},
5052

5153
_generateIssueChangelog: function( callback ) {
5254
return Release.issueTracker === "trac" ?
5355
Release._generateTracChangelog( callback ) :
5456
Release._generateGithubChangelog( callback );
5557
}
56-
});
58+
} );
5759

5860
};

0 commit comments

Comments
 (0)