Modify library package.json (do not copy to dist folder)
See original GitHub issueType of Issue
[ ] Bug Report
[x] Feature Request
Description
Do not copy/write an additional package.json
in the dist directory.
Current Behaviour
package.json
is copied from source folder to dist
folder.
Publish workflow is cd dist && npm publish
Expected Behaviour
package.json
is validated whether generated artefacts are references (properties main
, typings
, and so on). If properties in package.json
are missing (or pointing to wrong location), package.json
will be updated with correct properties.
Optionall, an .npmignore
files is generated to exclude source files from the npm package.
Publish workflow is npm publish
in current working directory.
Library package.json
would look like:
{
"name": "@foo/bar",
"version": "1.0.0",
"typings": "./dist/typings/foo-bar-api.d.ts",
"main": "./dist/<path-to-js-bundle>",
"module": "./dist/<path-to-js-bundle>",
/* .. */
}
Secondary entry point package.json
would also need to be validated and updated. Example would look:
{
"name": "@foo/bar/bla/blubb",
"typings": "../../dist/typings/foo-bar-api.d.ts",
"main": "../../dist/<path-to-js-bundle>",
"module": "../../dist/<path-to-js-bundle>",
/* .. */
}
Version Information
ng-packagr: 6.x
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:9 (6 by maintainers)
Top Results From Across the Web
How to copy package.json to dist folder without the scripts part
I'm using webpack to bundle my javascript library and I'm currently copying the package.json ...
Read more >Working with JavaScript in Visual Studio Code
A JavaScript project is the source files of the project and should not include the derived or packaged files (such as a dist...
Read more >rollup-plugin-copy - npm
Start using rollup-plugin-copy in your project by running `npm i ... file or folder name; transform ( Function ): Modify file contents.
Read more >Output Management - webpack
Now run an npm run build and inspect the /dist folder. If everything went well you should now only see the files generated...
Read more >Use Azure Pipelines to build and publish a Node.js package
You can use an Azure DevOps pipeline to build, deploy, and test JavaScript apps. This quickstart walks through how to use a pipeline...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My 2 cents as I’m more familiar with Node/npm than with Angular (and not an expert in either one): I would at least like to see this be an option.
I tend to agree with lerna’s maintainer, that compiling to a separate/duplicate package seems like a Node/npm anti-pattern—even if that’s debatable, compiling to a separate place/package could be said to be an opinionated workflow, right?
From my perspective, trying to set up a design system with Angular components but also other, non-Angular npm packages, it seems like that opinionated piece is what’s making it hard to get everything up and running. Since ng-packagr and Angular CLI are ostensibly the bridge between an Angular-formatted project and a Node/npm-formatted package…I would (and did) expect to be able to use other Node/npm tools like lerna to work with the resulting packages, without all the fiddling/working-around that’s currently required. Again, just my 2 cents, though, and I’m certainly not an authority on Angular, lerna, NPM, or any of it.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. This action has been performed automatically by a bot.