Browse Source

Finish filebrowser example and example scripts

Steven Silvester 9 years ago
parent
commit
35aadbf4c1

+ 1 - 1
examples/filebrowser/index.html

@@ -1,7 +1,7 @@
 <!doctype html>
 <html lang="en">
   <head>
-    <title>FileBrowser Demo</title>
+    <title>4FileBrowser Demo</title>
     <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
     <link href="index.css" rel="stylesheet">
   </head>

+ 2 - 1
examples/filebrowser/main.py

@@ -65,7 +65,8 @@ def main(argv):
     ]
 
     app = tornado.web.Application(handlers, static_path='build',
-                                  template_path='.')
+                                  template_path='.',
+                                  compiled_template_cache=False)
 
     app.listen(PORT, 'localhost')
     loop = tornado.ioloop.IOLoop.instance()

+ 2 - 2
examples/filebrowser/package.json

@@ -15,11 +15,11 @@
   },
   "scripts": {
     "build": "tsc --project src && webpack --config webpack.conf.js",
+    "clean": "rimraf build && rimraf node_modules",
     "postinstall": "npm dedupe",
     "update": "rimraf node_modules/jupyter-js-ui && npm install",
     "watch:src": "watch 'npm run build' src --wait 5",
-    "watch:lib": "watch 'npm run update && npm run build' ../../lib --wait 10",
-    "watch": "concurrently 'npm run watch:lib' 'npm run watch:src'"
+    "watch": "concurrently 'npm run watch:src' 'python main.py'"
   },
   "devDependencies": {
     "concurrently": "^2.0.0",

+ 7 - 1
package.json

@@ -39,12 +39,18 @@
     "typedoc": "^0.3.12",
     "typescript": "^1.7.5",
     "url-loader": "^0.5.7",
+    "watch": "^0.17.1",
     "webpack": "^1.12.11"
   },
   "scripts": {
     "clean": "rimraf lib",
+    "clean:examples": "node scripts/cleanexamples.js",
+    "build:example": "cd examples/$EXAMPLE && npm run update && npm run build",
+    "build:examples": "node scripts/buildexamples.js",
     "build": "tsc --project src && node scripts/copycss.js",
-    "postinstall": "npm dedupe"
+    "postinstall": "npm dedupe",
+    "watch:example": "watch 'npm run build && npm run build:example' src --wait 10",
+    "watch": "watch 'npm run build' src"
   },
   "repository": {
     "type": "git",

+ 21 - 0
scripts/buildexamples.js

@@ -0,0 +1,21 @@
+var childProcess = require('child_process');
+var fs = require('fs');
+
+// Build all of the example folders.
+dirs = fs.readdirSync('examples');
+
+for (var i = 0; i < dirs.length; i++) {
+  process.chdir('examples/' + dirs[i]);
+
+  childProcess.exec('npm run update && npm run build', function (error, stdout, stderr) {
+    if (error) {
+      console.log(error.stack);
+      console.log('Error code: ' + error.code);
+      console.log('Signal received: ' + error.signal);
+      console.log('Child Process STDERR: ' + stderr);
+     }
+     console.log('Child Process STDOUT: ' + stdout);
+  });
+
+  process.chdir('../..');
+}

+ 21 - 0
scripts/cleanexamples.js

@@ -0,0 +1,21 @@
+var childProcess = require('child_process');
+var fs = require('fs');
+
+// Clean all of the example folders.
+dirs = fs.readdirSync('examples');
+
+for (var i = 0; i < dirs.length; i++) {
+  process.chdir('examples/' + dirs[i]);
+
+  childProcess.exec('npm run clean', function (error, stdout, stderr) {
+    if (error) {
+      console.log(error.stack);
+      console.log('Error code: ' + error.code);
+      console.log('Signal received: ' + error.signal);
+      console.log('Child Process STDERR: ' + stderr);
+     }
+     console.log('Child Process STDOUT: ' + stdout);
+  });
+
+  process.chdir('../..');
+}

+ 1 - 2
scripts/travis_script.sh

@@ -5,11 +5,10 @@ sh -e /etc/init.d/xvfb start || true
 
 npm run clean
 npm run build
-
+npm run build:examples
 exit 0
 
 npm test
 npm run test:coverage
 export PATH="$HOME/miniconda/bin:$PATH"
-npm run build:example
 npm run docs

+ 1 - 1
src/tsconfig.json

@@ -14,9 +14,9 @@
     "docmanager/index.ts",
     "filebrowser/index.ts",
     "terminal/index.ts",
+    "typings/codemirror/codemirror.d.ts",
     "typings/es6-promise.d.ts",
     "typings/requirejs/requirejs.d.ts",
-    "typings/codemirror/codemirror.d.ts",
     "typings/moment/moment.d.ts",
     "typings/term.js/term.js.d.ts",
     "typings/widgets.d.ts"