fix(core): update

This commit is contained in:
Philipp Kunz 2021-11-29 20:26:59 +01:00
parent 55746f5d92
commit 9628e914b5
12 changed files with 26628 additions and 842 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds # builds
dist/ dist/
dist_web/ dist_*/
dist_serve/
dist_ts_web/
# custom # custom

View File

@ -1,18 +1,19 @@
# gitzone ci_default # gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
variables:
GIT_STRATEGY: clone
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
before_script:
- npm install -g @shipzone/npmci
# ==================== # ====================
# security stage # security stage
@ -21,57 +22,72 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
snyk: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install -g snyk - npmci command npm install --production --ignore-scripts
- npmci command npm install --ignore-scripts - npmci command npm config set registry https://registry.npmjs.org
- npmci command snyk test - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
- notpriv allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ==================== # ====================
# test stage # test stage
# ==================== # ====================
testLTS: testStable:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - 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
- priv
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci node install lts - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
@ -81,11 +97,15 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- lossless
- docker - docker
- priv - priv
@ -96,20 +116,20 @@ trigger:
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
pages: pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata stage: metadata
script: script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command tsdoc
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:

9
.snyk
View File

@ -1,9 +0,0 @@
# 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: {}

11
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,51 +0,0 @@
# @pushrocks/smartchok
smart wrapper for chokidar
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartchokidar)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartchok)
* [github.com (source mirror)](https://github.com/pushrocks/smartchok)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartchok/)
## Status for master
[![build status](https://gitlab.com/pushrocks/smartchok/badges/master/build.svg)](https://gitlab.com/pushrocks/smartchok/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartchok/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartchok/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartchokidar.svg)](https://www.npmjs.com/package/@pushrocks/smartchokidar)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartchokidar/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartchokidar)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
## Usage
Use TypeScript for best in class instellisense.
```javascript
import { Smartchok } from 'smartchok';
const 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 is detected
// possible events are 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw'
// note that the observable is only created once you call .start() on the Smartchok instance
// hence the promise construction
});
});
mySmartChok.stop();
```
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -4,6 +4,7 @@
"npmAccessLevel": "public" "npmAccessLevel": "public"
}, },
"gitzone": { "gitzone": {
"projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",

27075
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,8 @@
"version": "1.0.23", "version": "1.0.23",
"private": false, "private": false,
"description": "smart wrapper for chokidar", "description": "smart wrapper for chokidar",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist_ts/index.d.ts",
"scripts": { "scripts": {
"test": "(npm run prepareTest && tstest test/)", "test": "(npm run prepareTest && tstest test/)",
"prepareTest": "(rm -f ./test/assets/hi.txt)", "prepareTest": "(rm -f ./test/assets/hi.txt)",
@ -21,31 +21,35 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartchok#README", "homepage": "https://gitlab.com/pushrocks/smartchok#README",
"dependencies": { "dependencies": {
"@pushrocks/lik": "^3.0.11", "@pushrocks/lik": "^5.0.0",
"@pushrocks/smartpromise": "^3.0.5", "@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.5", "@pushrocks/smartrx": "^2.0.19",
"@types/chokidar": "^2.1.3", "@types/chokidar": "^2.1.3",
"chokidar": "^3.1.1" "chokidar": "^3.5.2"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.17", "@gitzone/tsbuild": "^2.1.28",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.18",
"@gitzone/tstest": "^1.0.24", "@gitzone/tstest": "^1.0.60",
"@pushrocks/smartfile": "^7.0.5", "@pushrocks/smartfile": "^8.0.10",
"@pushrocks/tapbundle": "^3.0.13", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^12.7.8", "@types/node": "^16.11.10",
"tslint": "^5.20.0", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"files": [ "files": [
"ts/*", "ts/**/*",
"ts_web/*", "ts_web/**/*",
"dist/*", "dist/**/*",
"dist_web/*", "dist_*/**/*",
"dist_ts_web/*", "dist_ts/**/*",
"assets/*", "dist_ts_web/**/*",
"assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"browserslist": [
"last 1 chrome versions"
] ]
} }

View File

@ -19,26 +19,23 @@ tap.test('should create a new instance', async () => {
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 () => { await testSmartchok.start()
testSmartchok.add(['./test/assets/**/*.md']); testSmartchok.add(['./test/assets/**/*.md']);
});
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 => { await testSmartchok.getObservableFor('add').then(async (observableArg) => {
testAddObservable = observableArg; testAddObservable = observableArg;
}); });
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 = smartpromise.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 testDeferred.promise;
}); });
tap.test('should stop the watch process', async () => { tap.test('should stop the watch process', async () => {

View File

@ -83,17 +83,16 @@ export class Smartchok {
/** /**
* stop the watcher process if watching * stop the watcher process if watching
*/ */
public stop() { public async stop() {
const closeWatcher = () => { const closeWatcher = async () => {
this.watcher.close(); await this.watcher.close();
}; };
if (this.status === 'watching') { if (this.status === 'watching') {
console.log('closing while watching'); console.log('closing while watching');
closeWatcher(); await closeWatcher();
} else if (this.status === 'starting') { } else if (this.status === 'starting') {
this.watchingDeferred.promise.then(() => { await this.watchingDeferred.promise;
closeWatcher(); await closeWatcher();
});
} }
} }
} }

View File

@ -1,5 +1,24 @@
export import lik = require('@pushrocks/lik'); // node native
export import chokidar = require('chokidar'); import * as path from 'path';
export import path = require('path');
export import smartpromise = require('@pushrocks/smartpromise'); export {
export import smartrx = require('@pushrocks/smartrx'); path
}
// @pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrx from '@pushrocks/smartrx';
export {
lik,
smartpromise,
smartrx
}
// thirdparty scope
import * as chokidar from 'chokidar';
export {
chokidar
}