Skip to content

Commit

Permalink
fix(package): updated code style\fixed ng2 imports
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin committed May 18, 2016
1 parent d59368d commit 7fbe339
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 223 deletions.
12 changes: 8 additions & 4 deletions .config/bundle-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Builder = require('systemjs-builder');
const pkg = require('../package.json');
const name = pkg.name;
const targetFolder = path.resolve('./bundles');
console.log(targetFolder)

async.waterfall([
cleanBundlesFolder,
getSystemJsBundleConfig,
Expand All @@ -40,20 +40,24 @@ function getSystemJsBundleConfig(cb) {
},
map: {
typescript: path.resolve('node_modules/typescript/lib/typescript.js'),
angular2: path.resolve('node_modules/angular2'),
'@angular/core': path.resolve('node_modules/@angular/core/index.js'),
'@angular/common': path.resolve('node_modules/@angular/common/index.js'),
'@angular/compiler': path.resolve('node_modules/@angular/compiler/index.js'),
'@angular/platform-browser': path.resolve('node_modules/@angular/platform-browser/index.js'),
'@angular/platform-browser-dynamic': path.resolve('node_modules/@angular/platform-browser-dynamic/'),
rxjs: path.resolve('node_modules/rxjs')
},
paths: {
'*': '*.js'
}
};

config.meta = ['angular2', 'rxjs'].reduce((memo, currentValue) => {
config.meta = ['@angular/common','@angular/compiler','@angular/core',
'@angular/platform-browser','@angular/platform-browser-dynamic', 'rxjs'].reduce((memo, currentValue) => {
memo[path.resolve(`node_modules/${currentValue}/*`)] = {build: false};
return memo;
}, {});
config.meta.moment = {build: false};
console.log(config.meta)
return cb(null, config);
}

Expand Down
28 changes: 0 additions & 28 deletions .eslintignore

This file was deleted.

14 changes: 6 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
language: node_js
node_js:
- "5"
- "4"

before_install:
- npm install -g npm@latest
- "6"

script:
- npm run flow.install:typings
- npm test
- ./node_modules/.bin/codecov
- npm run flow.install:typings
- npm test

after_success:
- ./node_modules/.bin/codecov

addons:
# sauce labs tunel connector (read more https://docs.travis-ci.com/user/sauce-connect/ )
Expand Down
12 changes: 12 additions & 0 deletions components/select/select-pipes.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {it, expect, describe, inject, beforeEachProviders} from '@angular/core/testing';
import {ComponentFixture} from '@angular/compiler/testing';
import {HighlightPipe} from './select-pipes';

describe('Component: HighlightPipe', () => {
beforeEachProviders(() => [
HighlightPipe
]);
it('should be fine', inject([HighlightPipe], (fixture:ComponentFixture<HighlightPipe>) => {
expect(fixture).not.toBeNull();
}));
});
8 changes: 3 additions & 5 deletions components/select/select-pipes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {Pipe, PipeTransform} from '@angular/core';
import {escapeRegexp} from './common';

@Pipe({
name: 'highlight'
})
@Pipe({name: 'highlight'})
export class HighlightPipe implements PipeTransform {
public transform(value:string, args:any[]):any {
if (args.length < 1) {
Expand Down Expand Up @@ -31,7 +29,7 @@ export class HighlightPipe implements PipeTransform {
}

export function stripTags(input:string):string {
let tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
let tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;
let commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
return input.replace(commentsAndPhpTags, '').replace(tags, '');
}
17 changes: 0 additions & 17 deletions components/select/select.spec.ts

This file was deleted.

9 changes: 4 additions & 5 deletions demo/components/select-section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ let tabDesc:Array<any> = [
let tabsContent:string = ``;
tabDesc.forEach((desc:any) => {
tabsContent += `
<div *ngIf="currentHeading === '${desc.heading}'">
<${desc.heading.toLowerCase()}-demo>
</${desc.heading.toLowerCase()}-demo>
</div>
<pre>{{ currentHeading }}</pre>
<div *ngIf="currentHeading === '${desc.heading}'">
<${desc.heading.toLowerCase()}-demo>
</${desc.heading.toLowerCase()}-demo>
</div>
<tab heading="${desc.heading}" (select)="select_zzz($event)">
<div class="card card-block panel panel-default panel-body">
<br>
Expand Down
4 changes: 2 additions & 2 deletions demo/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {bootstrapStatic} from '@angular/platform-browser';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Component} from '@angular/core';
import {NgClass} from '@angular/common';

Expand Down Expand Up @@ -41,4 +41,4 @@ let gettingStarted = require('./getting-started.md');
export class DemoComponent {
}

bootstrapStatic(DemoComponent);
bootstrap(DemoComponent);
9 changes: 5 additions & 4 deletions gulp-tasks/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

const gulp = require('gulp');
const tslint = require('gulp-tslint');
const paths = gulp.paths;
const tslintConf = require('../tslint.json');
const gitignore = require('gitignore-to-glob')();

gitignore.push('**/*.ts');

gulp.task('tslint', () =>
gulp
.src(paths.tssrc)
.pipe(tslint(tslintConf))
.src(gitignore)
.pipe(tslint())
.pipe(tslint.report('prose', {
emitError: true,
summarizeFailureOutput: true,
Expand Down
9 changes: 0 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

const gulp = require('gulp');

gulp.paths = {
tssrc: [
'**/*.ts',
'!**/*.d.ts',
'!node_modules/**/*',
'!bundles/**/*',
'!typings/**/*']
};

require('require-dir')('./gulp-tasks');

gulp.task('default', () => {
Expand Down
55 changes: 6 additions & 49 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const path = require('path');
const cwd = process.cwd();

module.exports = function (config) {
module.exports = config => {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Expand All @@ -27,41 +27,14 @@ module.exports = function (config) {
},

webpack: {
// Do not change, leave as is or it wont work.
// See: https://github.com/webpack/karma-webpack#source-maps
devtool: 'inline-source-map',
resolve: {
root: [root('components')],
root: [path.resolve(cwd)],
modulesDirectories: ['node_modules', 'demo', 'components', 'test', '.'],
extensions: ['', '.ts', '.js', '.css']
},
module: {
preLoaders: [
{
test: /\.ts$/,
loader: 'tslint-loader',
exclude: [
root('node_modules')
]
},
{
test: /\.js$/,
loader: 'source-map-loader',
exclude: [
root('node_modules/rxjs')
]
}
],
loaders: [
{
test: /\.ts$/,
loader: 'awesome-typescript-loader',
query: {
'compilerOptions': {
'removeComments': true,
}
},
exclude: [/\.e2e\.ts$/]
}
{test: /\.ts$/, loader: 'ts-loader', exclude: [/node_modules/]}
],
postLoaders: [
// instrument only testing sources with Istanbul
Expand All @@ -76,25 +49,10 @@ module.exports = function (config) {
}
]
},
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: 'components'
},
stats: {
colors: true,
reasons: true
},

node: {
global: 'window',
process: false,
crypto: 'empty',
module: false,
clearImmediate: false,
setImmediate: false
},

watch: true,
debug: true
},
Expand Down Expand Up @@ -138,7 +96,6 @@ module.exports = function (config) {
});
};

function root(args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [__dirname].concat(args));
function root(partialPath) {
return path.join(__dirname, partialPath);
}
2 changes: 1 addition & 1 deletion ng2-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export default {
directives: [
SELECT_DIRECTIVES
]
}
};
Loading

0 comments on commit 7fbe339

Please sign in to comment.