Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Commit

Permalink
feat(toolchain): replaced es6-shim with core-js to fix typings issues…
Browse files Browse the repository at this point in the history
…, removed extension of Set and Map as they dont seem to work
  • Loading branch information
zakhenry committed May 24, 2016
1 parent 68e57bf commit 502e1b9
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion api/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'es6-shim';
import 'core-js';
import 'reflect-metadata';
import { ReflectiveInjector, provide } from '@angular/core';
import { Server } from './servers/abstract.server';
Expand Down
3 changes: 2 additions & 1 deletion browser/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import '../public/css/styles.css';
import { Cat } from '../../_demo/common/models/cat.model';
@Component({
selector: 'my-app',
template: require('./app.component.html'),
Expand All @@ -8,7 +9,7 @@ import '../public/css/styles.css';
export class AppComponent {

public handleClick() {
console.log('click!', new Set().add('foo'));
console.log('click!', new Cat());
}

}
2 changes: 1 addition & 1 deletion browser/config/karma-test-shim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Error.stackTraceLimit = Infinity;

require('es6-shim');
require('core-js');
require('reflect-metadata');

require('zone.js/dist/zone');
Expand Down
2 changes: 1 addition & 1 deletion browser/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'es6-shim';
import 'core-js';
import 'reflect-metadata';
require('zone.js/dist/zone');
if (process.env.ENV === 'production') {
Expand Down
11 changes: 4 additions & 7 deletions common/models/abstract.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ export interface EntityNest extends Map<string, AbstractModel|BaseCollection<Abs

}

export abstract class AbstractModel extends Map {
export abstract class AbstractModel {

protected nestedEntities: EntityNest;

protected identifier: Symbol;
protected identifier: symbol;

public getIdentifier() {
return this.get(this.identifier);
public getIdentifier(): string|number|symbol {
return this[this.identifier];
}




}
3 changes: 2 additions & 1 deletion common/models/base.collection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AbstractModel } from './abstract.model';
export class BaseCollection<T extends AbstractModel> extends Set {

export class BaseCollection<T extends AbstractModel> extends Array {

public findById(id: Symbol): AbstractModel {

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "gulp nodemon",
"test": "gulp test",
"coveralls": "cat coverage/summary/lcov.info | coveralls",
"build": "gulp compile && webpack --config browser/config/webpack.prod.js --progress --profile --bail",
"build": "gulp compile",
"postinstall": "typings install"
},
"repository": {
Expand All @@ -33,8 +33,8 @@
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@angular/router-deprecated": "^2.0.0-rc.1",
"chalk": "^1.1.3",
"core-js": "^2.4.0",
"dotenv": "^2.0.0",
"es6-shim": "^0.35.1",
"hapi": "^13.4.0",
"lodash": "^4.12.0",
"reflect-metadata": "^0.1.3",
Expand Down
32 changes: 21 additions & 11 deletions tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class UbiquitsProject {
definitions: [
'./typings/**/*.d.ts',
'!./typings/index.d.ts',
'!./typings/**/es6-shim/*.d.ts',
'!./typings/**/core-js/*.d.ts',
]
},
},
Expand Down Expand Up @@ -93,7 +93,7 @@ class UbiquitsProject {
return () => {
Error.stackTraceLimit = Infinity;

require('es6-shim');
require('core-js');
require('reflect-metadata');
require('zone.js/dist/zone-node');

Expand Down Expand Up @@ -151,9 +151,9 @@ class UbiquitsProject {
script: config.entryPoint,
'ext': 'js json ts',
watch: [
'api',
'_demo',
'common'
this.resolvePath('api'),
this.resolvePath('_demo'),
this.resolvePath('common')
],
nodeArgs: [
// ad-hoc debugging (doesn't allow debugging of bootstrap, but app will run with debugger off)
Expand All @@ -172,23 +172,31 @@ class UbiquitsProject {

resolvePath(pathString, relative) {
const normalized = path.normalize(this.basePath + '/' + pathString);
if (!relative){
if (!relative) {
return normalized;
}
return path.relative(this.basePath, normalized);
}

webpack(config) {

return (done) => {
return () => {

const webpack = require('webpack-stream');
const gulpWebpack = require('webpack-stream');
const gutil = require('gulp-util');
const webpackConfig = require(config.webpackPath);

webpackConfig.progress = true;

return gulp.src('.')
.pipe(webpack(webpackConfig, null, (err, stats) => {
//@todo handle stats
.pipe(gulpWebpack(webpackConfig, null, (err, stats) => {
if(err) {
throw new gutil.PluginError("webpack", err);
}
gutil.log("[webpack]", stats.toString({
chunkModules: false,
colors: gutil.colors.supportsColor,
}));
}))
.pipe(gulp.dest(config.destination));
}
Expand Down Expand Up @@ -256,7 +264,9 @@ class UbiquitsProject {
this.registerTask('compile:browser', 'compile browser', this.webpack({
webpackPath: this.resolvePath('./browser/config/webpack.prod.js'),
destination: this.paths.destination.browser
}), ['compile:api']);
}));

this.registerTask('compile', 'compile all files', null, ['compile:browser', 'compile:api']);

}

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"browser",
"build",
"_demo/browser",
"index.ts"
"index.d.ts"
]
}
2 changes: 1 addition & 1 deletion tsconfig.browser.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"build",
"api",
"_demo/api",
"./index.ts"
"index.d.ts"
]
}
2 changes: 1 addition & 1 deletion typings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160524134847",
"dotenv": "registry:dt/dotenv#2.0.0+20160327131627",
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"hapi": "registry:dt/hapi#13.0.0+20160423150146",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#6.0.0+20160514165920"
Expand Down

0 comments on commit 502e1b9

Please sign in to comment.