Skip to content

Commit

Permalink
Angular 2 Final Release support
Browse files Browse the repository at this point in the history
  • Loading branch information
vsfedorenko committed Sep 19, 2016
1 parent 6bbec60 commit 80e1ea2
Show file tree
Hide file tree
Showing 29 changed files with 512 additions and 419 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ install:
script:
- npm test
- npm run build:prod
- npm run docs
# - npm run docs # excluded until support for ts 2.0 for typedoc is released

after_success:
- chmod -R a+x scripts
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ This is an Angular 2 [fullPage.js](https://github.com/alvarotrigo/fullPage.js) p
[![devDependency Status](https://david-dm.org/meiblorn/ng2-fullpage/dev-status.svg)](https://david-dm.org/meiblorn/ng2-fullpage#info=devDependencies)
[![Test Coverage](https://codeclimate.com/github/meiblorn/ng2-fullpage/badges/coverage.svg)](https://codeclimate.com/github/meiblorn/ng2-fullpage/coverage)
[![Code Climate](https://codeclimate.com/github/meiblorn/ng2-fullpage/badges/gpa.svg)](https://codeclimate.com/github/meiblorn/ng2-fullpage)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/meiblorn/ng2-fullpage/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

-----------------------------------
NEW RELEASE 2.0.0: ANGULAR 2 FINAL
-----------------------------------

## Demo

Expand Down Expand Up @@ -61,12 +64,12 @@ export class AppComponent {
// no additional config is required
}
```
Update webpack vendors entry file (src/vendor.ts) with 'jquery' import:
Update webpack vendors entry file (src/vendor.browser.ts) with 'jquery' import:

```typescript
/**
*
* File: vendor.ts
* File: vendor.browser.ts
*
* Just add 'jquery' module import statement.
*
Expand Down
26 changes: 26 additions & 0 deletions components/polyfills.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @author Meiblorn (Vadim Fedorenko) <meiblorn@gmail.com | admin@meiblorn.com> on 12/05/16.
*/

import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
import 'core-js/es6/weak-map';
import 'core-js/es6/weak-set';
import 'core-js/es6/typed';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';

import 'zone.js/dist/zone';

import 'ts-helpers';
8 changes: 0 additions & 8 deletions components/polyfills.ts

This file was deleted.

33 changes: 0 additions & 33 deletions components/typings/reflect.d.ts

This file was deleted.

11 changes: 0 additions & 11 deletions components/typings/webpack.d.ts

This file was deleted.

10 changes: 0 additions & 10 deletions components/typings/zone.d.ts

This file was deleted.

File renamed without changes.
10 changes: 4 additions & 6 deletions config/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ export default {
common: {
sources: {
directory: '.',
extensions: [
'', '.ts', '.js'
],
extensions: ['', '.ts', '.js', '.json'],
entries: {
directories: {
src: './components',
demo: './demo'
},
list: {
'ng2-fullpage': './index.ts',
'polyfills': '<%= common.sources.entries.directories.src %>/polyfills.ts',
'vendor': '<%= common.sources.entries.directories.src %>/vendor.ts',
'demo': '<%= common.sources.entries.directories.demo %>/app/main.ts'
'polyfills': '<%= common.sources.entries.directories.src %>/polyfills.browser.ts',
'vendor': '<%= common.sources.entries.directories.src %>/vendor.browser.ts',
'demo': '<%= common.sources.entries.directories.demo %>/app/main.browser.ts'
},
chunks: {
commons: {
Expand Down
24 changes: 14 additions & 10 deletions config/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @author Meiblorn (Vadim Fedorenko) <meiblorn@gmail.com | admin@meiblorn.com> on 12/05/16.
*/

import fs from 'fs';
import path from 'path';
import traverse from 'traverse';
import loDashTemplate from 'lodash.template';
Expand Down Expand Up @@ -50,18 +51,21 @@ export default class Utils {
return childProcess.exec(cmd);
}

static packageSort(packages) {
var len = packages.length - 1;
return function sort(a, b) {
if (a.names[0] === packages[0]) {
return -1;
}
static getFiles(dir, subdirFiles) {
var result = subdirFiles || [];

var files = fs.readdirSync(dir);

if (a.names[0] === packages[len]) {
return 1;
for (var file in files) {
var name = dir + '/' + files[file];
if (fs.statSync(name).isDirectory()) {
this.getFiles(name, result);
} else {
result.push(name);
}

return 0;
}

return result;
}

}
17 changes: 13 additions & 4 deletions config/karma/karma.conf.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import config from './../helpers/config';
const SPEC_BUNDLE_PATH = config('test.spec.bundle.filename');

export default karma => {
karma.set({

const configuration = {
basePath: '',
frameworks: ['jasmine'],
exclude: [],
Expand All @@ -15,7 +16,7 @@ export default karma => {
result[SPEC_BUNDLE_PATH] = ['webpack', 'sourcemap'];
return result;
})(),
webpack: WebpackTest,
webpack: WebpackTest({env: 'test'}),
coverageReporter: {
dir: config('test.reports.coverage.directory'),
reporters: [
Expand All @@ -32,6 +33,14 @@ export default karma => {
autoWatch: false,
reporters: ['progress', 'mocha', 'coverage'],
browsers: ['PhantomJS'],
singleRun: true
});
singleRun: true,
customLaunchers: {
ChromeTravisCi: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
};

karma.set(configuration);
};
141 changes: 80 additions & 61 deletions config/webpack/webpack.common.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,92 @@
*/

import CleanWebpackPlugin from 'clean-webpack-plugin';
import OccurenceOrderPlugin from 'webpack/lib/optimize/OccurenceOrderPlugin';
import CommonsChunkPlugin from 'webpack/lib/optimize/CommonsChunkPlugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import * as AwesomeTypescriptLoader from 'awesome-typescript-loader';

import config from './../helpers/config';
import utils from './../helpers/utils';

export default {
entry: config('common.sources.entries.list'),
resolve: {
extensions: config('common.sources.extensions'),
root: utils.root(config('common.sources.directory')),
modulesDirectories: config('common.sources.modules.directories')
},
module: {
preLoaders: [
{
test: /\.js$/,
loader: 'source-map-loader',
exclude: [
// these packages have problems with their sourcemaps
utils.root('node_modules/rxjs'),
utils.root('node_modules/@angular')
]
}
],
loaders: [
{
test: /\.ts$/, loader: 'awesome-typescript-loader',
exclude: [/\.(spec|e2e)\.ts$/],
query: {
declaration: false,
sourceMap: false
export default options => {

return {
entry: config('common.sources.entries.list'),
resolve: {
extensions: config('common.sources.extensions'),
root: utils.root(config('common.sources.directory')),
modulesDirectories: config('common.sources.modules.directories')
},
module: {
preLoaders: [
{
test: /\.ts$/,
loader: 'string-replace-loader',
query: {
search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)',
replace: '$1.import($3).then(mod => (mod.__esModule && mod.default) ? mod.default : mod)',
flags: 'g'
},
include: [utils.root()]
},
],
loaders: [
{
test: /\.ts$/,
loaders: [
'awesome-typescript-loader'
],
exclude: [/\.(spec|e2e)\.ts$/],
query: {
declaration: false,
sourceMap: false
}
},
{test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/},
{test: /\.html$/, loader: 'raw-loader'},
{test: /\.css$/, loaders: ['to-string-loader', 'css-loader']},
{test: /\.scss$/, loaders: ['raw-loader', 'sass-loader']},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/, loader: 'file-loader'}
],
postLoaders: [
{
test: /\.js$/,
loader: 'string-replace-loader',
query: {
search: 'var sourceMappingUrl = extractSourceMappingUrl\\(cssText\\);',
replace: 'var sourceMappingUrl = "";',
flags: 'g'
}
}
},
{test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/},
{test: /\.html$/, loader: 'html-loader'},
{test: /\.css$/, loaders: ['raw-loader']},
{test: /\.scss$/, loaders: ['raw-loader', 'sass-loader']},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/, loader: 'file-loader'}
]
},
plugins: [
new CleanWebpackPlugin([config('common.build.directory')], {root: utils.root(), dry: false, verbose: true}),
new AwesomeTypescriptLoader.ForkCheckerPlugin(),
new OccurenceOrderPlugin(true),
new CommonsChunkPlugin({
name: config('common.sources.entries.chunks.commons.list'),
minChunks: Infinity
}),
new HtmlWebpackPlugin({
template: utils.root(config('common.build.html.src')),
filename: utils.relative(
utils.root(config('common.build.scripts.directory')),
utils.root(config('common.build.html.dist'))
),
excludeChunks: ['ng2-fullpage'],
chunksSortMode: utils.packageSort(['polyfills', 'vendor', 'demo'])
})
],
node: {
global: 'window',
crypto: 'empty',
module: false,
clearImmediate: false,
setImmediate: false
}
]
},
plugins: [
new CleanWebpackPlugin([config('common.build.directory')], {
root: utils.root(), dry: false, verbose: true
}),
new AwesomeTypescriptLoader.ForkCheckerPlugin(),
new CommonsChunkPlugin({
name: config('common.sources.entries.chunks.commons.list'),
minChunks: Infinity
}),
new HtmlWebpackPlugin({
template: utils.root(config('common.build.html.src')),
filename: utils.relative(
utils.root(config('common.build.scripts.directory')),
utils.root(config('common.build.html.dist'))
),
excludeChunks: ['ng2-fullpage']
})
],
node: {
global: 'window',
crypto: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
};

};
Loading

0 comments on commit 80e1ea2

Please sign in to comment.