Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
feat(angular2): update to beta 14
Browse files Browse the repository at this point in the history
  • Loading branch information
justindujardin committed Apr 9, 2016
1 parent 78f2ead commit 7afdd23
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 103 deletions.
99 changes: 0 additions & 99 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,7 @@ module.exports = function (grunt) {
},
webpack: {
singleJs: require('./webpack.config.js')
},

universal: {
examples: {
src: 'index.html'
}
}

});

grunt.loadNpmTasks('grunt-contrib-copy');
Expand Down Expand Up @@ -361,98 +354,6 @@ module.exports = function (grunt) {
});
});

// NOTE: This task does not work. It is WIP.
grunt.registerMultiTask('universal', 'Prerender examples app as static HTML', function () {
var done = this.async();
/*
* based on angular2-grunt-prerender
* https://github.com/angular/universal
*
* Copyright (c) 2016 Wassim Chegham
* Licensed under the MIT license.
*/
try {
var proxyquire = require('proxyquire');
var zone = require('zone.js');
var reflect = require('reflect-metadata');
var provide = require('angular2/core');
var router = require('angular2/router');
var ng2material = require('./ng2-material/all');
ng2material['@global'] = true;
ng2material['@noCallThru'] = true;
var app = proxyquire('./examples/app', {
'ng2-material/all': ng2material
});
var all = proxyquire('./examples/all', {
'ng2-material/all': ng2material
});
var universal = require('angular2-universal-preview');
var options = this.options({
component: [app.DemosApp],
providers: ng2material.MATERIAL_NODE_PROVIDERS,
platformProviders: [
universal.NODE_LOCATION_PROVIDERS,
],
directives: ng2material.MATERIAL_DIRECTIVES.concat(all.DEMO_DIRECTIVES),
preboot: false,
separator: '\r\n'
});
var angular2Prerender = function (file) {
var clientHtml = file.toString();
// bootstrap and render component to string
var bootloader = options.bootloader;
if (!options.bootloader) {
options.bootloader = {
component: options.component,
document: universal.parseDocument(clientHtml),
providers: options.providers,
componentProviders: options.componentProviders,
platformProviders: options.platformProviders,
directives: options.directives,
preboot: options.preboot
};
}
bootloader = universal.Bootloader.create(options.bootloader);
return bootloader.serializeApplication().then(function (html) {
return new Buffer(html);
});
};
this.files.forEach(function (f) {
var src = f.src.filter(function (filepath) {
if (!grunt.file.exists(filepath)) {
grunt.log.warn('Source file "' + filepath + '" not found.');
return false;
}
else {
return true;
}
})
.map(function (filepath) {
return grunt.file.read(filepath);
})
.join(grunt.util.normalizelf(options.separator));
// Handle options.
angular2Prerender(src)
.then(function (buffer) {
return src = buffer;
})
.then(function (_src) {
return grunt.file.write(f.dest, _src);
})
.then(function (_) {
return grunt.log.writeln('File "' + f.dest + '" created.');
done();
});
});

}
catch (e) {
console.error(e.stack);
return;
}

});

grunt.registerTask('site-meta', 'Build metadata files describing example usages', function (tag) {
var done = this.async();
var glob = require('glob');
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/node/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {bootstrap} from "angular2-universal-preview";
import {bootstrap} from "angular2-universal";
import {ROUTER_PROVIDERS} from "angular2/router";
import {MATERIAL_NODE_PROVIDERS} from "ng2-material/all";
import {HTTP_PROVIDERS} from "angular2/http";
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test": "$(npm bin)/grunt karma"
},
"dependencies": {
"angular2": ">=2.0.0-beta.12",
"angular2": ">=2.0.0-beta.14",
"es6-promise": ">=3.0.2",
"es6-shim": ">=0.35.0",
"reflect-metadata": "0.1.2",
Expand All @@ -24,7 +24,8 @@
},
"typings": "dist/ng2-material.d.ts",
"devDependencies": {
"angular2-universal-preview": "*",
"angular2-universal-polyfills": "^0.3.4",
"angular2-universal": "0.90.2",
"autoprefixer": "6.2.0",
"coveralls": "2.11.6",
"css": "^2.2.1",
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"ng2-material/core/util/util.ts",
"ng2-material/core/util/viewport.ts",
"ng2-material/webpack_all.ts",
"ng2-material/webpack_scripts.ts",
"ng2-material/webpack_styles.ts",
"examples/all.ts",
"examples/app.ts",
Expand Down

0 comments on commit 7afdd23

Please sign in to comment.