Skip to content

Commit

Permalink
feat: add json schema for package.json with custom ngPackage prop…
Browse files Browse the repository at this point in the history
…erty (#173)

See review discussions in #169
  • Loading branch information
dherges authored Oct 10, 2017
1 parent c193b68 commit dd85fd2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ Configuration is picked up from the cli `-p` parameter, then from the default lo

To configure with `package.json`, put your ng-package configuration
in the `ngPackage` field:

```json
{
"$schema": "./node_modules/ng-packagr/package.schema.json",
"ngPackage": {
"lib": {
"entryFile": "public_api.ts"
Expand All @@ -75,6 +77,8 @@ in the `ngPackage` field:
}
```

Note: the JSON `$schema` reference enables JSON editing support (autocompletion) for the custom `ngPackage` property in an IDE like [VSCode](https://github.com/Microsoft/vscode).

#### More Examples

Nikolas LeBlanc has written a story on medium.com on [Building an Angular 4 Component Library with the Angular CLI and ng-packagr](https://medium.com/@ngl817/building-an-angular-4-component-library-with-the-angular-cli-and-ng-packagr-53b2ade0701e)
Expand Down
2 changes: 1 addition & 1 deletion integration/samples/core/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../../src/lib/ng-package.schema.json",
"$schema": "../../../src/ng-package.schema.json",
"lib": {
"entryFile": "public_api.ts",
"externals": {
Expand Down
2 changes: 1 addition & 1 deletion integration/samples/custom/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../../src/lib/ng-package.schema.json",
"$schema": "../../../src/ng-package.schema.json",
"lib": {
"entryFile": "src/public_api.ts"
}
Expand Down
2 changes: 1 addition & 1 deletion integration/samples/externals/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../../src/lib/ng-package.schema.json",
"$schema": "../../../src/ng-package.schema.json",
"lib": {
"entryFile": "public_api.ts"
}
Expand Down
2 changes: 1 addition & 1 deletion integration/samples/material/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../../src/lib/ng-package.schema.json",
"$schema": "../../../src/ng-package.schema.json",
"lib": {
"entryFile": "public_api.ts"
}
Expand Down
2 changes: 1 addition & 1 deletion integration/samples/package-json/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "../../../src/package.schema.json",
"name": "@sample/package-json",
"description": "A sample library with configuration in package.json",
"version": "1.0.0-pre.0",
Expand All @@ -9,7 +10,6 @@
"@angular/common": "^4.1.2"
},
"ngPackage": {
"$schema": "../../../src/lib/ng-package.schema.json",
"lib": {
"entryFile": "public_api.ts"
}
Expand Down
2 changes: 1 addition & 1 deletion integration/samples/typings/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"$schema": "../../../src/lib/ng-package.schema.json"
"$schema": "../../../src/ng-package.schema.json"
}
12 changes: 12 additions & 0 deletions src/package.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json-schema.org/schema",
"allOf": [
{ "$ref": "http://json.schemastore.org/package" },
{
"properties": {
"ngPackage": { "$ref": "./ng-package.schema.json" }
},
"required": []
}
]
}

0 comments on commit dd85fd2

Please sign in to comment.