-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PR WELCOME] Discover primary and secondary entry points from user configuration #190
Comments
I like this idea. If we implement it, then we should probably release a 1.x version which has a deprecation warning when it's used with ng-package.json. |
One aspect makes me feel a little doubtful: it feels like polluting everything with Haven't tried ... what happens when |
Also, I didn't document it, but |
For the primary entries in a "monorepo project" with multiple packages, I added I am also interested how the npm teams sees the matter of putting multiple |
I just found https://stackoverflow.com/questions/10065564/add-custom-metadata-or-config-to-package-json-is-it-valid in support of custom package.json fields, but the more I think about it, the more I want to preserve both configuration methods. People are opinionated and like to choose for themselves how they configure things, and forcing them into one configuration method might make many unhappy. |
hmm im not sure about deprecating a separate config file. It isn't unusual for projects to have multiple options so why not just support both. If anything I would argue for also supporting |
The initial design doc is a good starting point for discussion. Back then, I wrote that:
I would like to keep the declarative way but understand that sometimes you like to have "dynamic" configuration. Right now, I would prefer
The custom "ng-package" would still have the limitation that it must be located in the same folder (next to) the package.json. I will think about it a little more. I think that a 1.x feature release for the above change is a good idea. Then later, let's see whether to deprecate "old" ways of configuring. I'd like to maintain the goal of minimize amount of configuration (this also applies for things like configuration merging imho) |
Related from #190: how should customization of primary and secondary entrypoints be handled? Should there be |
I personally don't like adding stuff into Having a |
Moving this to the more appropriate discussion here: I propose we make this feature more configurable. We could offer 3 options for secondaries. "secondaryEntrypoints": "none" // this would be the default
...
"secondaryEntrypoints: "automatic" // this would mimic the behavior in 1.5.0
...
"secondaryEntrypoints: ": [ // this would behave as you've described
{
"name": "bar", // I'm not sold on this field because the name must match the folder paths in dist, and it may cause complications and undesired behaviors.
"entryFile": "bar/public_api.ts" // If we require this to be a subfolder (like the automatic behavior) then we could easily generate package names
},
{
"name": "baz",
"entryFile": "baz/public_api.ts"
}
] With such configurability, people can choose to implement their libraries in the way they want. |
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)
This issue has been automatically locked due to inactivity. |
Type of Issue
Description
Historically, a
package.json
and ang-package.json
are used to "configure" ng-packagr. Thepackage.json
is used for the module ID, npm metadata, and more node/npm-related things. Theng-package.json
is used for destination paths, finding the entry file of an entry point, and angular/typescript/rollup-specific things.Entry point discovery should be changed, see below. Discovery of primary and secondary entry points should both use this.
Expected Behaviour
New Draft / Outline (first one "wins"):
package.json
:ngPackage
ng-package.json
(requires apackage.json
as sibling)ng-package.js
(default export, requires apackage.json
as sibling)Note: ignore
package.json
w/ongPackage
property.Version Information
The text was updated successfully, but these errors were encountered: