fix(core): update
This commit is contained in:
parent
c7b0722155
commit
8f6a4f4909
@ -3,94 +3,145 @@ image: hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .yarn/
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- mirror
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: mirror
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
security:
|
||||
snyk:
|
||||
stage: security
|
||||
script:
|
||||
- npmci command yarn global add snyk
|
||||
- npmci command yarn install --ignore-scripts
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# 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:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
image: docker:stable
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--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:
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: trigger
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: pages
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command yarn global add npmpage
|
||||
- npmci command npmpage
|
||||
- npmci command npm install -g typedoc typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
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
|
||||
|
9
.snyk
Normal file
9
.snyk
Normal file
@ -0,0 +1,9 @@
|
||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||
version: v1.12.0
|
||||
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
||||
ignore:
|
||||
'npm:chownr:20180731':
|
||||
- chokidar > fsevents > node-pre-gyp > tar > chownr:
|
||||
reason: None given
|
||||
expires: '2018-11-09T15:06:03.003Z'
|
||||
patch: {}
|
@ -1,10 +1,7 @@
|
||||
{
|
||||
"npmts": {
|
||||
"mode": "default"
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [
|
||||
"npmts"
|
||||
]
|
||||
],
|
||||
"npmAccessLevel": "public"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2652
package-lock.json
generated
Normal file
2652
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
27
package.json
27
package.json
@ -1,12 +1,14 @@
|
||||
{
|
||||
"name": "smartchok",
|
||||
"name": "@pushrocks/smartchok",
|
||||
"version": "1.0.14",
|
||||
"private": false,
|
||||
"description": "smart wrapper for chokidar",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(yarn run prepareTest && npmts)",
|
||||
"prepareTest": "(rm -f ./test/assets/hi.txt)"
|
||||
"test": "(npm run prepareTest && tstest test/)",
|
||||
"prepareTest": "(rm -f ./test/assets/hi.txt)",
|
||||
"build": "echo \"Not needed for now\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -19,16 +21,19 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^3.0.1",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"@pushrocks/smartrx": "^2.0.1",
|
||||
"@pushrocks/smartspawn": "^2.0.2",
|
||||
"@types/chokidar": "^1.7.5",
|
||||
"chokidar": "^2.0.2",
|
||||
"lik": "^2.0.5",
|
||||
"smartipc": "^1.0.11",
|
||||
"smartq": "^1.1.6",
|
||||
"smartrx": "^1.0.5"
|
||||
"chokidar": "^2.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^9.4.6",
|
||||
"smartfile": "^4.2.28",
|
||||
"tapbundle": "^2.0.0"
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tsrun": "^1.1.12",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/smartfile": "^6.0.8",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.11.6"
|
||||
}
|
||||
}
|
||||
|
60
test/test.ts
60
test/test.ts
@ -1,45 +1,45 @@
|
||||
import { tap, expect } from 'tapbundle'
|
||||
import * as smartchok from '../ts/index'
|
||||
import * as smartfile from 'smartfile'
|
||||
import * as smartq from 'smartq'
|
||||
import * as rx from 'rxjs/Rx'
|
||||
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';
|
||||
|
||||
// the module to test
|
||||
|
||||
let testSmartchok: smartchok.Smartchok
|
||||
let testAddObservable: rx.Observable<any>
|
||||
let testSubscription: rx.Subscription
|
||||
let testSmartchok: smartchok.Smartchok;
|
||||
let testAddObservable: rx.Observable<any>;
|
||||
let testSubscription: rx.Subscription;
|
||||
tap.test('should create a new instance', async () => {
|
||||
testSmartchok = new smartchok.Smartchok([])
|
||||
expect(testSmartchok).to.be.instanceof(smartchok.Smartchok)
|
||||
})
|
||||
testSmartchok = new smartchok.Smartchok([]);
|
||||
expect(testSmartchok).to.be.instanceof(smartchok.Smartchok);
|
||||
});
|
||||
|
||||
tap.test('should add some files to watch and start', async () => {
|
||||
testSmartchok.add([ './test/assets/**/*.txt' ])
|
||||
testSmartchok.add(['./test/assets/**/*.txt']);
|
||||
let localPromise = testSmartchok.start().then(async () => {
|
||||
testSmartchok.add([ './test/assets/**/*.md' ])
|
||||
})
|
||||
await expect(localPromise).to.eventually.be.fulfilled
|
||||
})
|
||||
testSmartchok.add(['./test/assets/**/*.md']);
|
||||
});
|
||||
await expect(localPromise).to.eventually.be.fulfilled;
|
||||
});
|
||||
|
||||
tap.test('should get an observable for a certain event', async () => {
|
||||
let localPromise = testSmartchok.getObservableFor('add').then(async (observableArg) => {
|
||||
testAddObservable = observableArg
|
||||
})
|
||||
await expect(localPromise).to.eventually.be.fulfilled
|
||||
})
|
||||
let localPromise = testSmartchok.getObservableFor('add').then(async observableArg => {
|
||||
testAddObservable = observableArg;
|
||||
});
|
||||
await expect(localPromise).to.eventually.be.fulfilled;
|
||||
});
|
||||
|
||||
tap.test('should register an add operation', async () => {
|
||||
let testDeferred = smartq.defer()
|
||||
let testDeferred = smartpromise.defer();
|
||||
testSubscription = testAddObservable.subscribe(x => {
|
||||
testDeferred.resolve()
|
||||
})
|
||||
smartfile.memory.toFs('HI', './test/assets/hi.txt')
|
||||
await expect(testDeferred.promise).to.eventually.be.fulfilled
|
||||
})
|
||||
testDeferred.resolve();
|
||||
});
|
||||
smartfile.memory.toFs('HI', './test/assets/hi.txt');
|
||||
await expect(testDeferred.promise).to.eventually.be.fulfilled;
|
||||
});
|
||||
|
||||
tap.test('should stop the watch process', async () => {
|
||||
testSmartchok.stop()
|
||||
})
|
||||
testSmartchok.stop();
|
||||
});
|
||||
|
||||
tap.start()
|
||||
tap.start();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './smartchok.plugins';
|
||||
import { Stringmap } from 'lik';
|
||||
import { Observablemap } from 'smartrx';
|
||||
import { Stringmap } from '@pushrocks/lik';
|
||||
import { Observablemap } from '@pushrocks/smartrx';
|
||||
|
||||
export type TSmartchokStatus = 'idle' | 'starting' | 'watching';
|
||||
export type TFsEvent =
|
||||
@ -21,7 +21,7 @@ export class Smartchok {
|
||||
chokidarOptions: plugins.chokidar.WatchOptions;
|
||||
status: TSmartchokStatus = 'idle';
|
||||
private watcher;
|
||||
private watchingDeferred = plugins.smartq.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
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@ export class Smartchok {
|
||||
* gets an observable for a certain event
|
||||
*/
|
||||
getObservableFor(fsEvent: TFsEvent): Promise<plugins.smartrx.rxjs.Observable<any>> {
|
||||
let done = plugins.smartq.defer<plugins.smartrx.rxjs.Observable<any>>();
|
||||
let done = plugins.smartpromise.defer<plugins.smartrx.rxjs.Observable<any>>();
|
||||
this.watchingDeferred.promise.then(() => {
|
||||
let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(
|
||||
this.watcher,
|
||||
@ -66,7 +66,7 @@ export class Smartchok {
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
start(): Promise<void> {
|
||||
let done = plugins.smartq.defer<void>();
|
||||
let done = plugins.smartpromise.defer<void>();
|
||||
this.status = 'starting';
|
||||
this.watcher = plugins.chokidar.watch(
|
||||
this.watchStringmap.getStringArray(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
export import lik = require('lik');
|
||||
export import lik = require('@pushrocks/lik');
|
||||
export import chokidar = require('chokidar');
|
||||
export import path = require('path');
|
||||
export import smartq = require('smartq');
|
||||
export import smartrx = require('smartrx');
|
||||
export import smartpromise = require('@pushrocks/smartpromise');
|
||||
export import smartrx = require('@pushrocks/smartrx');
|
||||
|
Loading…
Reference in New Issue
Block a user