Ver Fonte

Do not change the local package.json

Steven Silvester há 8 anos atrás
pai
commit
4a74b79c6b
2 ficheiros alterados com 26 adições e 4 exclusões
  1. 1 3
      jupyterlab/package.json
  2. 25 1
      jupyterlab/webpack.config.js

+ 1 - 3
jupyterlab/package.json

@@ -76,9 +76,7 @@
       "@jupyterlab/tabmanager-extension",
       "@jupyterlab/terminal-extension",
       "@jupyterlab/tooltip-extension"
-    ],
-    "version": "0.20.1",
-    "gitDescription": "v0.18.0-0-937-g35b86e85"
+    ]
   },
   "version": "0.1.2"
 }

+ 25 - 1
jupyterlab/webpack.config.js

@@ -1,4 +1,4 @@
-
+var childProcess = require('child-process');
 var webpack = require('webpack');
 var path = require('path');
 var fs = require('fs-extra');
@@ -26,6 +26,30 @@ hash.update(fs.readFileSync('./package.json'));
 fs.writeFileSync('build/hash.md5', hash.digest('hex'));
 
 
+// Get the version and git description if needed
+if (!package_data.jupyterlab.version) {
+  try {
+    var notice = childProcess.execSync('git describe', { encoding: 'utf8' });
+  } catch (e) {
+    var notice = 'unknown';
+  }
+
+
+  // Get the python package version.
+  var cwd = process.cwd();
+  process.chdir('..');
+  try {
+    var version = childProcess.execSync('python setup.py --version', { encoding: 'utf8' });
+  } catch (e) {
+    var version = 'unknown';
+  }
+  process.chdir(cwd);
+
+  package_data.jupyterlab.version = version;
+  package_data.jupyterlab.gitDescription = notice;
+}
+
+
 // Note that we have to use an explicit local public path
 // otherwise the urls in the extracted CSS will point to the wrong
 // location.