Skip to content

Commit

Permalink
fix: depend on user's typescript and tsc-wrapped (#268)
Browse files Browse the repository at this point in the history
Previously, a user of ng-packagr could install an incompatible typescript version for ng-packagr. Prevent inadvertent typescript installs by depending on a user's typescript isntallation (peerDependencies). Same for tsc-wrapped.
  • Loading branch information
dherges authored Nov 10, 2017
1 parent 42125bc commit 42b2f08
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"ng-packagr": "./cli/main.js"
},
"dependencies": {
"@angular/tsc-wrapped": "^4.4.5",
"@ngtools/json-schema": "^1.1.0",
"autoprefixer": "^7.1.1",
"browserslist": "^2.1.5",
Expand All @@ -46,16 +45,20 @@
"sorcery": "^0.10.0",
"stylus": "^0.54.5",
"ts-node": "^3.0.4",
"typescript": "^2.3.4",
"uglify-js": "^3.0.7",
"vinyl-fs": "^2.4.4"
},
"peerDependencies": {
"@angular/tsc-wrapped": "~4.4.5",
"typescript": "~2.3.4"
},
"devDependencies": {
"@angular/cdk": "^2.0.0-beta.11",
"@angular/common": "^4.4.5",
"@angular/core": "^4.4.5",
"@angular/http": "^4.4.5",
"@angular/platform-browser": "^4.4.5",
"@angular/tsc-wrapped": "~4.4.5",
"@commitlint/cli": "^4.0.0",
"@commitlint/config-angular": "^4.2.0",
"@types/chai": "^4.0.0",
Expand All @@ -78,6 +81,7 @@
"rxjs": "^5.4.0",
"sinon": "^4.0.0",
"standard-version": "^4.0.0",
"typescript": "~2.3.4",
"zone.js": "^0.8.10"
},
"private": true,
Expand Down
7 changes: 4 additions & 3 deletions src/lib/util/json.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const glob = require('glob')
import * as glob from 'glob';
import { readJson, writeJson } from 'fs-extra';
import { promisify } from './promisify';
import { debug } from './log';

/**
* Modifies a set of JSON files by invoking `modifyFn`
*
Expand Down Expand Up @@ -33,8 +34,8 @@ export async function modifyJsonFiles(globPattern: string, modifyFn: (jsonObj: a
export async function tryReadJson(filePath: string): Promise<any> {
try {
return await readJson(filePath);
} catch {
} catch (e) {
// this means the file was empty or not json, which is fine
return {};
return await Promise.resolve({});
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
dependencies:
tslib "^1.7.1"

"@angular/tsc-wrapped@^4.4.5":
"@angular/tsc-wrapped@~4.4.5":
version "4.4.6"
resolved "https://registry.yarnpkg.com/@angular/tsc-wrapped/-/tsc-wrapped-4.4.6.tgz#16787cbbf50bdc7e738123b19c32527f244e178d"
dependencies:
Expand Down Expand Up @@ -3468,9 +3468,9 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@^2.3.4:
version "2.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d"
typescript@~2.3.4:
version "2.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.4.tgz#3d38321828231e434f287514959c37a82b629f42"

uglify-js@^2.6:
version "2.8.29"
Expand Down

0 comments on commit 42b2f08

Please sign in to comment.