Closed vhdirk closed 2 years ago
Hi @vhdirk, thanks for your suggestion. What bothers me is adding another mandatory dependency to the library. I'm not 100% sure about this, but let me take a look first, I haven't used this library myself.
What bothers me is adding another mandatory dependency to the library. I'm not 100% sure about this, but let me take a look first, I haven't used this library myself.
You could add a sub-module in a sub-folder by adding a package.json
file like this one:
{
"name": "ngx-date-fns/tz",
"private": true,
"ngPackage": {
"lib": {
"entryFile": "./src/public-api.ts"
}
},
"peerDependencies": {
"@angular/common": ">=8",
"@angular/core": ">=8",
"date-fns": ">=2",
"date-fns-tz": ">=2"
}
}
Thank's @LayZeeDK, I had no idea this could be done. Researching right know 👍
I also found this very detailed article: https://medium.com/tunaiku-tech/creating-secondary-entry-points-for-your-angular-library-1d5c0e95600a I will look into all of this more thoroughly next weekend.
Hey, It's been a long time since this was posted and there hasn't been much interest in this. I'm closing the issue. Thanks!
As it turns out, having dependencies in a secondary entry point isn't supported by any package managers so it wouldn't have made a difference. There are ways to mark peer dependencies as optional in the primary entry point's package.json
file though.
It'd be cool if you could also format timezone-aware dates. For that you need the format function from date-fns-tz.
I'm willing to create a PR, but I wanted to check if/how you'd integrate a feature like that.