BREAKING CHANGE(core): switch to esm
This commit is contained in:
parent
01f4a53b5b
commit
e562e8f099
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,4 +1,20 @@
|
|||||||
node_modules/
|
.nogit/
|
||||||
|
|
||||||
|
# artifacts
|
||||||
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
coverage/
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_*/
|
||||||
|
|
||||||
|
# custom
|
148
.gitlab-ci.yml
148
.gitlab-ci.yml
@ -1,16 +1,19 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
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
|
||||||
@ -18,127 +21,114 @@ stages:
|
|||||||
mirror:
|
mirror:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- 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
|
|
||||||
|
|
||||||
sast:
|
|
||||||
stage: security
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci
|
|
||||||
variables:
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
auditDevDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command npm run build
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- npmci command npm audit --audit-level=high --only=dev
|
||||||
- docker run
|
|
||||||
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
|
|
||||||
--volume "$PWD:/code"
|
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
|
|
||||||
artifacts:
|
|
||||||
reports:
|
|
||||||
sast: gl-sast-report.json
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- priv
|
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
|
||||||
- notpriv
|
|
||||||
|
testBuild:
|
||||||
testSTABLE:
|
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- 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
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm publish
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# metadata stage
|
# metadata stage
|
||||||
# ====================
|
# ====================
|
||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
image: docker:stable
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
services:
|
only:
|
||||||
- docker:stable-dind
|
- tags
|
||||||
script:
|
script:
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- npmci command npm install -g typescript
|
||||||
- docker run
|
- npmci npm prepare
|
||||||
--env SOURCE_CODE="$PWD"
|
- npmci npm install
|
||||||
--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
|
- lossless
|
||||||
- priv
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- lossless
|
||||||
- notpriv
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g typedoc typescript
|
- npmci node install lts
|
||||||
|
- 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:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
only:
|
only:
|
||||||
@ -146,5 +136,5 @@ pages:
|
|||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal 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
26
.vscode/settings.json
vendored
Normal 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"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
43
README.md
43
README.md
@ -1,43 +0,0 @@
|
|||||||
# @pushrocks/smartstream
|
|
||||||
simplifies access to node streams
|
|
||||||
|
|
||||||
## Availabililty and Links
|
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartstream)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartstream)
|
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartstream)
|
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartstream/)
|
|
||||||
|
|
||||||
## Status for master
|
|
||||||
[![build status](https://gitlab.com/pushrocks/smartstream/badges/master/build.svg)](https://gitlab.com/pushrocks/smartstream/commits/master)
|
|
||||||
[![coverage report](https://gitlab.com/pushrocks/smartstream/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartstream/commits/master)
|
|
||||||
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartstream.svg)](https://www.npmjs.com/package/@pushrocks/smartstream)
|
|
||||||
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartstream/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartstream)
|
|
||||||
[![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-standard-brightgreen.svg)](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { Smartstream } from 'smartstream'
|
|
||||||
import * as gUglify from 'gulp-uglify'
|
|
||||||
|
|
||||||
let mySmartstream = new Smartstream([
|
|
||||||
gulp.src(['./file1.js','./file2.js']),
|
|
||||||
gUglify(),
|
|
||||||
gulp.dest('./some/output/path')
|
|
||||||
])
|
|
||||||
|
|
||||||
mySmartstream.onError((err) => { /* handle error */ }) // handles all errors in stream
|
|
||||||
myStream.onCustomEvent('myeventname', (args...) => { /* Do something */ }) // emit an custom event anywhere in your stream
|
|
||||||
mySmartstream.run().then(() => {/* do something when stream is finished */})
|
|
||||||
```
|
|
||||||
|
|
||||||
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.html)
|
|
||||||
|
|
||||||
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
|
|
@ -4,11 +4,12 @@
|
|||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
},
|
},
|
||||||
"gitzone": {
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "pushrocks",
|
||||||
"gitrepo": "smartstream",
|
"gitrepo": "smartstream",
|
||||||
"shortDescription": "simplifies access to node streams",
|
"description": "simplifies access to node streams",
|
||||||
"npmPackagename": "@pushrocks/smartstream",
|
"npmPackagename": "@pushrocks/smartstream",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
18320
package-lock.json
generated
18320
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
@ -3,8 +3,9 @@
|
|||||||
"version": "1.0.14",
|
"version": "1.0.14",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "simplifies access to node streams",
|
"description": "simplifies access to node streams",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)"
|
"build": "(tsbuild)"
|
||||||
@ -20,15 +21,30 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartstream#README",
|
"homepage": "https://gitlab.com/pushrocks/smartstream#README",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.8",
|
"@gitzone/tsbuild": "^2.1.61",
|
||||||
"@gitzone/tstest": "^1.0.18",
|
"@gitzone/tstest": "^1.0.70",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^5.0.3",
|
||||||
"tslint": "^5.12.1",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^3.1.7",
|
||||||
"@types/through2": "^2.0.34",
|
"@types/through2": "^2.0.36",
|
||||||
"through2": "^3.0.0"
|
"through2": "^4.0.2"
|
||||||
}
|
},
|
||||||
}
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"ts/**/*",
|
||||||
|
"ts_web/**/*",
|
||||||
|
"dist/**/*",
|
||||||
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
|
}
|
@ -1,13 +1,13 @@
|
|||||||
import fs = require('fs');
|
import fs from 'fs';
|
||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
import * as smartstream from '../ts/index';
|
import * as smartstream from '../ts/index.js';
|
||||||
|
|
||||||
let testSmartstream: smartstream.Smartstream;
|
let testSmartstream: smartstream.Smartstream;
|
||||||
tap.test('should combine a stream', async () => {
|
tap.test('should combine a stream', async () => {
|
||||||
testSmartstream = new smartstream.Smartstream([
|
testSmartstream = new smartstream.Smartstream([
|
||||||
fs.createReadStream('./test/assets/test.md'),
|
fs.createReadStream('./test/assets/test.md'),
|
||||||
fs.createWriteStream('./test/assets/testCopy.md')
|
fs.createWriteStream('./test/assets/testCopy.md'),
|
||||||
]);
|
]);
|
||||||
await testSmartstream.run();
|
await testSmartstream.run();
|
||||||
});
|
});
|
||||||
|
14
ts/index.ts
14
ts/index.ts
@ -1,10 +1,10 @@
|
|||||||
import * as plugins from './smartstream.plugins';
|
import * as plugins from './smartstream.plugins.js';
|
||||||
|
|
||||||
// interfaces
|
// interfaces
|
||||||
import { Transform } from 'stream';
|
import { Transform } from 'stream';
|
||||||
|
|
||||||
export interface IErrorFunction {
|
export interface IErrorFunction {
|
||||||
(err): any;
|
(err: Error): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICustomEventFunction {
|
export interface ICustomEventFunction {
|
||||||
@ -20,7 +20,7 @@ export interface ICustomEventObject {
|
|||||||
* class Smartstream handles
|
* class Smartstream handles
|
||||||
*/
|
*/
|
||||||
export class Smartstream {
|
export class Smartstream {
|
||||||
private streamArray = [];
|
private streamArray: Array<plugins.stream.Duplex> = [];
|
||||||
private customEventObjectArray: ICustomEventObject[] = [];
|
private customEventObjectArray: ICustomEventObject[] = [];
|
||||||
private streamStartedDeferred = plugins.smartpromise.defer();
|
private streamStartedDeferred = plugins.smartpromise.defer();
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ export class Smartstream {
|
|||||||
onCustomEvent(eventNameArg: string, eventFunctionArg: ICustomEventFunction) {
|
onCustomEvent(eventNameArg: string, eventFunctionArg: ICustomEventFunction) {
|
||||||
this.customEventObjectArray.push({
|
this.customEventObjectArray.push({
|
||||||
eventName: eventNameArg,
|
eventName: eventNameArg,
|
||||||
eventFunction: eventFunctionArg
|
eventFunction: eventFunctionArg,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ export class Smartstream {
|
|||||||
const done = plugins.smartpromise.defer<void>();
|
const done = plugins.smartpromise.defer<void>();
|
||||||
|
|
||||||
// clone Array
|
// clone Array
|
||||||
const streamExecutionArray = [];
|
const streamExecutionArray: Array<plugins.stream.Duplex> = [];
|
||||||
for (const streamItem of this.streamArray) {
|
for (const streamItem of this.streamArray) {
|
||||||
streamExecutionArray.push(streamItem);
|
streamExecutionArray.push(streamItem);
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ export class Smartstream {
|
|||||||
if (firstIteration === true) {
|
if (firstIteration === true) {
|
||||||
finalStream = stream;
|
finalStream = stream;
|
||||||
}
|
}
|
||||||
stream.on('error', err => {
|
stream.on('error', (err) => {
|
||||||
done.reject(err);
|
done.reject(err);
|
||||||
});
|
});
|
||||||
for (const customEventObject of this.customEventObjectArray) {
|
for (const customEventObject of this.customEventObjectArray) {
|
||||||
@ -100,7 +100,7 @@ export let cleanPipe = () => {
|
|||||||
(file, enc, cb) => {
|
(file, enc, cb) => {
|
||||||
cb();
|
cb();
|
||||||
},
|
},
|
||||||
cb => {
|
(cb) => {
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
|
import * as stream from 'stream';
|
||||||
|
|
||||||
|
export { stream };
|
||||||
|
|
||||||
|
// pushrocks scope
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
export { smartpromise };
|
||||||
|
|
||||||
|
// thirdparty
|
||||||
import * as through2 from 'through2';
|
import * as through2 from 'through2';
|
||||||
|
|
||||||
export { smartpromise, through2 };
|
export { through2 };
|
||||||
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user