Browse Source

NPM - adding "preview" tag to alpha and beta releases
Addressing - https://github.com/BabylonJS/Babylon.js/issues/3055
alpha and beta releases will not show as latest from the moment this script is used to publish.
The latest preview release will be installed using `npm install babylonjs@preview`

Raanan Weber 7 years ago
parent
commit
bc13392760
1 changed files with 8 additions and 1 deletions
  1. 8 1
      Tools/Publisher/index.js

+ 8 - 1
Tools/Publisher/index.js

@@ -185,8 +185,15 @@ function processCore(package, version) {
     fs.writeFileSync(basePath + '/package/' + 'package.json', JSON.stringify(packageJson, null, 4));
     fs.writeFileSync(basePath + '/package/' + 'package.json', JSON.stringify(packageJson, null, 4));
 
 
     console.log('Publishing ' + package.name + " from " + basePath + '/package/');
     console.log('Publishing ' + package.name + " from " + basePath + '/package/');
+
+    let tagDef = "";
+    // check for alpha or beta
+    if (version.indexOf('alpha') !== -1 || version.indexOf('beta') !== -1) {
+        tagDef = '--tag preview';
+    }
+
     //publish the respected package
     //publish the respected package
-    shelljs.exec('npm publish \"' + basePath + '/package/' + "\"");
+    shelljs.exec('npm publish \"' + basePath + '/package/' + "\"" + ' ' + tagDef);
 
 
     // remove package directory
     // remove package directory
     fs.removeSync(basePath + '/package/');
     fs.removeSync(basePath + '/package/');