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
dist/
dist_web/
dist_serve/
dist_ts_web/
dist_*/
# custom

View File

@ -1,18 +1,19 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
variables:
GIT_STRATEGY: clone
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
@ -21,57 +22,72 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
snyk:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- 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
# ====================
testLTS:
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- priv
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
script:
- npmci node install lts
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
@ -81,11 +97,15 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
@ -96,20 +116,20 @@ trigger:
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
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"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"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",
"private": false,
"description": "smart wrapper for chokidar",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"test": "(npm run prepareTest && tstest test/)",
"prepareTest": "(rm -f ./test/assets/hi.txt)",
@ -21,31 +21,35 @@
},
"homepage": "https://gitlab.com/pushrocks/smartchok#README",
"dependencies": {
"@pushrocks/lik": "^3.0.11",
"@pushrocks/smartpromise": "^3.0.5",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/lik": "^5.0.0",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.19",
"@types/chokidar": "^2.1.3",
"chokidar": "^3.1.1"
"chokidar": "^3.5.2"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/smartfile": "^7.0.5",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.8",
"tslint": "^5.20.0",
"@gitzone/tsbuild": "^2.1.28",
"@gitzone/tsrun": "^1.2.18",
"@gitzone/tstest": "^1.0.60",
"@pushrocks/smartfile": "^8.0.10",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^16.11.10",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"dist_ts_web/*",
"assets/*",
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"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 () => {
testSmartchok.add(['./test/assets/**/*.txt']);
let localPromise = testSmartchok.start().then(async () => {
await testSmartchok.start()
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 => {
await 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 = smartpromise.defer();
testSubscription = testAddObservable.subscribe(x => {
testSubscription = testAddObservable.subscribe((x) => {
testDeferred.resolve();
});
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 () => {

View File

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

View File

@ -1,5 +1,24 @@
export import lik = require('@pushrocks/lik');
export import chokidar = require('chokidar');
export import path = require('path');
export import smartpromise = require('@pushrocks/smartpromise');
export import smartrx = require('@pushrocks/smartrx');
// node native
import * as path from 'path';
export {
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
}