Explorar o código

Upgrade test process

sebastien %!s(int64=6) %!d(string=hai) anos
pai
achega
e284ca6350
Modificáronse 4 ficheiros con 22 adicións e 27 borrados
  1. 11 16
      Tools/Publisher/index.js
  2. 9 7
      Tools/Publisher/publisher.js
  3. 1 3
      Tools/Publisher/test.js
  4. 1 1
      package.json

+ 11 - 16
Tools/Publisher/index.js

@@ -5,19 +5,14 @@ const publisher = require('./publisher');
 const doNotBuild = process.argv.indexOf('--no-build') === -1;
 const doNotPublish = process.argv.indexOf('--no-publish') === -1;
 
-/**
- * Main function driving the publication.
- */
-function main() {
-    // Gets the current npm user.
-    console.log("Using npm user:");
-    let loginCheck = shelljs.exec('npm whoami');
-    // If logged in process.
-    if (loginCheck.code === 0) {
-        publisher.process(doNotBuild, doNotPublish, true);
-    }
-    // If not logged in error.
-    else {
-        console.log('Not logged in, please log in to npm.');
-    }
-}();
+// Gets the current npm user.
+console.log("Using npm user:");
+let loginCheck = shelljs.exec('npm whoami');
+// If logged in process.
+if (loginCheck.code === 0) {
+    publisher(doNotBuild, doNotPublish, true);
+}
+// If not logged in error.
+else {
+    console.log('Not logged in, please log in to npm.');
+}

+ 9 - 7
Tools/Publisher/publisher.js

@@ -69,8 +69,9 @@ function updateEngineVersion(newVersion) {
 function getEngineVersion() {
     console.log("Get version from babylon.engine.ts");
     const engineContent = fs.readFileSync("../../src/Engine/babylon.engine.ts").toString();
-    var versionRegex = new RegExp(`public static get Version\(\): string {[\s\S]*return "([\s\S]*?)";[\s\S]*}`, "gm");
-    versionRegex.exec(engineContent);
+
+    const versionRegex = new RegExp(`public static get Version\\(\\): string {[\\s\\S]*return "([\\s\\S]*?)";[\\s\\S]*}`, "gm");
+    const match = versionRegex.exec(engineContent);
     if (match && match.length) {
         const version = match[1];
         console.log("Version found: " + version);
@@ -99,7 +100,7 @@ function publish(version, packageName, basePath) {
     }
     else {
         console.log("Executing: " + 'npm publish \"' + basePath + "\"" + ' ' + tag);
-        shelljs.exec('npm publish \"' + basePath + "\"" + ' ' + tag);
+        //shelljs.exec('npm publish \"' + basePath + "\"" + ' ' + tag);
     }
 }
 
@@ -123,6 +124,7 @@ function processLegacyPackages(version) {
     packages.forEach((package) => {
         if (package.name === "core") {
             processCore(package, version);
+        }
         else {
             if (package.required) {
                 package.required.forEach(file => {
@@ -188,7 +190,7 @@ function processEs6Packages(version) {
                 packageJson[key] = {};
                 Object.keys(package.payload[key]).forEach(packageName => {
                     if (package.payload[key][packageName] === true) {
-                        packageJson[key][packageName] = version;
+                        packageJson[key][packageName] = ">" + version;
                     } else {
                         packageJson[key][packageName] = package.payload[key][packageName];
                     }
@@ -249,7 +251,7 @@ function processCore(package, version) {
 
     // update package.json
     packageJson.version = version;
-    console.log("generating file list");
+    console.log("Generating file list");
     let packageFiles = ["package.json"];
     files.forEach(file => {
         if (!file.isDir) {
@@ -259,7 +261,7 @@ function processCore(package, version) {
             packageFiles.push(file.objectName + "/index.js", file.objectName + "/index.d.ts", file.objectName + "/es6.js")
         }
     });
-    console.log("updating package.json");
+    console.log("Updating package.json");
     packageJson.files = packageFiles;
     packageJson.main = "babylon.js";
     packageJson.typings = "babylon.d.ts";
@@ -329,4 +331,4 @@ module.exports = function(noBuild, noPublish, askVersion) {
         const version = getEngineVersion();
         createVersion(version);
     }
-}();
+};

+ 1 - 3
Tools/Publisher/test.js

@@ -8,6 +8,4 @@ const doNotPublish = true;
 /**
  * Main function driving the publication.
  */
-function main() {
-    publisher.process(doNotBuild, doNotPublish, false);
-}();
+publisher(doNotBuild, doNotPublish, false);

+ 1 - 1
package.json

@@ -101,4 +101,4 @@
         "prompt": "^1.0.0",
         "shelljs": "^0.7.8"
     }
-}
+}