diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index c79c126..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './smartchok.classes.smartchok'; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 3658e4f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./smartchok.classes.smartchok")); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLG1EQUE4QyJ9 \ No newline at end of file diff --git a/dist/smartchok.classes.smartchok.d.ts b/dist/smartchok.classes.smartchok.d.ts deleted file mode 100644 index 57a25c0..0000000 --- a/dist/smartchok.classes.smartchok.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as plugins from './smartchok.plugins'; -export declare type TSmartchokStatus = 'idle' | 'starting' | 'watching'; -export declare type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw'; -/** - * Smartchok allows easy wathcing of files - */ -export declare class Smartchok { - watchStringmap: plugins.lik.Stringmap; - chokidarOptions: plugins.chokidar.WatchOptions; - status: TSmartchokStatus; - private watcher; - private watchingDeferred; - private eventObservablemap; - /** - * constructor of class smartchok - */ - constructor(watchArrayArg: string[], optionsArg?: plugins.chokidar.WatchOptions); - /** - * adds files to the list of watched files - */ - add(pathArrayArg: string[]): void; - /** - * removes files from the list of watched files - */ - remove(pathArg: string): void; - /** - * gets an observable for a certain event - */ - getObservableFor(fsEvent: TFsEvent): Promise>; - /** - * starts the watcher - * @returns Promise - */ - start(): Promise; - /** - * stop the watcher process if watching - */ - stop(): void; -} diff --git a/dist/smartchok.classes.smartchok.js b/dist/smartchok.classes.smartchok.js deleted file mode 100644 index 1b0eeea..0000000 --- a/dist/smartchok.classes.smartchok.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./smartchok.plugins"); -const lik_1 = require("lik"); -/** - * Smartchok allows easy wathcing of files - */ -class Smartchok { - /** - * constructor of class smartchok - */ - constructor(watchArrayArg, optionsArg = {}) { - this.watchStringmap = new lik_1.Stringmap(); - this.status = 'idle'; - this.watchingDeferred = plugins.smartq.defer(); // used to run things when watcher is initialized - this.eventObservablemap = new plugins.smartrx.Observablemap(); // register one observable per event - this.watchStringmap.addStringArray(watchArrayArg); - this.chokidarOptions = optionsArg; - } - /** - * adds files to the list of watched files - */ - add(pathArrayArg) { - this.watchStringmap.addStringArray(pathArrayArg); - } - /** - * removes files from the list of watched files - */ - remove(pathArg) { - this.watchStringmap.removeString(pathArg); - } - /** - * gets an observable for a certain event - */ - getObservableFor(fsEvent) { - let done = plugins.smartq.defer(); - this.watchingDeferred.promise.then(() => { - let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(this.watcher, fsEvent); - done.resolve(eventObservable); - }); - return done.promise; - } - /** - * starts the watcher - * @returns Promise - */ - start() { - let done = plugins.smartq.defer(); - this.status = 'starting'; - this.watcher = plugins.chokidar.watch(this.watchStringmap.getStringArray(), this.chokidarOptions); - this.watcher.on('ready', () => { - this.status = 'watching'; - this.watchingDeferred.resolve(); - done.resolve(); - }); - return done.promise; - } - /** - * stop the watcher process if watching - */ - stop() { - let closeWatcher = () => { - this.watcher.close(); - }; - if (this.status === 'watching') { - console.log('closing while watching'); - closeWatcher(); - } - else if (this.status === 'starting') { - this.watchingDeferred.promise.then(() => { - closeWatcher(); - }); - } - } -} -exports.Smartchok = Smartchok; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjaG9rLmNsYXNzZXMuc21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FLENBQUM7UUFDdkIsQ0FBQyxDQUFDO1FBQ0YsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDO1lBQy9CLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztZQUN0QyxZQUFZLEVBQUUsQ0FBQztRQUNqQixDQUFDO1FBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxNQUFNLEtBQUssVUFBVSxDQUFDLENBQUMsQ0FBQztZQUN0QyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUU7Z0JBQ3RDLFlBQVksRUFBRSxDQUFDO1lBQ2pCLENBQUMsQ0FBQyxDQUFDO1FBQ0wsQ0FBQztJQUNILENBQUM7Q0FDRjtBQWhGRCw4QkFnRkMifQ== \ No newline at end of file diff --git a/dist/smartchok.plugins.d.ts b/dist/smartchok.plugins.d.ts deleted file mode 100644 index 35333ad..0000000 --- a/dist/smartchok.plugins.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export import lik = require('lik'); -export import chokidar = require('chokidar'); -export import path = require('path'); -export import smartq = require('smartq'); -export import smartrx = require('smartrx'); diff --git a/dist/smartchok.plugins.js b/dist/smartchok.plugins.js deleted file mode 100644 index d5730ba..0000000 --- a/dist/smartchok.plugins.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.lik = require("lik"); -exports.chokidar = require("chokidar"); -exports.path = require("path"); -exports.smartq = require("smartq"); -exports.smartrx = require("smartrx"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjaG9rLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGNob2sucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUFtQztBQUNuQyx1Q0FBNkM7QUFDN0MsK0JBQXFDO0FBQ3JDLG1DQUF5QztBQUN6QyxxQ0FBMkMifQ== \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index af98b73..ae78e81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -987,7 +987,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -1005,11 +1006,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1022,15 +1025,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -1133,7 +1139,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -1143,6 +1150,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1155,17 +1163,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -1182,6 +1193,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -1254,7 +1266,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -1264,6 +1277,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -1339,7 +1353,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -1369,6 +1384,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -1386,6 +1402,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -1424,11 +1441,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, diff --git a/package.json b/package.json index 4537885..5bba79b 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "test": "(npm run prepareTest && tstest test/)", "prepareTest": "(rm -f ./test/assets/hi.txt)", - "build": "echo \"Not needed for now\"" + "build": "tsbuild" }, "repository": { "type": "git", diff --git a/test/test.ts b/test/test.ts index 79708a2..d67f098 100644 --- a/test/test.ts +++ b/test/test.ts @@ -2,13 +2,13 @@ import { tap, expect } from '@pushrocks/tapbundle'; import * as smartchok from '../ts/index'; import * as smartfile from '@pushrocks/smartfile'; import * as smartpromise from '@pushrocks/smartpromise'; -import * as rx from 'rxjs/Rx'; +import * as smartrx from '@pushrocks/smartrx'; // the module to test let testSmartchok: smartchok.Smartchok; -let testAddObservable: rx.Observable; -let testSubscription: rx.Subscription; +let testAddObservable: smartrx.rxjs.Observable; +let testSubscription: smartrx.rxjs.Subscription; tap.test('should create a new instance', async () => { testSmartchok = new smartchok.Smartchok([]); expect(testSmartchok).to.be.instanceof(smartchok.Smartchok);