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

Commit

Permalink
feat(build): install typings as postinstall step
Browse files Browse the repository at this point in the history
 - rather than versioning them in the repo.
 - this was originally changed so that the package could be installed inside of private networks that might not support using typings. to ensure this works, remove all package scripts when building the package.json for npm publishing.
  • Loading branch information
justindujardin committed May 28, 2016
1 parent 630b289 commit 772fab4
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 6,796 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ src/all.css.map
/node_modules
/modules/*/node_modules
/bower_components
/typings

# IDEs and editors
/.idea
Expand Down
9 changes: 7 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,20 @@ module.exports = function (grunt) {

grunt.registerTask('build-npm', ['build', 'build-npm-package', 'rewrite-source-maps']);
grunt.registerTask('build-npm-package', function () {
// Swap dependencies for peerDependencies in the published package.
// http://stackoverflow.com/a/34645112
var fs = require('fs');
var path = require('path');
try {
var file = fs.readFileSync(path.join(__dirname, 'package.json')).toString();
var rendered = JSON.parse(file);

// Swap dependencies for peerDependencies in the published package.
// http://stackoverflow.com/a/34645112
rendered.peerDependencies = rendered.dependencies;
delete rendered.dependencies;

// The installed package shouldn't do any postinstall stuff
delete rendered.scripts;

fs.writeFileSync('dist/package.json', JSON.stringify(rendered, null, 2));
}
catch (e) {
Expand Down
5 changes: 0 additions & 5 deletions modules/site/public/version.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"@angular/router": "2.0.0-rc.1",
"@angular2-material/checkbox": "2.0.0-alpha.4",
"@angular2-material/core": "2.0.0-alpha.4",
"@angular2-material/progress-bar": "2.0.0-alpha.4",
"@angular2-material/progress-circle": "2.0.0-alpha.4",
"@angular2-material/radio": "2.0.0-alpha.4",
"@angular2-material/sidenav": "2.0.0-alpha.4",
"@angular2-material/toolbar": "2.0.0-alpha.4",
"es6-promise": ">=3.0.2",
"es6-shim": "^0.35.0",
"rxjs": "5.0.0-beta.6",
Expand Down
2 changes: 1 addition & 1 deletion ng2-material.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference path="typings/main.d.ts"/>
/// <reference path="typings/index.d.ts"/>
export * from './src/index';
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"readmeFilename": "README.md",
"scripts": {
"start": "$(npm bin)/grunt serve",
"test": "$(npm bin)/grunt karma"
"test": "$(npm bin)/grunt karma",
"postinstall": "$(npm bin)/typings install"
},
"dependencies": {
"@angular/common": "2.0.0-rc.1",
Expand All @@ -23,11 +24,6 @@
"@angular/router": "2.0.0-rc.1",
"@angular2-material/checkbox": "2.0.0-alpha.4",
"@angular2-material/core": "2.0.0-alpha.4",
"@angular2-material/progress-bar": "2.0.0-alpha.4",
"@angular2-material/progress-circle": "2.0.0-alpha.4",
"@angular2-material/radio": "2.0.0-alpha.4",
"@angular2-material/sidenav": "2.0.0-alpha.4",
"@angular2-material/toolbar": "2.0.0-alpha.4",
"es6-promise": ">=3.0.2",
"es6-shim": "^0.35.0",
"rxjs": "5.0.0-beta.6",
Expand Down Expand Up @@ -73,6 +69,7 @@
"style-loader": "0.13.0",
"systemjs": "0.19.26",
"typescript": ">=1.8.9",
"typings": "^1.0.4",
"underscore": "1.8.3"
},
"contributors": [
Expand Down
5 changes: 3 additions & 2 deletions typings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"ambientDependencies": {
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#dd638012d63e069f2c99d06ef4dcc9616a943ee4",
"globalDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160412134438",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#48c1e3c1d6baefa4f1a126f188c27c4fefd36bff"
}
}
3 changes: 0 additions & 3 deletions typings/browser.d.ts

This file was deleted.

Loading

0 comments on commit 772fab4

Please sign in to comment.