Browse Source

Clean up examples scripts and add it to clean:slate.

Jason Grout 8 years ago
parent
commit
ff2d1c0cc1
3 changed files with 6 additions and 15 deletions
  1. 1 1
      package.json
  2. 0 7
      scripts/buildexamples.js
  3. 5 7
      scripts/cleanexamples.js

+ 1 - 1
package.json

@@ -63,7 +63,7 @@
     "clean": "rimraf docs && rimraf lib && rimraf test/build && rimraf test/coverage",
     "clean:all": "npm run clean && cd jupyterlab && npm run clean && cd ..",
     "clean:examples": "node scripts/cleanexamples.js",
-    "clean:slate": "npm run clean:all && rimraf jupyterlab/node_modules && rimraf node_modules && npm install",
+    "clean:slate": "npm run clean:all && npm run clean:examples && rimraf jupyterlab/node_modules && rimraf node_modules && npm install",
     "docs": "typedoc --mode modules --module commonjs --excludeNotExported --target es5 --moduleResolution node --out docs/ src",
     "postinstall": "node scripts/dedupe.js",
     "prepublish": "npm run build",

+ 0 - 7
scripts/buildexamples.js

@@ -7,14 +7,7 @@ var fs = require('fs');
 // Build all of the example folders.
 dirs = fs.readdirSync('examples');
 
-var cmd;
 for (var i = 0; i < dirs.length; i++) {
-  if (dirs[i].indexOf('.') !== -1) {
-    continue;
-  }
-  if (dirs[i].indexOf('node_modules') !== -1) {
-    continue;
-  }
   console.log('Building: ' + dirs[i] + '...');
   process.chdir('examples/' + dirs[i]);
   childProcess.execSync('npm run update', { stdio: [0, 1, 2] });

+ 5 - 7
scripts/cleanexamples.js

@@ -4,15 +4,13 @@
 var childProcess = require('child_process');
 var fs = require('fs');
 
-childProcess.execSync('rimraf examples/node_modules', { stdio: 'inherit' });
-
 // Clean all of the example folders.
 dirs = fs.readdirSync('examples');
 
 for (var i = 0; i < dirs.length; i++) {
-  if (dirs[i].indexOf('.') !== -1) {
-    continue;
-  }
-  var cmd = 'rimraf examples/' + dirs[i] + '/build';
-  childProcess.execSync(cmd, { stdio: [0, 1, 2] });
+  console.log('Cleaning: ' + dirs[i] + '...');
+  process.chdir('examples/' + dirs[i]);
+  childProcess.execSync('npm run clean', { stdio: [0, 1, 2] });
+  process.chdir('../..');
 }
+console.log('\n********\nDone!');