Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
55746f5d92 | |||
90ae869686 | |||
771c454411 | |||
99395794d8 | |||
1763ede6df | |||
102b6ac9ae | |||
cd9ca458f6 | |||
2c4fc8b212 | |||
ce48b6f889 | |||
2e851cbabc | |||
4c001f5270 | |||
dfbbe8090f |
24
.gitignore
vendored
24
.gitignore
vendored
@ -1,4 +1,22 @@
|
|||||||
node_modules/
|
.nogit/
|
||||||
pages/
|
|
||||||
public/
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
|
public/
|
||||||
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_web/
|
||||||
|
dist_serve/
|
||||||
|
dist_ts_web/
|
||||||
|
|
||||||
|
# custom
|
@ -1,5 +1,7 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
variables:
|
||||||
|
GIT_STRATEGY: clone
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
@ -37,18 +39,6 @@ snyk:
|
|||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
# ====================
|
# ====================
|
||||||
testLEGACY:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install legacy
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
@ -60,15 +50,15 @@ testLTS:
|
|||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- priv
|
||||||
|
|
||||||
testSTABLE:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci node install stable
|
- npmci node install lts
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
@ -77,7 +67,7 @@ testSTABLE:
|
|||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci node install lts
|
||||||
- npmci npm publish
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
@ -90,19 +80,11 @@ release:
|
|||||||
# ====================
|
# ====================
|
||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
image: docker:stable
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
script:
|
script:
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- npmci command npm install -g tslint typescript
|
||||||
- docker run
|
- npmci npm install
|
||||||
--env SOURCE_CODE="$PWD"
|
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||||
--volume "$PWD":/code
|
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
|
||||||
artifacts:
|
|
||||||
paths: [codeclimate.json]
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- priv
|
- priv
|
||||||
@ -118,13 +100,15 @@ trigger:
|
|||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-dbase:npmci
|
||||||
|
services:
|
||||||
|
- docker:18-dind
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g typedoc typescript
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
- npmci command tsdoc
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
@ -135,13 +119,3 @@ pages:
|
|||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
windowsCompatibility:
|
|
||||||
image: stefanscherer/node-windows:10-build-tools
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npm install & npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- windows
|
|
||||||
allow_failure: true
|
|
||||||
|
39
README.md
39
README.md
@ -1,25 +1,20 @@
|
|||||||
# smartchok
|
# @pushrocks/smartchok
|
||||||
|
|
||||||
smart wrapper for chokidar
|
smart wrapper for chokidar
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartchokidar)
|
||||||
[](https://www.npmjs.com/package/smartchok)
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartchok)
|
||||||
[](https://GitLab.com/pushrocks/smartchok)
|
* [github.com (source mirror)](https://github.com/pushrocks/smartchok)
|
||||||
[](https://github.com/pushrocks/smartchok)
|
* [docs (typedoc)](https://pushrocks.gitlab.io/smartchok/)
|
||||||
[](https://pushrocks.gitlab.io/smartchok/)
|
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
[](https://gitlab.com/pushrocks/smartchok/commits/master)
|
||||||
[](https://GitLab.com/pushrocks/smartchok/commits/master)
|
[](https://gitlab.com/pushrocks/smartchok/commits/master)
|
||||||
[](https://GitLab.com/pushrocks/smartchok/commits/master)
|
[](https://www.npmjs.com/package/@pushrocks/smartchokidar)
|
||||||
[](https://www.npmjs.com/package/smartchok)
|
[](https://snyk.io/test/npm/@pushrocks/smartchokidar)
|
||||||
[](https://david-dm.org/pushrocks/smartchok)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartchok/master/dependencies/npm)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartchok)
|
[](https://prettier.io/)
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -28,7 +23,7 @@ Use TypeScript for best in class instellisense.
|
|||||||
```javascript
|
```javascript
|
||||||
import { Smartchok } from 'smartchok';
|
import { Smartchok } from 'smartchok';
|
||||||
|
|
||||||
let mySmartChok = new Smartchok(['some/path/**/*.any', '/absolute/*.js'], chokidarOptions);
|
const mySmartChok = new Smartchok(['some/path/**/*.any', '/absolute/*.js'], chokidarOptions);
|
||||||
|
|
||||||
mySmartChok.add(['/some/**/*.any']); // add files
|
mySmartChok.add(['/some/**/*.any']); // add files
|
||||||
|
|
||||||
@ -48,9 +43,9 @@ mySmartChok.getObservableFor('change').then(observableArg => {
|
|||||||
mySmartChok.stop();
|
mySmartChok.stop();
|
||||||
```
|
```
|
||||||
|
|
||||||
For further information read the linked docs at the top of this README.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
[](https://push.rocks)
|
[](https://maintainedby.lossless.com)
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [
|
"npmGlobalTools": [],
|
||||||
],
|
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "smartchok",
|
||||||
|
"shortDescription": "smart wrapper for chokidar",
|
||||||
|
"npmPackagename": "@pushrocks/smartchokidar",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1151
package-lock.json
generated
1151
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartchok",
|
"name": "@pushrocks/smartchok",
|
||||||
"version": "1.0.17",
|
"version": "1.0.23",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "smart wrapper for chokidar",
|
"description": "smart wrapper for chokidar",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -21,19 +21,31 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
|
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^3.0.5",
|
"@pushrocks/lik": "^3.0.11",
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.5",
|
||||||
"@pushrocks/smartrx": "^2.0.3",
|
"@pushrocks/smartrx": "^2.0.5",
|
||||||
"@pushrocks/smartspawn": "^2.0.4",
|
|
||||||
"@types/chokidar": "^2.1.3",
|
"@types/chokidar": "^2.1.3",
|
||||||
"chokidar": "^3.0.0"
|
"chokidar": "^3.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.11",
|
"@gitzone/tsbuild": "^2.1.17",
|
||||||
"@gitzone/tsrun": "^1.2.6",
|
"@gitzone/tsrun": "^1.2.8",
|
||||||
"@gitzone/tstest": "^1.0.20",
|
"@gitzone/tstest": "^1.0.24",
|
||||||
"@pushrocks/smartfile": "^7.0.2",
|
"@pushrocks/smartfile": "^7.0.5",
|
||||||
"@pushrocks/tapbundle": "^3.0.9",
|
"@pushrocks/tapbundle": "^3.0.13",
|
||||||
"@types/node": "^12.0.0"
|
"@types/node": "^12.7.8",
|
||||||
}
|
"tslint": "^5.20.0",
|
||||||
|
"tslint-config-prettier": "^1.18.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/*",
|
||||||
|
"ts_web/*",
|
||||||
|
"dist/*",
|
||||||
|
"dist_web/*",
|
||||||
|
"dist_ts_web/*",
|
||||||
|
"assets/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,9 @@ import * as smartpromise from '@pushrocks/smartpromise';
|
|||||||
import * as smartrx from '@pushrocks/smartrx';
|
import * as smartrx from '@pushrocks/smartrx';
|
||||||
|
|
||||||
// the module to test
|
// the module to test
|
||||||
|
if (process.env.CI) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
let testSmartchok: smartchok.Smartchok;
|
let testSmartchok: smartchok.Smartchok;
|
||||||
let testAddObservable: smartrx.rxjs.Observable<any>;
|
let testAddObservable: smartrx.rxjs.Observable<any>;
|
||||||
|
@ -17,10 +17,10 @@ export type TFsEvent =
|
|||||||
* Smartchok allows easy wathcing of files
|
* Smartchok allows easy wathcing of files
|
||||||
*/
|
*/
|
||||||
export class Smartchok {
|
export class Smartchok {
|
||||||
watchStringmap = new Stringmap();
|
public watchStringmap = new Stringmap();
|
||||||
chokidarOptions: plugins.chokidar.WatchOptions;
|
public chokidarOptions: plugins.chokidar.WatchOptions;
|
||||||
status: TSmartchokStatus = 'idle';
|
public status: TSmartchokStatus = 'idle';
|
||||||
private watcher;
|
private watcher: plugins.chokidar.FSWatcher;
|
||||||
private watchingDeferred = plugins.smartpromise.defer<void>(); // used to run things when watcher is initialized
|
private watchingDeferred = plugins.smartpromise.defer<void>(); // used to run things when watcher is initialized
|
||||||
private eventObservablemap = new plugins.smartrx.Observablemap(); // register one observable per event
|
private eventObservablemap = new plugins.smartrx.Observablemap(); // register one observable per event
|
||||||
|
|
||||||
@ -35,24 +35,24 @@ export class Smartchok {
|
|||||||
/**
|
/**
|
||||||
* adds files to the list of watched files
|
* adds files to the list of watched files
|
||||||
*/
|
*/
|
||||||
add(pathArrayArg: string[]) {
|
public add(pathArrayArg: string[]) {
|
||||||
this.watchStringmap.addStringArray(pathArrayArg);
|
this.watchStringmap.addStringArray(pathArrayArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes files from the list of watched files
|
* removes files from the list of watched files
|
||||||
*/
|
*/
|
||||||
remove(pathArg: string) {
|
public remove(pathArg: string) {
|
||||||
this.watchStringmap.removeString(pathArg);
|
this.watchStringmap.removeString(pathArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets an observable for a certain event
|
* gets an observable for a certain event
|
||||||
*/
|
*/
|
||||||
getObservableFor(fsEvent: TFsEvent): Promise<plugins.smartrx.rxjs.Observable<any>> {
|
public getObservableFor(fsEvent: TFsEvent): Promise<plugins.smartrx.rxjs.Observable<any>> {
|
||||||
let done = plugins.smartpromise.defer<plugins.smartrx.rxjs.Observable<any>>();
|
const done = plugins.smartpromise.defer<plugins.smartrx.rxjs.Observable<any>>();
|
||||||
this.watchingDeferred.promise.then(() => {
|
this.watchingDeferred.promise.then(() => {
|
||||||
let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(
|
const eventObservable = this.eventObservablemap.getObservableForEmitterEvent(
|
||||||
this.watcher,
|
this.watcher,
|
||||||
fsEvent
|
fsEvent
|
||||||
);
|
);
|
||||||
@ -65,8 +65,8 @@ export class Smartchok {
|
|||||||
* starts the watcher
|
* starts the watcher
|
||||||
* @returns Promise<void>
|
* @returns Promise<void>
|
||||||
*/
|
*/
|
||||||
start(): Promise<void> {
|
public start(): Promise<void> {
|
||||||
let done = plugins.smartpromise.defer<void>();
|
const done = plugins.smartpromise.defer<void>();
|
||||||
this.status = 'starting';
|
this.status = 'starting';
|
||||||
this.watcher = plugins.chokidar.watch(
|
this.watcher = plugins.chokidar.watch(
|
||||||
this.watchStringmap.getStringArray(),
|
this.watchStringmap.getStringArray(),
|
||||||
@ -83,8 +83,8 @@ export class Smartchok {
|
|||||||
/**
|
/**
|
||||||
* stop the watcher process if watching
|
* stop the watcher process if watching
|
||||||
*/
|
*/
|
||||||
stop() {
|
public stop() {
|
||||||
let closeWatcher = () => {
|
const closeWatcher = () => {
|
||||||
this.watcher.close();
|
this.watcher.close();
|
||||||
};
|
};
|
||||||
if (this.status === 'watching') {
|
if (this.status === 'watching') {
|
||||||
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user