Browse Source

Merge the static directory into build/ with an explicit update

Steven Silvester 8 years ago
parent
commit
d9d2959acf

+ 0 - 15
jupyterlab/build-static.js

@@ -1,15 +0,0 @@
-var fs = require('fs');
-
-if (!fs.existsSync('./static')){
-    fs.mkdirSync('./static');
-}
-
-// Copy the templates.
-fs.createReadStream('./package.template.json')
-    .pipe(fs.createWriteStream('./static/package.json'));
-
-fs.createReadStream('./webpack.config.js')
-    .pipe(fs.createWriteStream('./static/webpack.config.js'));
-
-fs.createReadStream('./index.template.js')
-    .pipe(fs.createWriteStream('./static/index.template.js'));

+ 24 - 0
jupyterlab/make-release.js

@@ -0,0 +1,24 @@
+var childProcess = require('child_process');
+var fs = require('fs-extra');
+var path = require('path');
+
+// Get the current version of JupyterLab
+var cwd = path.resolve('..');
+var version = childProcess.execSync('python setup.py --version', { cwd: cwd });
+version = version.toString().trim();
+
+// Update our package.json files.
+var data = require('./package.json');
+data['version'] = version;
+
+var text = JSON.stringify(data, null, 2) + '\n';
+fs.writeFileSync('./package.json', text);
+fs.writeFileSync('./package.template.json', text);
+
+// Run a standard build.
+childProcess.execSync('npm run build');
+
+// Add  the release metadata.
+var release_data = { version: version };
+text = JSON.stringify(release_data, null, 2) + '\n';
+fs.writeFileSync('./build/release_data.json', text);

+ 3 - 4
jupyterlab/package.json

@@ -1,10 +1,9 @@
 {
   "private": true,
-  "name": "@jupyterlab/application-dev",
+  "name": "@jupyterlab/application-top",
   "scripts": {
     "build": "webpack",
-    "build:static": "node build-static.js && cd static && npm install && npm update && npm run build",
-    "update:static": "node update-static.js && npm run build:static"
+    "publish": "node make-release.js"
   },
   "dependencies": {
     "@jupyterlab/about-extension": "^0.3.1",
@@ -81,5 +80,5 @@
     ],
     "publicPath": "/lab"
   },
-  "version": "0.1.2"
+  "version": "0.20.3"
 }

+ 5 - 3
jupyterlab/package.template.json

@@ -2,7 +2,8 @@
   "private": true,
   "name": "@jupyterlab/application-top",
   "scripts": {
-    "build": "webpack"
+    "build": "webpack",
+    "publish": "node make-release.js"
   },
   "dependencies": {
     "@jupyterlab/about-extension": "^0.3.1",
@@ -76,7 +77,8 @@
       "@jupyterlab/tabmanager-extension",
       "@jupyterlab/terminal-extension",
       "@jupyterlab/tooltip-extension"
-    ]
+    ],
+    "publicPath": "/lab"
   },
-  "version": "0.1.1"
+  "version": "0.20.3"
 }

+ 0 - 32
jupyterlab/update-static.js

@@ -1,32 +0,0 @@
-var fs = require('fs-extra');
-var childProcess = require('child_process');
-var path = require('path');
-
-
-// Fill in the package template.
-var source = './package.json';
-var target = './package.template.json';
-var data = require(source);
-data['name'] = '@jupyterlab/application-top';
-data['scripts'] = {
-    'build': 'webpack'
-};
-
-// Use the npm package versions.
-var packages = fs.readdirSync('../packages');
-for (var i = 0; i < packages.length; i++) {
-  var pkg = packages[i];
-  var pkg_data = require(path.resolve('../packages', pkg, 'package.json'));
-  var name = pkg_data.name;
-  if (!data['dependencies'][name]) {
-    continue;
-  }
-  var cmd = 'npm view ' + name + ' version';
-  var specifier = childProcess.execSync(cmd);
-  specifier = '^' + String(specifier).trim();
-  console.log(name, specifier);
-  data['dependencies'][name] = specifier;
-}
-
-// Copy the target file.
-fs.writeFileSync(target, JSON.stringify(data, null, 2) + '\n');

+ 1 - 1
package.json

@@ -19,7 +19,7 @@
     "test:chrome": "lerna run test:chrome --stream",
     "test:firefox": "lerna run test:firefox --stream",
     "test:ie": "lerna run test:ie --concurrency 1 --stream",
-    "publish": "npm update && npm install && npm run clean && npm run build && lerna publish -m \"Publish\" && cd jupyterlab && npm run update:static",
+    "publish": "npm update && npm install && npm run clean && npm run build && lerna publish -m \"Publish\" && cd jupyterlab && npm run publish",
     "update:dependency": "node scripts/update-dependency.js",
     "watch": "watch \"npm run build\" ./packages/** --wait 10 --filter=scripts/watch-filter.js",
     "watch:main": "watch \"npm run build:main\" ./packages/** --wait 10 --filter=scripts/watch-filter.js"