Release: Make Sizzle work with jquery-release, remove generated files

Running `grunt` will now just build Sizzle, do a size comparison & run ESLint,
similarly to what we do in jQuery. `grunt test` is used to run unit tests and
it requires running `grunt` or `grunt build` before to generate the built
Sizzle version.

Fixes gh-239
Closes gh-467
This commit is contained in:
Michał Gołębiowski-Owczarek 2020-03-02 20:29:32 +01:00 committed by GitHub
parent 6812dd07a7
commit 096f6836d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 6 additions and 2590 deletions

4
.gitignore vendored
View File

@ -8,3 +8,7 @@
node_modules
bower_components
.idea/
# Ignore everything in dist folder except for eslint config
/dist/*
!/dist/.eslintrc.json

View File

@ -277,7 +277,6 @@ module.exports = function( grunt ) {
] );
grunt.registerTask( "default", [
"build",
"tests",
"compare_size",
"eslint:dist"
] );

View File

@ -8,20 +8,13 @@ module.exports = function( Release ) {
];
Release.define( {
cdnPublish: false,
npmPublish: true,
issueTracker: "github",
generateArtifacts: function( done ) {
Release.exec( "grunt", "Grunt command failed" );
done( files );
},
// TODO Add Sizzle to the CDN, or add public opt-out interfaces to jquery-release
_copyCdnArtifacts: function() {
console.warn( "Skipping CDN artifact copy." );
},
_pushToCdn: function() {
console.warn( "Skipping CDN push." );
}
} );

2478
dist/sizzle.js vendored

File diff suppressed because it is too large Load Diff

3
dist/sizzle.min.js vendored

File diff suppressed because one or more lines are too long

1
dist/sizzle.min.map vendored

File diff suppressed because one or more lines are too long

View File

@ -66,7 +66,7 @@
"scripts": {
"build": "npm install && grunt",
"start": "grunt start",
"test": "grunt test"
"test": "grunt && grunt test"
},
"commitplease": {
"components": [

View File

@ -1,49 +0,0 @@
"use strict";
var exec = require( "child_process" ).exec;
module.exports = function( grunt ) {
var rpreversion = /(\d\.\d+\.\d+)-pre/;
grunt.registerTask( "release",
"Release a version of sizzle, updates a pre version to released, " +
"inserts `next` as the new pre version", function( next ) {
if ( !rpreversion.test( next ) ) {
grunt.fatal( "Next version should be a -pre version (x.x.x-pre): " + next );
return;
}
var done,
version = grunt.config( "pkg.version" );
if ( !rpreversion.test( version ) ) {
grunt.fatal( "Existing version is not a pre version: " + version );
return;
}
version = version.replace( rpreversion, "$1" );
done = this.async();
exec( "git diff --quiet HEAD", function( err ) {
if ( err ) {
grunt.fatal(
"The working directory should be clean when releasing. Commit or stash changes."
);
return;
}
// Build to dist directories along with a map and tag the release
grunt.task.run( [
// Commit new version
"version:" + version,
// Tag new version
"tag:" + version,
// Commit next version
"version:" + next
] );
done();
} );
} );
};

View File

@ -1,9 +0,0 @@
"use strict";
var exec = require( "child_process" ).exec;
module.exports = function( grunt ) {
grunt.registerTask( "tag", "Tag the specified version", function( version ) {
exec( "git tag " + version, this.async() );
} );
};

View File

@ -1,40 +0,0 @@
"use strict";
var exec = require( "child_process" ).exec;
module.exports = function( grunt ) {
grunt.registerTask( "version", "Commit a new version", function( version ) {
if ( !/\d\.\d+\.\d+(?:-pre)?/.test( version ) ) {
grunt.fatal( "Version must follow semver release format: " + version );
return;
}
var done = this.async(),
files = grunt.config( "version.files" ),
rversion = /("version":\s*")[^"]+/;
// Update version in specified files
files.forEach( function( filename ) {
var text = grunt.file.read( filename );
text = text.replace( rversion, "$1" + version );
grunt.file.write( filename, text );
} );
// Add files to git index
exec( "git add -A", function( err ) {
if ( err ) {
grunt.fatal( err );
return;
}
// Commit next pre version
grunt.config( "pkg.version", version );
grunt.task.run( [
"build",
"tests",
"commit:'Release\\: Update version to " + version + "'"
] );
done();
} );
} );
};