]> source.dussan.org Git - jquery.git/commitdiff
Release: drop the need for npm as a local dependency
authorTimmy Willison <4timmywil@gmail.com>
Mon, 1 Mar 2021 22:41:18 +0000 (17:41 -0500)
committerTimmy Willison <4timmywil@gmail.com>
Mon, 1 Mar 2021 22:41:18 +0000 (17:41 -0500)
- Not meant to be used like that anymore

build/release.js
build/release/ensure-sizzle.js

index 724de7ac68a61e64c4a0c2cd1380ca305b58d250..b95e2b62f0d1094a5808c3024762312b257f5f35 100644 (file)
@@ -90,6 +90,5 @@ module.exports.dependencies = [
        "archiver@5.2.0",
        "shelljs@0.8.4",
        "inquirer@8.0.0",
-       "npm@7.6.0",
        "chalk@4.1.0"
 ];
index eb1cbd8e80d1624ecbff2aa8828df1814e94e273..605b141ba0bdb830e47877b3b49f39c23bad70bf 100644 (file)
@@ -1,29 +1,10 @@
 "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
@@ -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;