Skip to content

Commit

Permalink
changes for aot build compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
manishjanky committed Dec 30, 2017
1 parent 48c93a4 commit 376fe93
Show file tree
Hide file tree
Showing 33 changed files with 12,287 additions and 3,070 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ Thumbs.db
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/extensions.json

#tmp files
/tmp/
27 changes: 27 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Node
node_modules
npm-debug.log

# Yarn
yarn-error.log

# JetBrains
.idea/

# VS Code
.vscode/

# Windows
Thumbs.db
Desktop.ini

# Mac
.DS_Store

# Temporary files
coverage/
docs
tmp

# Library files
src/
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sudo: required
dist: trusty
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
language: node_js
node_js:
- node
script:
- npm run ci
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3
cache:
yarn: true
notifications:
email: false
after_success:
- npm run codecov
4 changes: 2 additions & 2 deletions License
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017
Copyright (c) 2017 Oleksii Trekhleb

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class YourModule { ... }
```
- **event**: the triggered event
- **pageNo**: current page number
- **pageSize**: current page size. No of items per page
- **data**: data is the array of records that belongs to this page. Will be `null` if data was not passed and you can fetch data from your api or the way you want it to handle

## Help Improve
Expand Down
3 changes: 0 additions & 3 deletions config-library.js

This file was deleted.

63 changes: 63 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const gulp = require('gulp');
const sass = require('node-sass');
const inlineTemplates = require('gulp-inline-ng2-template');
const exec = require('child_process').exec;

/**
* Inline templates configuration.
* @see https://github.com/ludohenin/gulp-inline-ng2-template
*/
const INLINE_TEMPLATES = {
SRC: './src/**/*.ts',
DIST: './tmp/src-inlined',
CONFIG: {
base: '/src',
target: 'es6',
useRelativePaths: true,
styleProcessor: compileSass
}
};

/**
* Inline external HTML and SCSS templates into Angular component files.
* @see: https://github.com/ludohenin/gulp-inline-ng2-template
*/
gulp.task('inline-templates', () => {
return gulp.src(INLINE_TEMPLATES.SRC)
.pipe(inlineTemplates(INLINE_TEMPLATES.CONFIG))
.pipe(gulp.dest(INLINE_TEMPLATES.DIST));
});

/**
* Build ESM by running npm task.
* This is a temporary solution until ngc is supported --watch mode.
* @see: https://github.com/angular/angular/issues/12867
*/
gulp.task('build:esm', ['inline-templates'], (callback) => {
exec('npm run ngcompile', function (error, stdout, stderr) {
console.log(stdout, stderr);
callback(error)
});
});

/**
* Implements ESM build watch mode.
* This is a temporary solution until ngc is supported --watch mode.
* @see: https://github.com/angular/angular/issues/12867
*/
gulp.task('build:esm:watch', ['build:esm'], () => {
gulp.watch('src/**/*', ['build:esm']);
});

/**
* Compile SASS to CSS.
* @see https://github.com/ludohenin/gulp-inline-ng2-template
* @see https://github.com/sass/node-sass
*/
function compileSass(path, ext, file, callback) {
let compiledCss = sass.renderSync({
file: path,
outputStyle: 'compressed',
});
callback(null, compiledCss.css);
}
24 changes: 24 additions & 0 deletions karma-test-entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'core-js';
import 'rxjs/Rx';
import 'zone.js/dist/zone';
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/proxy';
import 'zone.js/dist/jasmine-patch';

import { TestBed } from '@angular/core/testing';

import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

TestBed.initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);

const testsContext: any = require.context('./src', true, /\.spec/);
testsContext.keys().forEach(testsContext);
70 changes: 70 additions & 0 deletions karma.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import webpackTestConfig from './webpack-test.config';
import { ConfigOptions } from 'karma';

export default (config) => {
config.set({
// Base path that will be used to resolve all patterns (eg. files, exclude).
basePath: './',

// Frameworks to use.
// Available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],

// List of files to load in the browser.
files: [
'karma-test-entry.ts'
],

// Preprocess matching files before serving them to the browser.
// Available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'karma-test-entry.ts': ['webpack', 'sourcemap']
},

webpack: webpackTestConfig,

// Webpack please don't spam the console when running in karma!
webpackMiddleware: {
noInfo: true,
// Use stats to turn off verbose output.
stats: {
chunks: false
}
},

mime: {
'text/x-typescript': [ 'ts' ]
},

coverageIstanbulReporter: {
reports: ['text-summary', 'html', 'lcovonly'],
fixWebpackSourcePaths: true
},

// Test results reporter to use.
// Possible values: 'dots', 'progress'.
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'coverage-istanbul'],

// Level of logging
// Possible values:
// - config.LOG_DISABLE
// - config.LOG_ERROR
// - config.LOG_WARN
// - config.LOG_INFO
// - config.LOG_DEBUG
logLevel: config.LOG_WARN,

// Start these browsers.
// Available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],

browserConsoleLogOptions: {
terminal: true,
level: 'log'
},

singleRun: true,
colors: true
} as ConfigOptions);
};
1 change: 0 additions & 1 deletion lib/index.ts

This file was deleted.

Loading

0 comments on commit 376fe93

Please sign in to comment.