From 8d824a7f7e2b5fd102fe5db32c06671825a65277 Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Thu, 20 Dec 2018 20:11:32 -0500 Subject: [PATCH 1/3] Remove fs.Shell() and Filer.Shell() functions --- src/shell/{shell.js => index.js} | 0 tests/spec/fs.shell.spec.js | 29 ----------------------------- 2 files changed, 29 deletions(-) rename src/shell/{shell.js => index.js} (100%) delete mode 100644 tests/spec/fs.shell.spec.js diff --git a/src/shell/shell.js b/src/shell/index.js similarity index 100% rename from src/shell/shell.js rename to src/shell/index.js diff --git a/tests/spec/fs.shell.spec.js b/tests/spec/fs.shell.spec.js deleted file mode 100644 index 26b7d6c5..00000000 --- a/tests/spec/fs.shell.spec.js +++ /dev/null @@ -1,29 +0,0 @@ -var Filer = require('../../src'); -var util = require('../lib/test-utils.js'); -var expect = require('chai').expect; - -describe('fs.Shell', function() { - beforeEach(util.setup); - afterEach(util.cleanup); - - it('is a function', function() { - var fs = util.fs(); - expect(typeof fs.Shell).to.equal('function'); - }); - - it('should return a FileSystemShell instance', function() { - var fs = util.fs(); - var sh = new fs.Shell(); - - expect(sh.prototype).to.deep.equal((new Filer.Shell(fs)).prototype); - }); - - it('should reflect changes to the prototype', function(){ - var fs = util.fs(); - var sh = new fs.Shell(); - - Filer.Shell.prototype.test = 'foo'; - - expect(sh.test).to.equal('foo'); - }); -}); From 9974d5dbda864438ed78f49082a9319de02dcf4f Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Thu, 20 Dec 2018 20:11:51 -0500 Subject: [PATCH 2/3] Update tests --- src/filesystem/interface.js | 4 ---- src/index.js | 3 +-- tests/bugs/issue247.js | 3 +-- tests/bugs/ls-depth-bug.js | 5 ++--- tests/index.js | 1 - tests/lib/test-utils.js | 4 ++-- tests/spec/filer.spec.js | 4 ---- tests/spec/shell/cat.spec.js | 9 ++++----- tests/spec/shell/cd.spec.js | 12 ++++++------ tests/spec/shell/env.spec.js | 14 +++++--------- tests/spec/shell/exec.spec.js | 2 +- tests/spec/shell/ls.spec.js | 9 ++++----- tests/spec/shell/mkdirp.spec.js | 16 +++++++--------- tests/spec/shell/rm.spec.js | 13 ++++++------- tests/spec/shell/touch.spec.js | 8 ++++---- 15 files changed, 43 insertions(+), 64 deletions(-) diff --git a/src/filesystem/interface.js b/src/filesystem/interface.js index 901212f7..7b39d45d 100644 --- a/src/filesystem/interface.js +++ b/src/filesystem/interface.js @@ -13,7 +13,6 @@ var FS_NODUPEIDCHECK = Constants.FS_NODUPEIDCHECK; var providers = require('../providers/index.js'); -var Shell = require('../shell/shell.js'); var Intercom = require('../../lib/intercom.js'); var FSWatcher = require('../fs-watcher.js'); var Errors = require('../errors.js'); @@ -98,9 +97,6 @@ function FileSystem(options, callback) { // Expose Node's fs.constants to users fs.constants = Constants.fsConstants; - // Expose Shell constructor - this.Shell = Shell.bind(undefined, this); - // Safely expose the list of open files and file // descriptor management functions var openFiles = {}; diff --git a/src/index.js b/src/index.js index dc54a5ea..35e55b4d 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,5 @@ module.exports = { FileSystem: require('./filesystem/interface.js'), Buffer: Buffer, Path: require('./path.js'), - Errors: require('./errors.js'), - Shell: require('./shell/shell.js') + Errors: require('./errors.js') }; diff --git a/tests/bugs/issue247.js b/tests/bugs/issue247.js index 2de7419a..8d70e2b5 100644 --- a/tests/bugs/issue247.js +++ b/tests/bugs/issue247.js @@ -6,8 +6,7 @@ describe('sh.cd doesn\'t seem to be working from a relative path if I am one or afterEach(util.cleanup); it('should properly deal with relative paths missing ./ and ../', function(done) { - var fs = util.fs(); - var sh = new fs.Shell(); + var sh = util.shell(); sh.mkdirp('/home/scott', function(err) { if(err) throw err; diff --git a/tests/bugs/ls-depth-bug.js b/tests/bugs/ls-depth-bug.js index 073e9257..5bbbe9af 100644 --- a/tests/bugs/ls-depth-bug.js +++ b/tests/bugs/ls-depth-bug.js @@ -8,8 +8,7 @@ describe('sh.ls and deep directory trees', function() { afterEach(util.cleanup); it('should not crash when calling sh.ls() on deep directory layouts', function(done) { - var fs = util.fs(); - var sh = new fs.Shell(); + var sh = util.shell(); var path = ''; for(var i=0; i<50; i++) { @@ -29,7 +28,7 @@ describe('sh.ls and deep directory trees', function() { it('should not crash when calling sh.ls() on wide directory layouts', function(done) { var fs = util.fs(); - var sh = new fs.Shell(); + var sh = util.shell(); var dirName = '/dir'; diff --git a/tests/index.js b/tests/index.js index f864a3d4..e48bd3ce 100644 --- a/tests/index.js +++ b/tests/index.js @@ -44,7 +44,6 @@ require('./spec/time-flags.spec'); require('./spec/fs.watch.spec'); require('./spec/fs.unwatchFile.spec'); require('./spec/errors.spec'); -require('./spec/fs.shell.spec'); require('./spec/fs.chmod.spec'); require('./spec/fs.chown.spec'); require('./spec/fs.copyFile.spec'); diff --git a/tests/lib/test-utils.js b/tests/lib/test-utils.js index 8b8f9043..244bf343 100644 --- a/tests/lib/test-utils.js +++ b/tests/lib/test-utils.js @@ -3,6 +3,7 @@ var IndexedDBTestProvider = require('./indexeddb.js'); var WebSQLTestProvider = require('./websql.js'); var MemoryTestProvider = require('./memory.js'); var Url = require('url'); +var Shell = require('../../src/shell'); var _provider; var _fs; @@ -108,8 +109,7 @@ function provider() { } function shell(options) { - var _fs = fs(); - return new _fs.Shell(options); + return new Shell(fs(), options); } function cleanup(callback) { diff --git a/tests/spec/filer.spec.js b/tests/spec/filer.spec.js index 2fec5abc..24112e7a 100644 --- a/tests/spec/filer.spec.js +++ b/tests/spec/filer.spec.js @@ -10,10 +10,6 @@ describe('Filer', function() { expect(typeof Filer.FileSystem).to.equal('function'); }); - it('has Shell constructor', function() { - expect(typeof Filer.Shell).to.equal('function'); - }); - it('must honor the \'FORMAT\' flag', function(done) { var name = 'local-test'; // Because we need to use a bunch of Filer filesystems diff --git a/tests/spec/shell/cat.spec.js b/tests/spec/shell/cat.spec.js index 333295f9..234fe633 100644 --- a/tests/spec/shell/cat.spec.js +++ b/tests/spec/shell/cat.spec.js @@ -11,8 +11,7 @@ describe('FileSystemShell.cat', function() { }); it('should fail when files argument is absent', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.cat(null, function(error, data) { expect(error).to.exist; @@ -24,7 +23,7 @@ describe('FileSystemShell.cat', function() { it('should return the contents of a single file', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'file contents'; fs.writeFile('/file', contents, function(err) { @@ -40,7 +39,7 @@ describe('FileSystemShell.cat', function() { it('should return the contents of multiple files', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'file contents'; var contents2 = contents + '\n' + contents; @@ -61,7 +60,7 @@ describe('FileSystemShell.cat', function() { it('should fail if any of multiple file paths is invalid', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'file contents'; var contents2 = contents + '\n' + contents; diff --git a/tests/spec/shell/cd.spec.js b/tests/spec/shell/cd.spec.js index ea2e2138..74463801 100644 --- a/tests/spec/shell/cd.spec.js +++ b/tests/spec/shell/cd.spec.js @@ -17,7 +17,7 @@ describe('FileSystemShell.cd', function() { it('should allow changing the path to a valid dir', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -33,7 +33,7 @@ describe('FileSystemShell.cd', function() { it('should fail when changing the path to an invalid dir', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -50,7 +50,7 @@ describe('FileSystemShell.cd', function() { it('should fail when changing the path to a file', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.writeFile('/file', 'file', function(err) { if(err) throw err; @@ -67,7 +67,7 @@ describe('FileSystemShell.cd', function() { it('should allow relative paths for a valid dir', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -83,7 +83,7 @@ describe('FileSystemShell.cd', function() { it('should allow .. in paths for a valid dir', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -110,7 +110,7 @@ describe('FileSystemShell.cd', function() { fs.symlink('/dir', '/link', function(error) { if(error) throw error; - var shell = new fs.Shell(); + var shell = util.shell(); shell.cd('link', function(error) { expect(error).not.to.exist; expect(shell.pwd()).to.equal('/link'); diff --git a/tests/spec/shell/env.spec.js b/tests/spec/shell/env.spec.js index bfabd86a..0ac377ab 100644 --- a/tests/spec/shell/env.spec.js +++ b/tests/spec/shell/env.spec.js @@ -32,8 +32,7 @@ describe('FileSystemShell.env', function() { }); it('should fail when dirs argument is absent', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.ls(null, function(error, list) { expect(error).to.exist; @@ -45,7 +44,7 @@ describe('FileSystemShell.env', function() { it('should give new value for shell.pwd() when cwd changes', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -60,8 +59,7 @@ describe('FileSystemShell.env', function() { }); it('should create/return the default tmp dir', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); expect(shell.env.get('TMP')).to.equal('/tmp'); shell.tempDir(function(err, tmp) { @@ -75,8 +73,7 @@ describe('FileSystemShell.env', function() { }); it('should create/return the tmp dir specified in env.TMP', function(done) { - var fs = util.fs(); - var shell = new fs.Shell({ + var shell = util.shell({ env: { TMP: '/tempdir' } @@ -94,8 +91,7 @@ describe('FileSystemShell.env', function() { }); it('should allow repeated calls to tempDir()', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); expect(shell.env.get('TMP')).to.equal('/tmp'); shell.tempDir(function(err, tmp) { diff --git a/tests/spec/shell/exec.spec.js b/tests/spec/shell/exec.spec.js index a7df4305..55626a0f 100644 --- a/tests/spec/shell/exec.spec.js +++ b/tests/spec/shell/exec.spec.js @@ -12,7 +12,7 @@ describe('FileSystemShell.exec', function() { it('should be able to execute a command .js file from the filesystem', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var cmdString = 'fs.writeFile(args[0], args[1], callback);'; fs.writeFile('/cmd.js', cmdString, function(error) { diff --git a/tests/spec/shell/ls.spec.js b/tests/spec/shell/ls.spec.js index 8218c87b..2167c7f8 100644 --- a/tests/spec/shell/ls.spec.js +++ b/tests/spec/shell/ls.spec.js @@ -11,8 +11,7 @@ describe('FileSystemShell.ls', function() { }); it('should fail when dirs argument is absent', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.ls(null, function(error, list) { expect(error).to.exist; @@ -24,7 +23,7 @@ describe('FileSystemShell.ls', function() { it('should return the contents of a simple dir', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'a'; var contents2 = 'bb'; @@ -62,7 +61,7 @@ describe('FileSystemShell.ls', function() { it('should return the shallow contents of a dir tree', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'a'; fs.mkdir('/dir', function(err) { @@ -118,7 +117,7 @@ describe('FileSystemShell.ls', function() { it('should return the deep contents of a dir tree', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'a'; fs.mkdir('/dir', function(err) { diff --git a/tests/spec/shell/mkdirp.spec.js b/tests/spec/shell/mkdirp.spec.js index 5f88544a..c90becb6 100644 --- a/tests/spec/shell/mkdirp.spec.js +++ b/tests/spec/shell/mkdirp.spec.js @@ -11,8 +11,7 @@ describe('FileSystemShell.mkdirp', function() { }); it('should fail without a path provided', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.mkdirp(null, function(err) { expect(err).to.exist; @@ -22,8 +21,7 @@ describe('FileSystemShell.mkdirp', function() { }); it('should succeed if provided path is root', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.mkdirp('/', function(err) { expect(err).to.not.exist; done(); @@ -32,7 +30,7 @@ describe('FileSystemShell.mkdirp', function() { it('should succeed if the directory exists', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/test', function(err){ expect(err).to.not.exist; shell.mkdirp('/test',function(err) { @@ -44,7 +42,7 @@ describe('FileSystemShell.mkdirp', function() { it('fail if a file name is provided', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.writeFile('/test.txt', 'test', function(err){ expect(err).to.not.exist; shell.mkdirp('/test.txt', function(err) { @@ -57,7 +55,7 @@ describe('FileSystemShell.mkdirp', function() { it('should succeed on a folder on root (\'/test\')', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.mkdirp('/test', function(err) { expect(err).to.not.exist; fs.exists('/test', function(dir){ @@ -69,7 +67,7 @@ describe('FileSystemShell.mkdirp', function() { it('should succeed on a folder with a nonexistant parent (\'/test/test\')', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.mkdirp('/test/test', function(err) { expect(err).to.not.exist; fs.exists('/test', function(dir1){ @@ -84,7 +82,7 @@ describe('FileSystemShell.mkdirp', function() { it('should fail on a folder with a file for its parent (\'/test.txt/test\')', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.writeFile('/test.txt', 'test', function(err){ expect(err).to.not.exist; shell.mkdirp('/test.txt/test', function(err) { diff --git a/tests/spec/shell/rm.spec.js b/tests/spec/shell/rm.spec.js index 116d871b..f9568759 100644 --- a/tests/spec/shell/rm.spec.js +++ b/tests/spec/shell/rm.spec.js @@ -11,8 +11,7 @@ describe('FileSystemShell.rm', function() { }); it('should fail when path argument is absent', function(done) { - var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.rm(null, function(error, list) { expect(error).to.exist; @@ -24,7 +23,7 @@ describe('FileSystemShell.rm', function() { it('should remove a single file', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'a'; fs.writeFile('/file', contents, function(err) { @@ -44,7 +43,7 @@ describe('FileSystemShell.rm', function() { it('should remove an empty dir', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -63,7 +62,7 @@ describe('FileSystemShell.rm', function() { it('should fail to remove a non-empty dir', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -82,7 +81,7 @@ describe('FileSystemShell.rm', function() { it('should remove a non-empty dir with option.recursive set', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); fs.mkdir('/dir', function(err) { if(err) throw err; @@ -105,7 +104,7 @@ describe('FileSystemShell.rm', function() { it('should work on a complex dir structure', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var contents = 'a'; fs.mkdir('/dir', function(err) { diff --git a/tests/spec/shell/touch.spec.js b/tests/spec/shell/touch.spec.js index 572b2f45..5a316c71 100644 --- a/tests/spec/shell/touch.spec.js +++ b/tests/spec/shell/touch.spec.js @@ -19,7 +19,7 @@ describe('FileSystemShell.touch', function() { it('should create a new file if path does not exist', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.touch('/newfile', function(error) { if(error) throw error; @@ -34,7 +34,7 @@ describe('FileSystemShell.touch', function() { it('should skip creating a new file if options.updateOnly is true', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); shell.touch('/newfile', { updateOnly: true }, function(error) { if(error) throw error; @@ -49,7 +49,7 @@ describe('FileSystemShell.touch', function() { it('should update times if path does exist', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var atime = Date.parse('1 Oct 2000 15:33:22'); var mtime = Date.parse('30 Sep 2000 06:43:54'); @@ -80,7 +80,7 @@ describe('FileSystemShell.touch', function() { it('should update times to specified date if path does exist', function(done) { var fs = util.fs(); - var shell = new fs.Shell(); + var shell = util.shell(); var date = Date.parse('1 Oct 2001 15:33:22'); fs.open('/newfile', 'w', function (error, fd) { From 5d62fbc26851679faf3daf27c2c517c14a129b36 Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Thu, 20 Dec 2018 20:29:19 -0500 Subject: [PATCH 3/3] Update docs and build scripts --- README.md | 34 ++++++++---------- package-lock.json | 87 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 8 +++-- 3 files changed, 107 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 6c1d0465..d3f01c96 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ section below. Filer also supports node's Path module. See the [Filer.Path](#FilerPath) section below. In addition, common shell operations (e.g., rm, touch, cat, etc.) are supported via the -`FileSystemShell` object, which can be obtained from, and used with a `FileSystem`. +`FileSystemShell` object, which can be used with a `FileSystem`. See the[FileSystemShell](#FileSystemShell) section below. ### API Reference @@ -113,6 +113,7 @@ you omit the callback, errors will be thrown as exceptions). The first callback reserved for passing errors. It will be `null` if no errors occurred and should always be checked. #### Support for Promises + The Promise based API mimics the way Node [implements](https://nodejs.org/api/fs.html#fs_fs_promises_api) them. Both `Shell` and `FileSystem` now have a `promises` object attached alongside the regular callback style methods. Method names are identical to their callback counterparts with the difference that instead of receiving a final argument as a callback, they return a Promise that is resolved or rejected based on the success of method execution. > Please note that `exists` method will always throw, since it was [deprecated](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) by Node. @@ -1295,34 +1296,27 @@ and provides augmented features. Many separate `FileSystemShell` objects can exi `FileSystem`, but each `FileSystemShell` is bound to a single instance of a `FileSystem` for its lifetime. -A `FileSystemShell` is created by instantiating `Filer.FileSystem().Shell`: +> NOTE: previous versions of Filer (`v0.44` and before) bundled the `Shell` with `Filer`. This is no longer done, because it added too much size to the bundle. -```javascript -var fs = new Filer.FileSystem(); -var sh = new fs.Shell(options); -var sh2 = new fs.Shell(options); -// sh and sh2 are two separate shells, each bound to fs -``` - -In addition, the constructor function can be accessed through `Filer`: +To use the `FileSystemShell`, first include the separate `shell.js` dependency. +This allows you to create new instances with `new Shell(fs, options)`: ```javascript var fs = new Filer.FileSystem(); -var sh = new fs.Shell(); - -Filer.Shell.prototype.newFunction = ...; - -sh.newFunction(); +var sh = new Shell(fs, options); +var sh2 = new Shell(fs, options); +// sh and sh2 are two separate shells, each bound to fs ``` -The `FileSystemShell` can take an optional `options` object. The `options` object -can include `env`, which is a set of environment variables. Currently supported variables +In addition to the `fs` instance, The `Shell` constructor can take an optional +`options` object. The `options` object can include `env` (an `Object`), which is +a set of environment variables. Currently supported variables include `TMP` (the path to the temporary directory), and `PATH` (the list of known paths) and others may be added in the future. You can also add your own, or update existing variables. ```javascript var fs = new Filer.FileSystem(); -var sh = new fs.Shell({ +var sh = new Shell(fs, { env: { TMP: '/tempdir', PATH: '/one:/two' @@ -1348,7 +1342,7 @@ Example: ```javascript var fs = new Filer.FileSystem(); -var sh = new fs.Shell(); +var sh = new Shell(fs); var p = sh.env.get('PATH'); // Store the current location @@ -1368,7 +1362,7 @@ examples below assume a `FileSystemShell` instance named `sh` has been created l ```javascript var fs = new Filer.FileSystem(); -var sh = new fs.Shell(); +var sh = new Shell(fs); ``` * [sh.cd(path, callback)](#cd) diff --git a/package-lock.json b/package-lock.json index c6b67575..f5fd5616 100644 --- a/package-lock.json +++ b/package-lock.json @@ -995,12 +995,30 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-filter": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", + "dev": true + }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true }, + "array-map": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", + "dev": true + }, + "array-reduce": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "dev": true + }, "array-slice": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", @@ -5533,6 +5551,12 @@ } } }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, "karma": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/karma/-/karma-3.0.0.tgz", @@ -5829,6 +5853,12 @@ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, + "memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", + "dev": true + }, "meow": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", @@ -6188,6 +6218,34 @@ "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==", "dev": true }, + "npm-run-all": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", + "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "memorystream": "^0.3.1", + "minimatch": "^3.0.4", + "pidtree": "^0.3.0", + "read-pkg": "^3.0.0", + "shell-quote": "^1.6.1", + "string.prototype.padend": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + } + } + }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -7936,6 +7994,12 @@ "integrity": "sha1-GN4vl+S/epVRrXURlCtUlverpmA=", "dev": true }, + "pidtree": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz", + "integrity": "sha512-9CT4NFlDcosssyg8KVFltgokyKZIFjoBxw8CTGy+5F38Y1eQWrt8tRayiUOXE+zVKQnYu5BR8JjCtvK3BcnBhg==", + "dev": true + }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -10013,6 +10077,18 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, + "shell-quote": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", + "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", + "dev": true, + "requires": { + "array-filter": "~0.0.0", + "array-map": "~0.0.0", + "array-reduce": "~0.0.0", + "jsonify": "~0.0.0" + } + }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", @@ -10453,6 +10529,17 @@ "regexp.prototype.flags": "^1.2.0" } }, + "string.prototype.padend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz", + "integrity": "sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.4.3", + "function-bind": "^1.0.2" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", diff --git a/package.json b/package.json index a5ac1be2..3edeca56 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,11 @@ "pretest": "npm run lint", "test": "npm run karma-mocha", "posttest": "npm run test:migrations", - "prebuild": "parcel build --global Filer src/index.js --no-minify --out-file filer.js", - "build": "parcel build --global Filer src/index.js --out-file filer.min.js --detailed-report", + "build": "npm-run-all -n build-filer build-shell", + "prebuild-filer": "parcel build --global Filer src/index.js --no-minify --out-file filer.js", + "build-filer": "parcel build --global Filer src/index.js --out-file filer.min.js --detailed-report", + "prebuild-shell": "parcel build --global Shell src/shell/index.js --no-minify --out-file shell.js", + "build-shell": "parcel build --global Shell src/shell/index.js --out-file shell.min.js --detailed-report", "build-tests": "parcel build tests/index.js --no-source-maps --out-dir tests/dist", "prekarma-mocha-firefox": "npm run build-tests", "karma-mocha-firefox": "karma start karma.conf.js --browsers FirefoxHeadless", @@ -59,6 +62,7 @@ "karma-summary-reporter": "^1.5.1", "meow": "^5.0.0", "mocha": "^5.2.0", + "npm-run-all": "^4.1.5", "nyc": "^13.1.0", "parcel-bundler": "^1.10.3", "pretty-bytes": "^5.1.0",