Browse Source

wip handle built in schemas

Steven Silvester 7 years ago
parent
commit
e943295cbd
7 changed files with 42 additions and 4 deletions
  1. 1 0
      .gitignore
  2. 1 0
      MANIFEST.in
  3. 28 0
      jupyterlab/copy-schemas.js
  4. 4 0
      jupyterlab/extension.py
  5. 4 0
      jupyterlab/make-release.js
  6. 1 1
      jupyterlab/package.json
  7. 3 3
      setupbase.py

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@ build
 dist
 lib
 jupyterlab/build
+jupyterlab/schemas
 
 node_modules
 .cache

+ 1 - 0
MANIFEST.in

@@ -1,4 +1,5 @@
 recursive-include jupyterlab/build *
+recursive-include jupyterlab/schemas *
 
 include package.json
 include LICENSE

+ 28 - 0
jupyterlab/copy-schemas.js

@@ -0,0 +1,28 @@
+var childProcess = require('child_process');
+var fs = require('fs-extra');
+var glob = require('glob');
+var path = require('path');
+var sortPackageJson = require('sort-package-json');
+
+var schemaDir = path.resolve('./schemas');
+fs.removeSync(schemaDir);
+fs.ensureDirSync(schemaDir);
+
+var basePath = path.resolve('..');
+var packages = glob.sync(path.join(basePath, 'packages/*'));
+packages.forEach(function(packagePath) {
+   var dataPath = path.join(packagePath, 'package.json');
+   try {
+    var data = require(dataPath);
+  } catch (e) {
+    return;
+  }
+  var schemas = data['jupyterlab'] && data['jupyterlab']['schemas'];
+  if (!schemas) {
+    return;
+  }
+  schemas.forEach(function(schemaPath) {
+    var newPath = path.join(basePath, 'jupyterlab');
+    fs.copySync(path.join(packagePath, schemaPath), schemaPath);
+  });
+});

+ 4 - 0
jupyterlab/extension.py

@@ -91,6 +91,10 @@ def load_jupyter_server_extension(nbapp):
 
     add_handlers(web_app, config)
 
+    # NO persistent settings in dev mode
+    # We need to put the schemas in the `jupyterlab/` directory so we
+    # can use them in the release.
+
     # TODO: how do we handle this for dev_mode?
     # TODO: how to we handle core extensions in app_mode?
     schemas_path = ''

+ 4 - 0
jupyterlab/make-release.js

@@ -51,6 +51,10 @@ data['jupyterlab']['version'] = version;
 updateDependencies(data);
 var text = JSON.stringify(sortPackageJson(data), null, 2) + '\n';
 fs.writeFileSync('./package.json', text);
+
+// Update the build script.
+text = JSON.stringify(sortPackageJson(data), null, 2) + '\n';
+data['jupyterlab']['scripts']['build'] = 'webpack'
 fs.writeFileSync('./package.app.json', text);
 
 // Update our app index file.

+ 1 - 1
jupyterlab/package.json

@@ -2,7 +2,7 @@
   "name": "@jupyterlab/application-top",
   "version": "0.8.4",
   "scripts": {
-    "build": "webpack",
+    "build": "node copy-schemas.js && webpack",
     "publish": "node make-release.js"
   },
   "dependencies": {

+ 3 - 3
setupbase.py

@@ -75,9 +75,9 @@ def find_package_data():
     Find package_data.
     """
     return {
-        'jupyterlab': ['build/*', 'index.app.js', 'webpack.config.js',
-                       'package.app.json', 'released_packages.txt',
-                       'node-version-check.js']
+        'jupyterlab': ['build/*', 'schemas/*', 'index.app.js',
+                       'webpack.config.js', 'package.app.json',
+                       'released_packages.txt', 'node-version-check.js']
     }