-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: discover entry points from user packages (#383)
Closes: #190 BREAKING CHANGES: Discovery of primary and secondary entry points is changed to read from the following file sources. File locations are tried in this order: - `package.json` with `ngPackage` property - `ng-package.json` (requires a `package.json` as sibling) - `ng-package.js` (with a default export, requires a `package.json` as sibling)
- Loading branch information
1 parent
31ffc53
commit 4a7e96e
Showing
17 changed files
with
200 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Sample library: Configuration in ng-package.js | ||
====================================== | ||
|
||
The configuration in this sample resides inside `ng-package.js`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'baz-component', | ||
template: '<h1>hello world</h1>' | ||
}) | ||
export class BazComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const path = require('path'); | ||
process.env.DEBUG = true; | ||
|
||
// @see https://github.com/TypeStrong/ts-node#programmatic-usage | ||
require('ts-node').register({ | ||
project: path.join(__dirname, '..', '..', '..', 'tsconfig.packagr.json') | ||
}); | ||
|
||
const ngPackagr = require('../../../src/lib/ng-packagr'); | ||
|
||
ngPackagr.createNgPackage({ | ||
project: path.resolve(__dirname, 'ng-package.js') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './baz/baz.component'; | ||
export * from './ui-lib.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
lib: { | ||
entryFile: 'index.ts' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "../../../src/package.schema.json", | ||
"name": "@sample/package-js", | ||
"description": "A sample library with configuration in ng-package.js", | ||
"version": "1.0.0-pre.0", | ||
"private": true, | ||
"repository": "https://github.com/dherges/ng-packagr.git", | ||
"peerDependencies": { | ||
"@angular/core": "^4.1.2", | ||
"@angular/common": "^4.1.2" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
integration/samples/package-js/secondary/baz/baz.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'baz-component', | ||
template: '<h1>hello world</h1>' | ||
}) | ||
export class BazComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './baz/baz.component'; | ||
export * from './ui-lib.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const config = require('../ng-package'); | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"$schema": "../../../../src/package.schema.json", | ||
"name": "@sample/package-js-secondary" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { BazComponent } from './baz/baz.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
BazComponent, | ||
], | ||
exports: [ | ||
BazComponent, | ||
] | ||
}) | ||
export class UiLibModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { expect } from 'chai'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
describe(`@sample/package-js`, () => { | ||
|
||
describe(`package.json`, () => { | ||
let PACKAGE; | ||
before(() => { | ||
PACKAGE = require('../dist/package.json'); | ||
}); | ||
|
||
it(`should exist`, () => { | ||
expect(PACKAGE).to.be.ok; | ||
}); | ||
}); | ||
|
||
describe(`secondary/package.json`, () => { | ||
let PACKAGE; | ||
before(() => { | ||
PACKAGE = require('../dist/secondary/package.json'); | ||
}); | ||
|
||
it(`should exist`, () => { | ||
expect(PACKAGE).to.be.ok; | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { BazComponent } from './baz/baz.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
BazComponent, | ||
], | ||
exports: [ | ||
BazComponent, | ||
] | ||
}) | ||
export class UiLibModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters