fix(core): update

This commit is contained in:
Philipp Kunz 2018-10-10 17:06:40 +02:00
parent c7b0722155
commit 8f6a4f4909
9 changed files with 2782 additions and 1921 deletions

View File

@ -3,94 +3,145 @@ image: hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .yarn/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: "$CI_BUILD_STAGE"
stages: stages:
- mirror
- security - security
- test - test
- release - release
- trigger - metadata
- pages
# ====================
# security stage
# ====================
mirror: mirror:
stage: mirror stage: security
script: script:
- npmci git mirror - npmci git mirror
tags: tags:
- docker - docker
- notpriv
security: snyk:
stage: security stage: security
script: script:
- npmci command yarn global add snyk - npmci npm prepare
- npmci command yarn install --ignore-scripts - npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command snyk test
tags: tags:
- docker - docker
- notpriv
# ====================
# test stage
# ====================
testLEGACY: testLEGACY:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install legacy - npmci node install legacy
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
allow_failure: true allow_failure: true
testLTS: testLTS:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install lts - npmci node install lts
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
testSTABLE: testSTABLE:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci npm prepare - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - 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: trigger:
stage: trigger stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stage: pages stage: metadata
script: script:
- npmci command yarn global add npmpage - npmci command npm install -g typedoc typescript
- npmci command npmpage - npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags: tags:
- docker - docker
- notpriv
only: only:
- tags - tags
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - 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
View 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: {}

View File

@ -1,10 +1,7 @@
{ {
"npmts": {
"mode": "default"
},
"npmci": { "npmci": {
"npmGlobalTools": [ "npmGlobalTools": [
"npmts" ],
] "npmAccessLevel": "public"
} }
} }

2652
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,14 @@
{ {
"name": "smartchok", "name": "@pushrocks/smartchok",
"version": "1.0.14", "version": "1.0.14",
"private": false,
"description": "smart wrapper for chokidar", "description": "smart wrapper for chokidar",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "(yarn run prepareTest && npmts)", "test": "(npm run prepareTest && tstest test/)",
"prepareTest": "(rm -f ./test/assets/hi.txt)" "prepareTest": "(rm -f ./test/assets/hi.txt)",
"build": "echo \"Not needed for now\""
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -19,16 +21,19 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartchok#README", "homepage": "https://gitlab.com/pushrocks/smartchok#README",
"dependencies": { "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", "@types/chokidar": "^1.7.5",
"chokidar": "^2.0.2", "chokidar": "^2.0.4"
"lik": "^2.0.5",
"smartipc": "^1.0.11",
"smartq": "^1.1.6",
"smartrx": "^1.0.5"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^9.4.6", "@gitzone/tsbuild": "^2.0.22",
"smartfile": "^4.2.28", "@gitzone/tsrun": "^1.1.12",
"tapbundle": "^2.0.0" "@gitzone/tstest": "^1.0.15",
"@pushrocks/smartfile": "^6.0.8",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.11.6"
} }
} }

View File

@ -1,45 +1,45 @@
import { tap, expect } from 'tapbundle' import { tap, expect } from '@pushrocks/tapbundle';
import * as smartchok from '../ts/index' import * as smartchok from '../ts/index';
import * as smartfile from 'smartfile' import * as smartfile from '@pushrocks/smartfile';
import * as smartq from 'smartq' import * as smartpromise from '@pushrocks/smartpromise';
import * as rx from 'rxjs/Rx' import * as rx from 'rxjs/Rx';
// the module to test // the module to test
let testSmartchok: smartchok.Smartchok let testSmartchok: smartchok.Smartchok;
let testAddObservable: rx.Observable<any> let testAddObservable: rx.Observable<any>;
let testSubscription: rx.Subscription let testSubscription: rx.Subscription;
tap.test('should create a new instance', async () => { tap.test('should create a new instance', async () => {
testSmartchok = new smartchok.Smartchok([]) testSmartchok = new smartchok.Smartchok([]);
expect(testSmartchok).to.be.instanceof(smartchok.Smartchok) expect(testSmartchok).to.be.instanceof(smartchok.Smartchok);
}) });
tap.test('should add some files to watch and start', async () => { 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 () => { let localPromise = testSmartchok.start().then(async () => {
testSmartchok.add([ './test/assets/**/*.md' ]) testSmartchok.add(['./test/assets/**/*.md']);
}) });
await expect(localPromise).to.eventually.be.fulfilled await expect(localPromise).to.eventually.be.fulfilled;
}) });
tap.test('should get an observable for a certain event', async () => { tap.test('should get an observable for a certain event', async () => {
let localPromise = testSmartchok.getObservableFor('add').then(async (observableArg) => { let localPromise = testSmartchok.getObservableFor('add').then(async observableArg => {
testAddObservable = observableArg testAddObservable = observableArg;
}) });
await expect(localPromise).to.eventually.be.fulfilled await expect(localPromise).to.eventually.be.fulfilled;
}) });
tap.test('should register an add operation', async () => { tap.test('should register an add operation', async () => {
let testDeferred = smartq.defer() let testDeferred = smartpromise.defer();
testSubscription = testAddObservable.subscribe(x => { testSubscription = testAddObservable.subscribe(x => {
testDeferred.resolve() testDeferred.resolve();
}) });
smartfile.memory.toFs('HI', './test/assets/hi.txt') smartfile.memory.toFs('HI', './test/assets/hi.txt');
await expect(testDeferred.promise).to.eventually.be.fulfilled await expect(testDeferred.promise).to.eventually.be.fulfilled;
}) });
tap.test('should stop the watch process', async () => { tap.test('should stop the watch process', async () => {
testSmartchok.stop() testSmartchok.stop();
}) });
tap.start() tap.start();

View File

@ -1,6 +1,6 @@
import * as plugins from './smartchok.plugins'; import * as plugins from './smartchok.plugins';
import { Stringmap } from 'lik'; import { Stringmap } from '@pushrocks/lik';
import { Observablemap } from 'smartrx'; import { Observablemap } from '@pushrocks/smartrx';
export type TSmartchokStatus = 'idle' | 'starting' | 'watching'; export type TSmartchokStatus = 'idle' | 'starting' | 'watching';
export type TFsEvent = export type TFsEvent =
@ -21,7 +21,7 @@ export class Smartchok {
chokidarOptions: plugins.chokidar.WatchOptions; chokidarOptions: plugins.chokidar.WatchOptions;
status: TSmartchokStatus = 'idle'; status: TSmartchokStatus = 'idle';
private watcher; 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 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 * gets an observable for a certain event
*/ */
getObservableFor(fsEvent: TFsEvent): Promise<plugins.smartrx.rxjs.Observable<any>> { 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(() => { this.watchingDeferred.promise.then(() => {
let eventObservable = this.eventObservablemap.getObservableForEmitterEvent( let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(
this.watcher, this.watcher,
@ -66,7 +66,7 @@ export class Smartchok {
* @returns Promise<void> * @returns Promise<void>
*/ */
start(): Promise<void> { start(): Promise<void> {
let done = plugins.smartq.defer<void>(); let 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(),

View File

@ -1,5 +1,5 @@
export import lik = require('lik'); export import lik = require('@pushrocks/lik');
export import chokidar = require('chokidar'); export import chokidar = require('chokidar');
export import path = require('path'); export import path = require('path');
export import smartq = require('smartq'); export import smartpromise = require('@pushrocks/smartpromise');
export import smartrx = require('smartrx'); export import smartrx = require('@pushrocks/smartrx');

1853
yarn.lock

File diff suppressed because it is too large Load Diff