added gitlab ci

This commit is contained in:
Philipp Kunz 2016-09-25 14:00:16 +02:00
parent 361c7ecc2f
commit 8653abfce1
16 changed files with 164 additions and 1 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
node_modules/
public/
pages/
coverage/

10
dist/index.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export interface IErrorFunction {
(err: any): number;
}
export declare class Smartstream {
streamArray: any[];
errorFunction: IErrorFunction;
constructor(streamArrayArg: any[]);
onError(errorFunctionArg: IErrorFunction): void;
run(): any;
}

21
dist/index.js vendored Normal file
View File

@ -0,0 +1,21 @@
"use strict";
const plugins = require("./smartstream.plugins");
class Smartstream {
constructor(streamArrayArg) {
this.streamArray = [];
this.errorFunction = null;
this.streamArray = streamArrayArg;
}
onError(errorFunctionArg) {
this.errorFunction = errorFunctionArg;
}
run() {
let combinedStream = plugins.streamCombiner2.obj(this.streamArray);
if (this.errorFunction !== null) {
combinedStream.on('error', this.errorFunction);
}
return combinedStream;
}
}
exports.Smartstream = Smartstream;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsaURBQWdEO0FBTWhEO0lBR0ksWUFBWSxjQUFxQjtRQUZqQyxnQkFBVyxHQUFHLEVBQUUsQ0FBQTtRQUNoQixrQkFBYSxHQUFtQixJQUFJLENBQUE7UUFFaEMsSUFBSSxDQUFDLFdBQVcsR0FBRyxjQUFjLENBQUE7SUFDckMsQ0FBQztJQUNELE9BQU8sQ0FBQyxnQkFBZ0M7UUFDcEMsSUFBSSxDQUFDLGFBQWEsR0FBRyxnQkFBZ0IsQ0FBQTtJQUN6QyxDQUFDO0lBQ0QsR0FBRztRQUNDLElBQUksY0FBYyxHQUFHLE9BQU8sQ0FBQyxlQUFlLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQTtRQUNsRSxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsYUFBYSxLQUFLLElBQUksQ0FBQyxDQUFDLENBQUM7WUFDOUIsY0FBYyxDQUFDLEVBQUUsQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLGFBQWEsQ0FBQyxDQUFBO1FBQ2xELENBQUM7UUFDRCxNQUFNLENBQUMsY0FBYyxDQUFBO0lBQ3pCLENBQUM7Q0FDSjtBQWhCRCxrQ0FnQkMifQ==

3
dist/smartstream.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import 'typings-global';
export import q = require('q');
export declare let streamCombiner2: any;

5
dist/smartstream.plugins.js vendored Normal file
View File

@ -0,0 +1,5 @@
"use strict";
require("typings-global");
exports.q = require("q");
exports.streamCombiner2 = require('stream-combiner2');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzdHJlYW0ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c3RyZWFtLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2Qix5QkFBOEI7QUFDbkIsUUFBQSxlQUFlLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBQUEifQ==

42
gitlab-ci.yml Normal file
View File

@ -0,0 +1,42 @@
image: hosttoday/ht-docker-node:npmts
stages:
- test
- release
- page
testLEGACY:
stage: test
script:
- npmci test legacy
tags:
- docker
testLTS:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmpage
stage: page
script:
- npmci command npmpage --host gitlab
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public

1
npmextra.json Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -3,6 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"description": "simplifies access to node streams, TypeScript ready!", "description": "simplifies access to node streams, TypeScript ready!",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "(npmts)" "test": "(npmts)"
}, },
@ -15,5 +16,17 @@
"bugs": { "bugs": {
"url": "https://gitlab.com/pushrocks/smartstream/issues" "url": "https://gitlab.com/pushrocks/smartstream/issues"
}, },
"homepage": "https://gitlab.com/pushrocks/smartstream#README" "homepage": "https://gitlab.com/pushrocks/smartstream#README",
"devDependencies": {
"@types/should": "^8.1.30",
"npmts-g": "^5.2.8",
"should": "^11.1.0",
"typings-test": "^1.0.3"
},
"dependencies": {
"@types/q": "0.x.x",
"q": "^1.4.1",
"stream-combiner2": "^1.1.1",
"typings-global": "^1.0.14"
}
} }

1
test/assets/test.md Normal file
View File

@ -0,0 +1 @@
hi.md

1
test/assets/testCopy.md Normal file
View File

@ -0,0 +1 @@
hi.md

1
test/test.d.ts vendored Normal file
View File

@ -0,0 +1 @@
import 'typings-test';

15
test/test.js Normal file
View File

@ -0,0 +1,15 @@
"use strict";
require("typings-test");
const fs = require("fs");
const smartstream = require("../dist/index");
let testSmartstream;
describe('smartstream', function () {
it('should combine a stream', function () {
testSmartstream = new smartstream.Smartstream([
fs.createReadStream('./test/assets/test.md'),
fs.createWriteStream('./test/assets/testCopy.md')
]);
testSmartstream.run();
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQix5QkFBeUI7QUFHekIsNkNBQTRDO0FBRTVDLElBQUksZUFBd0MsQ0FBQTtBQUU1QyxRQUFRLENBQUMsYUFBYSxFQUFFO0lBQ3BCLEVBQUUsQ0FBQyx5QkFBeUIsRUFBRTtRQUMxQixlQUFlLEdBQUcsSUFBSSxXQUFXLENBQUMsV0FBVyxDQUFDO1lBQzFDLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQyx1QkFBdUIsQ0FBQztZQUM1QyxFQUFFLENBQUMsaUJBQWlCLENBQUMsMkJBQTJCLENBQUM7U0FDcEQsQ0FBQyxDQUFBO1FBQ0YsZUFBZSxDQUFDLEdBQUcsRUFBRSxDQUFBO0lBQ3pCLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

17
test/test.ts Normal file
View File

@ -0,0 +1,17 @@
import 'typings-test'
import fs = require('fs')
import * as should from 'should'
import * as smartstream from '../dist/index'
let testSmartstream: smartstream.Smartstream
describe('smartstream', function() {
it('should combine a stream', function(){
testSmartstream = new smartstream.Smartstream([
fs.createReadStream('./test/assets/test.md'),
fs.createWriteStream('./test/assets/testCopy.md')
])
testSmartstream.run()
})
})

23
ts/index.ts Normal file
View File

@ -0,0 +1,23 @@
import * as plugins from './smartstream.plugins'
export interface IErrorFunction {
(err): number
}
export class Smartstream {
streamArray = []
errorFunction: IErrorFunction = null
constructor(streamArrayArg: any[]){
this.streamArray = streamArrayArg
}
onError(errorFunctionArg: IErrorFunction) {
this.errorFunction = errorFunctionArg
}
run() {
let combinedStream = plugins.streamCombiner2.obj(this.streamArray)
if (this.errorFunction !== null) {
combinedStream.on('error', this.errorFunction)
}
return combinedStream
}
}

View File

@ -0,0 +1,3 @@
import 'typings-global'
export import q = require('q')
export let streamCombiner2 = require('stream-combiner2')

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}