diff options
author | Timmy Willison <4timmywil@gmail.com> | 2021-03-01 17:41:18 -0500 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2021-03-01 17:41:18 -0500 |
commit | 8b50fbe75d41d6dc95f84b205c45be6f5d4e2aa3 (patch) | |
tree | 02a71e00e8476bda5a8342dc3b8542b1ad8f809d /build/release | |
parent | a21a4b2de7ae637edc1d3492778551032d6b7f90 (diff) | |
download | jquery-8b50fbe75d41d6dc95f84b205c45be6f5d4e2aa3.tar.gz jquery-8b50fbe75d41d6dc95f84b205c45be6f5d4e2aa3.zip |
Release: drop the need for npm as a local dependency
- Not meant to be used like that anymore
Diffstat (limited to 'build/release')
-rw-r--r-- | build/release/ensure-sizzle.js | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/build/release/ensure-sizzle.js b/build/release/ensure-sizzle.js index eb1cbd8e8..605b141ba 100644 --- a/build/release/ensure-sizzle.js +++ b/build/release/ensure-sizzle.js @@ -1,30 +1,11 @@ "use strict"; var fs = require( "fs" ), - npm = require( "npm" ), chalk = require( "chalk" ), sizzleLoc = __dirname + "/../../external/sizzle/dist/sizzle.js", rversion = /Engine v(\d+\.\d+\.\d+(?:-[-\.\d\w]+)?)/; /** - * Retrieve the latest tag of Sizzle from npm - * @param {Function(string)} callback - */ -function getLatestSizzle( callback ) { - npm.load( function( err, npm ) { - if ( err ) { - throw err; - } - npm.commands.info( [ "sizzle", "version" ], function( err, info ) { - if ( err ) { - throw err; - } - callback( Object.keys( info )[ 0 ] ); - } ); - } ); -} - -/** * Ensure the /src folder has the latest tag of Sizzle * @param {Object} Release * @param {Function} callback @@ -32,23 +13,23 @@ function getLatestSizzle( callback ) { function ensureSizzle( Release, callback ) { console.log(); console.log( "Checking Sizzle version..." ); - getLatestSizzle( function( latest ) { - var match = rversion.exec( fs.readFileSync( sizzleLoc, "utf8" ) ), - version = match ? match[ 1 ] : "Not Found"; - - if ( version !== latest ) { + var match = rversion.exec( fs.readFileSync( sizzleLoc, "utf8" ) ), + version = match ? match[ 1 ] : "Not Found", + latest = Release.exec( { + command: "npm info sizzle version", + silent: true + } ); - // colors is inherited from jquery-release - console.log( - "The Sizzle version in the src folder (" + chalk.red( version ) + - ") is not the latest tag (" + chalk.green( latest ) + ")." - ); - Release.confirm( callback ); - } else { - console.log( "Sizzle is latest (" + chalk.green( latest ) + ")" ); - callback(); - } - } ); + if ( version !== latest ) { + console.log( + "The Sizzle version in the src folder (" + chalk.red( version ) + + ") is not the latest tag (" + chalk.green( latest ) + ")." + ); + Release.confirm( callback ); + } else { + console.log( "Sizzle is latest (" + chalk.green( latest ) + ")" ); + callback(); + } } module.exports = ensureSizzle; |