add README
This commit is contained in:
parent
40f1e2c938
commit
396853f7c4
45
README.md
Normal file
45
README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# smartchok
|
||||||
|
smart wrapper for chokidar
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmts)
|
||||||
|
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/npmts)
|
||||||
|
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmts)
|
||||||
|
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmts/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[![build status](https://gitlab.com/pushrocks/npmts/badges/master/build.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
|
||||||
|
[![coverage report](https://gitlab.com/pushrocks/npmts/badges/master/coverage.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
|
||||||
|
[![Dependency Status](https://david-dm.org/pushrocks/npmts.svg)](https://david-dm.org/pushrocks/npmts)
|
||||||
|
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmts/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
|
||||||
|
[![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts)
|
||||||
|
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
We recommend the use of TypeScript for best in class Intellisense
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { Smartchok } from 'smartchok'
|
||||||
|
|
||||||
|
let mySmartChok = new Smartchok(['some/path/**/*.any','/absolute/*.js'], chokidarOptions)
|
||||||
|
|
||||||
|
mySmartChok.add(['/some/**/*.any']) // add files
|
||||||
|
|
||||||
|
mySmartChok.remove('some/**/*.js')
|
||||||
|
|
||||||
|
mySmartChok.start() // starts the watch process
|
||||||
|
|
||||||
|
mySmartChok.getObservableFor('change').then((observableArg) => {
|
||||||
|
observableArg.subscribe(x => {
|
||||||
|
// do something here when a change detected
|
||||||
|
// note that the observable is only created once you call .start() on the Smartchok instance
|
||||||
|
// hence the promise construction
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
mySmartChok.stop()
|
||||||
|
```
|
||||||
|
|
||||||
|
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -73,4 +73,4 @@ class Smartchok {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Smartchok = Smartchok;
|
exports.Smartchok = Smartchok;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0NBQThDO0FBQzlDLDZCQUErQjtBQUsvQjtJQVFJLFlBQVksYUFBdUIsRUFBRSxVQUFVLEdBQWtDLEVBQUU7UUFQbkYsbUJBQWMsR0FBRyxJQUFJLGVBQVMsRUFBRSxDQUFBO1FBRWhDLFdBQU0sR0FBcUIsTUFBTSxDQUFBO1FBRXpCLHFCQUFnQixHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFRLENBQUEsQ0FBQyxpREFBaUQ7UUFDNUYsdUJBQWtCLEdBQUcsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWEsRUFBRSxDQUFBLENBQUMsb0NBQW9DO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ixDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxZQUFZLEVBQUUsQ0FBQSxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQ2hFLENBQUM7SUFDTCxDQUFDO0NBQ0o7QUE5RUQsOEJBOEVDIn0=
|
12
package.json
12
package.json
@ -20,17 +20,17 @@
|
|||||||
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
|
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/chokidar": "^1.4.29",
|
"@types/chokidar": "^1.4.29",
|
||||||
"@types/q": "0.0.31",
|
"@types/q": "x.x.x",
|
||||||
"chokidar": "^1.6.0",
|
"chokidar": "^1.6.1",
|
||||||
"lik": "^1.0.20",
|
"lik": "^1.0.24",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"rxjs": "^5.0.0-beta.12",
|
"rxjs": "^5.0.0-rc.3",
|
||||||
"typings-global": "^1.0.14"
|
"typings-global": "^1.0.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/should": "^8.1.30",
|
"@types/should": "^8.1.30",
|
||||||
"should": "^11.1.0",
|
"should": "^11.1.1",
|
||||||
"smartfile": "^4.0.20",
|
"smartfile": "^4.1.0",
|
||||||
"typings-test": "^1.0.3"
|
"typings-test": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,10 @@ describe('smartchok', function () {
|
|||||||
});
|
});
|
||||||
it('should add some files to watch and start', function (done) {
|
it('should add some files to watch and start', function (done) {
|
||||||
testSmartchok.add(['./test/assets/**/*.txt']);
|
testSmartchok.add(['./test/assets/**/*.txt']);
|
||||||
testSmartchok.start().then(() => { done(); }).catch(err => { console.log(err); });
|
testSmartchok.start().then(() => {
|
||||||
|
testSmartchok.add(['./test/assets/**/*.md']);
|
||||||
|
done();
|
||||||
|
}).catch(err => { console.log(err); });
|
||||||
});
|
});
|
||||||
it('should get an observable for a certain event', function (done) {
|
it('should get an observable for a certain event', function (done) {
|
||||||
testSmartchok.getObservableFor('add').then((observableArg) => {
|
testSmartchok.getObservableFor('add').then((observableArg) => {
|
||||||
@ -32,4 +35,4 @@ describe('smartchok', function () {
|
|||||||
testSmartchok.stop();
|
testSmartchok.stop();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFDaEMsdUNBQXNDO0FBRXRDLDJDQUEwQztBQUUxQyxRQUFRLENBQUMsV0FBVyxFQUFDO0lBQ2pCLElBQUksYUFBa0MsQ0FBQTtJQUN0QyxJQUFJLGlCQUFxQyxDQUFBO0lBQ3pDLElBQUksZ0JBQWlDLENBQUE7SUFDckMsRUFBRSxDQUFDLDhCQUE4QixFQUFDO1FBQzlCLGFBQWEsR0FBRyxJQUFJLFNBQVMsQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLENBQUE7UUFDM0MsTUFBTSxDQUFDLGFBQWEsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBQzVELENBQUMsQ0FBQyxDQUFBO0lBQ0YsRUFBRSxDQUFDLDBDQUEwQyxFQUFDLFVBQVMsSUFBSTtRQUN2RCxhQUFhLENBQUMsR0FBRyxDQUFDLENBQUMsd0JBQXdCLENBQUMsQ0FBQyxDQUFBO1FBQzdDLGFBQWEsQ0FBQyxLQUFLLEVBQUUsQ0FBQyxJQUFJLENBQUMsUUFBUSxJQUFJLEVBQUUsQ0FBQSxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxHQUFHLE1B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tZQUNyRCxpQkFBaUIsR0FBRyxhQUFhLENBQUE7WUFDakMsSUFBSSxFQUFFLENBQUE7UUFDVixDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsR0FBRyxNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUEsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUN6QyxDQUFDLENBQUMsQ0FBQTtJQUNGLEVBQUUsQ0FBQyxrQ0FBa0MsRUFBQyxVQUFTLElBQUk7UUFDL0MsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUNsQixnQkFBZ0IsR0FBRyxpQkFBaUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztZQUM1QyxJQUFJLEVBQUUsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO1FBQ0YsU0FBUyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFDLHNCQUFzQixDQUFDLENBQUE7SUFDdEQsQ0FBQyxDQUFDLENBQUE7SUFDRixFQUFFLENBQUMsK0JBQStCLEVBQUM7UUFDL0IsYUFBYSxDQUFDLElBQUksRUFBRSxDQUFBO0lBQ3hCLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==
|
@ -14,7 +14,10 @@ describe('smartchok',function(){
|
|||||||
})
|
})
|
||||||
it('should add some files to watch and start',function(done){
|
it('should add some files to watch and start',function(done){
|
||||||
testSmartchok.add(['./test/assets/**/*.txt'])
|
testSmartchok.add(['./test/assets/**/*.txt'])
|
||||||
testSmartchok.start().then(() => { done() }).catch(err => { console.log(err) })
|
testSmartchok.start().then(() => {
|
||||||
|
testSmartchok.add(['./test/assets/**/*.md'])
|
||||||
|
done()
|
||||||
|
}).catch(err => { console.log(err) })
|
||||||
})
|
})
|
||||||
it('should get an observable for a certain event',function(done){
|
it('should get an observable for a certain event',function(done){
|
||||||
testSmartchok.getObservableFor('add').then((observableArg) => {
|
testSmartchok.getObservableFor('add').then((observableArg) => {
|
||||||
|
@ -4,6 +4,9 @@ import { Stringmap } from 'lik'
|
|||||||
export type TSmartchokStatus = 'idle' | 'starting' | 'watching'
|
export type TSmartchokStatus = 'idle' | 'starting' | 'watching'
|
||||||
export type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw'
|
export type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smartchok allows easy wathcing of files
|
||||||
|
*/
|
||||||
export class Smartchok {
|
export class Smartchok {
|
||||||
watchStringmap = new Stringmap()
|
watchStringmap = new Stringmap()
|
||||||
chokidarOptions: plugins.chokidar.WatchOptions
|
chokidarOptions: plugins.chokidar.WatchOptions
|
||||||
@ -12,6 +15,9 @@ export class Smartchok {
|
|||||||
private watchingDeferred = plugins.q.defer<void>() // used to run things when watcher is initialized
|
private watchingDeferred = plugins.q.defer<void>() // used to run things when watcher is initialized
|
||||||
private eventObservablemap = new plugins.lik.Observablemap() // register one observable per event
|
private eventObservablemap = new plugins.lik.Observablemap() // register one observable per event
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor of class smartchok
|
||||||
|
*/
|
||||||
constructor(watchArrayArg: string[], optionsArg: plugins.chokidar.WatchOptions = {}) {
|
constructor(watchArrayArg: string[], optionsArg: plugins.chokidar.WatchOptions = {}) {
|
||||||
this.watchStringmap.addStringArray(watchArrayArg)
|
this.watchStringmap.addStringArray(watchArrayArg)
|
||||||
this.chokidarOptions = optionsArg
|
this.chokidarOptions = optionsArg
|
||||||
|
Loading…
Reference in New Issue
Block a user