diff --git a/gulpfile.js b/gulpfile.js index 4a59bf2e..c672683d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,25 +1,9 @@ const gulp = require('gulp'); -const tsc = require('gulp-typescript'); -const sourcemaps = require('gulp-sourcemaps'); -const merge = require('merge2'); const clean = require('gulp-clean'); -const tsProject = tsc.createProject('tsconfig.json'); gulp.task('clean', () => { - return gulp.src(['./src/**/*.d.ts', './src/**/*.js', './src/**/*.js', './src/**/*.js.map']) - .pipe(clean()); -}); - -gulp.task('release', ['clean'], () => { - const tsResult = gulp.src(['./src/**/*.ts', '!./src/**/*.spec.ts']) - .pipe(sourcemaps.init()) - .pipe(tsProject()); - - return merge([ - tsResult.js - .pipe(sourcemaps.write('.')) - .pipe(gulp.dest('./src')), - tsResult.dts - .pipe(gulp.dest('./src')) - ]); + return gulp.src([ + './src/**/*.d.ts', './src/**/*.js', './src/**/*.js.map', './src/**/*.metadata.json', + './src/**/*.ngsummary.json','./src/**/*.ngfactory.ts' + ]).pipe(clean()); }); diff --git a/package.json b/package.json index 15d7117e..03e52ef4 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "ngx-pipes", - "version": "1.3.3", + "version": "1.4.0", "author": "Dan Revah", "description": "Useful angular2 pipes", "license": "MIT", "angular-cli": {}, "scripts": { "start": "ng serve", - "lint": "tslint \"src/**/*.ts\"", - "test": "ng test" + "test": "ng test", + "build:js": "ngc -p tsconfig.json" }, "main": "src/app/index.js", "keywords": [ @@ -47,7 +47,6 @@ "coveralls": "^2.11.15", "gulp": "^3.9.1", "gulp-clean": "^0.3.2", - "gulp-typescript": "^3.1.4", "jasmine-core": "2.4.1", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", @@ -55,7 +54,6 @@ "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", - "merge2": "^1.0.3", "rxjs": "5.0.0-beta.12", "ts-helpers": "^1.1.1", "ts-node": "1.2.1", diff --git a/src/app/pipes.module.ts b/src/app/pipes.module.ts index 11a83a8b..1a025cad 100644 --- a/src/app/pipes.module.ts +++ b/src/app/pipes.module.ts @@ -11,9 +11,3 @@ import {NgBooleanPipesModule} from './pipes/boolean'; exports: [NgArrayPipesModule, NgStringPipesModule, NgMathPipesModule, NgBooleanPipesModule, NgObjectPipesModule] }) export class NgPipesModule {} - -export * from './pipes/array'; -export * from './pipes/object'; -export * from './pipes/string'; -export * from './pipes/math'; -export * from './pipes/boolean'; diff --git a/src/app/pipes/array/flatten.spec.ts b/src/app/pipes/array/flatten.spec.ts index 626aaca5..983c3699 100644 --- a/src/app/pipes/array/flatten.spec.ts +++ b/src/app/pipes/array/flatten.spec.ts @@ -16,14 +16,14 @@ describe('FlattenPipe', () => { }); it('should deep flatten array', () => { - let deepArray = [1,2,3,[4,5,6,[7,8,9],[10,11,12,13,[14],[15],[16, [17]]]]]; + let deepArray = [1, 2, 3, [4, 5, 6, [7, 8, 9], [10, 11, 12, 13, [14], [15], [16, [17]]]]]; let result = pipe.transform(deepArray); - expect(result).toEqual([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]); + expect(result).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]); }); - it('should shallow flatten array', () => { - let deepArray = [1,2,3,[4,5,6,[7,8,9],[10,11,12,13,[14],[15],[16, [17]]]]]; - let result = pipe.transform(deepArray, true); - expect(result).toEqual([1,2,3,4,5,6,[7,8,9],[10,11,12,13,[14],[15],[16, [17]]]]); + it('should shallow flatten array', () => { + let deepArray = [1, 2, 3, [4, 5, 6, [7, 8, 9], [10, 11, 12, 13, [14], [15], [16, [17]]]]]; + let result = pipe.transform(deepArray, true); + expect(result).toEqual([1, 2, 3, 4, 5, 6, [7, 8, 9], [10, 11, 12, 13, [14], [15], [16, [17]]]]); }); }); diff --git a/src/app/pipes/array/index.ts b/src/app/pipes/array/index.ts index 58b7e556..9b619085 100644 --- a/src/app/pipes/array/index.ts +++ b/src/app/pipes/array/index.ts @@ -15,8 +15,8 @@ import {SomePipe} from './some'; import {SamplePipe} from './sample'; import {GroupByPipe} from './group-by'; import {FilterByPipe} from './filter-by'; -import {NgModule} from '@angular/core'; import {OrderByPipe} from './order-by'; +import {NgModule} from '@angular/core'; const ARRAY_PIPES = [ DiffPipe, FlattenPipe, InitialPipe, IntersectionPipe, ReversePipe, TailPipe, @@ -32,20 +32,21 @@ const ARRAY_PIPES = [ export class NgArrayPipesModule { } -export * from './diff'; -export * from './initial'; -export * from './flatten'; -export * from './intersection'; -export * from './reverse'; -export * from './tail'; -export * from './truthify'; -export * from './union'; -export * from './unique'; -export * from './without'; -export * from './pluck'; -export * from './shuffle'; -export * from './every'; -export * from './some'; -export * from './sample'; -export * from './group-by'; -export * from './filter-by'; +export {DiffPipe} from './diff'; +export {InitialPipe} from './initial'; +export {FlattenPipe} from './flatten'; +export {IntersectionPipe} from './intersection'; +export {ReversePipe} from './reverse'; +export {TailPipe} from './tail'; +export {TrurthifyPipe} from './truthify'; +export {UnionPipe} from './union'; +export {UniquePipe} from './unique'; +export {WithoutPipe} from './without'; +export {PluckPipe} from './pluck'; +export {ShufflePipe} from './shuffle'; +export {EveryPipe} from './every'; +export {SomePipe} from './some'; +export {SamplePipe} from './sample'; +export {GroupByPipe} from './group-by'; +export {FilterByPipe} from './filter-by'; +export {OrderByPipe} from './order-by'; diff --git a/src/app/pipes/boolean/index.ts b/src/app/pipes/boolean/index.ts index 47781e6e..6809ca01 100644 --- a/src/app/pipes/boolean/index.ts +++ b/src/app/pipes/boolean/index.ts @@ -30,19 +30,19 @@ export const BOOLEAN_PIPES = [ }) export class NgBooleanPipesModule {} -export * from './is-defined'; -export * from './is-null'; -export * from './is-undefined'; -export * from './is-string'; -export * from './is-function'; -export * from './is-number'; -export * from './is-array'; -export * from './is-object'; -export * from './is-greater-equal-than'; -export * from './is-greater-than'; -export * from './is-less-equal-than'; -export * from './is-equal-to'; -export * from './is-not-equal-to'; -export * from './is-identical-to'; -export * from './is-not-identical-to'; -export * from './is-less-than'; +export {IsDefinedPipe} from './is-defined'; +export {IsNullPipe} from './is-null'; +export {IsUndefinedPipe} from './is-undefined'; +export {IsStringPipe} from './is-string'; +export {IsFunctionPipe} from './is-function'; +export {IsNumberPipe} from './is-number'; +export {IsArrayPipe} from './is-array'; +export {IsObjectPipe} from './is-object'; +export {IsGreaterEqualThanPipe} from './is-greater-equal-than'; +export {IsGreaterThanPipe} from './is-greater-than'; +export {IsLessEqualThanPipe} from './is-less-equal-than'; +export {IsEqualToPipe} from './is-equal-to'; +export {IsNotEqualToPipe} from './is-not-equal-to'; +export {IsIdenticalToPipe} from './is-identical-to'; +export {IsNotIdenticalToPipe} from './is-not-identical-to'; +export {IsLessThanPipe} from './is-less-than'; diff --git a/src/app/pipes/helpers/helpers.spec.ts b/src/app/pipes/helpers/helpers.spec.ts index 10076559..6c55b09f 100644 --- a/src/app/pipes/helpers/helpers.spec.ts +++ b/src/app/pipes/helpers/helpers.spec.ts @@ -1,5 +1,6 @@ import {extractDeepPropertyByMapKey} from './helpers'; + describe('Utils Tests', () => { it('should extract properties properly', () => { diff --git a/src/app/pipes/math/index.ts b/src/app/pipes/math/index.ts index 708e892f..cc36d4e3 100644 --- a/src/app/pipes/math/index.ts +++ b/src/app/pipes/math/index.ts @@ -24,15 +24,14 @@ export const MATH_PIPES = [ }) export class NgMathPipesModule {} -export * from './max'; -export * from './min'; -export * from './percentage'; -export * from './sum'; -export * from './floor'; -export * from './round'; -export * from './sqrt'; -export * from './pow'; -export * from './ceil'; -export * from './degrees'; -export * from './bytes'; -export * from './radians'; +export {MaxPipe} from './max'; +export {MinPipe} from './min'; +export {PercentagePipe} from './percentage'; +export {SumPipe} from './sum'; +export {FloorPipe} from './floor'; +export {RoundPipe} from './round'; +export {SqrtPipe} from './sqrt'; +export {PowerPipe} from './pow'; +export {CeilPipe} from './ceil'; +export {DegreesPipe} from './degrees'; +export {BytesPipe} from './bytes'; diff --git a/src/app/pipes/object/index.ts b/src/app/pipes/object/index.ts index 4ba02305..bdc31e99 100644 --- a/src/app/pipes/object/index.ts +++ b/src/app/pipes/object/index.ts @@ -1,11 +1,11 @@ -import { KeysPipe } from './keys'; -import { ValuesPipe } from './values'; -import { PairsPipe } from './pairs'; -import { PickPipe } from './pick'; -import { OmitPipe } from './omit'; -import { InvertPipe } from './invert'; -import { InvertByPipe } from './invert-by'; -import { NgModule } from '@angular/core'; +import {KeysPipe} from './keys'; +import {ValuesPipe} from './values'; +import {PairsPipe} from './pairs'; +import {PickPipe} from './pick'; +import {OmitPipe} from './omit'; +import {InvertPipe} from './invert'; +import {InvertByPipe} from './invert-by'; +import {NgModule} from '@angular/core'; const OBJECT_PIPES = [ KeysPipe, ValuesPipe, PairsPipe, PickPipe, InvertPipe, InvertByPipe, @@ -17,12 +17,13 @@ const OBJECT_PIPES = [ imports: [], exports: OBJECT_PIPES }) -export class NgObjectPipesModule {} +export class NgObjectPipesModule { +} -export * from './keys'; -export * from './values'; -export * from './pairs'; -export * from './pick'; -export * from './omit'; -export * from './invert'; -export * from './invert-by'; +export {KeysPipe} from './keys'; +export {ValuesPipe} from './values'; +export {PairsPipe} from './pairs'; +export {PickPipe} from './pick'; +export {OmitPipe} from './omit'; +export {InvertPipe} from './invert'; +export {InvertByPipe} from './invert-by'; diff --git a/src/app/pipes/string/index.ts b/src/app/pipes/string/index.ts index 88ad9a8d..6a4e617f 100644 --- a/src/app/pipes/string/index.ts +++ b/src/app/pipes/string/index.ts @@ -32,21 +32,21 @@ export const STRING_PIPES = [ }) export class NgStringPipesModule {} -export * from './ucwords'; -export * from './ltrim'; -export * from './repeat'; -export * from './rtrim'; -export * from './scan'; -export * from './shorten'; -export * from './strip-tags'; -export * from './trim'; -export * from './ucfirst'; -export * from './slugify'; -export * from './camelize'; -export * from './latinise'; -export * from './lines'; -export * from './underscore'; -export * from './match'; -export * from './test'; -export * from './lpad'; -export * from './rpad'; +export {UcWordsPipe} from './ucwords'; +export {LeftTrimPipe} from './ltrim'; +export {RepeatPipe} from './repeat'; +export {RightTrimPipe} from './rtrim'; +export {ScanPipe} from './scan'; +export {ShortenPipe} from './shorten'; +export {StripTagsPipe} from './strip-tags'; +export {TrimPipe} from './trim'; +export {UcFirstPipe} from './ucfirst'; +export {SlugifyPipe} from './slugify'; +export {CamelizePipe} from './camelize'; +export {LatinisePipe} from './latinise'; +export {LinesPipe} from './lines'; +export {UnderscorePipe} from './underscore'; +export {MatchPipe} from './match'; +export {TestPipe} from './test'; +export {LeftPadPipe} from './lpad'; +export {RightPadPipe} from './rpad'; diff --git a/tsconfig.json b/tsconfig.json index 327c748e..38f9c024 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,13 +13,15 @@ ] }, "include": [ - "src/app/pipes.module.ts" + "src/app/pipes.module.ts", + "src/app/index.ts", + "index.ts" ], "exclude": [ "node_modules", "**/*.spec.ts" ], "angularCompilerOptions": { - "genDir": "compiled" + "strictMetadataEmit": true } } diff --git a/tslint.json b/tslint.json deleted file mode 100644 index ad0093e9..00000000 --- a/tslint.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "rulesDirectory": [ - "node_modules/codelyzer" - ], - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "eofline": true, - "forin": true, - "indent": [ - true, - "spaces" - ], - "label-position": true, - "label-undefined": true, - "max-line-length": [ - true, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - "static-before-instance", - "variables-before-functions" - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-key": true, - "no-duplicate-variable": true, - "no-empty": false, - "no-eval": true, - "no-inferrable-types": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-unused-variable": true, - "no-unreachable": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - - "directive-selector-prefix": [true, "app"], - "component-selector-prefix": [true, "app"], - "directive-selector-name": [true, "camelCase"], - "component-selector-name": [true, "kebab-case"], - "directive-selector-type": [true, "attribute"], - "component-selector-type": [true, "element"], - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "component-class-suffix": true, - "directive-class-suffix": true, - "templates-use-public": true, - "invoke-injectable": true - } -}