Can not use [pre/post]install script for build angular package during local installation of traditional node package (via npm link)
See original GitHub issueType of Issue
[X] Bug Report
[ ] Feature Request
Description
I try to use yarn workspaces for my angular project with angular modules included in separate packages for save disk space and for building speed. And I can’t use ng_packagr, because it simply ignores all files with paths which containing ‘node_modules’ string. But you can’t do this when you use a local installation and want to use install script for build angular packages, because the install script runs for the localy installed node package inside node_modules folder.
For example structure of my project:
root_of_project
\--node_modules
| \--my_package_1 (auto symlink to ../libs/my_package_1)
| \--my_package_2 (auto symlink to ../libs/my_package_2)
| \--my_package_XX (auto symlink to ../libs/my_package_XX)
| \--other_node_modules_for_main_app_and_all_my_packages
\--libs
| \--my_package_1
| | \--app
| | | \-- some_kind_of_demo_usage
| | \--lib
| | | \--src
| | | | \--my_module.ts
| | | \--public_api.ts
| | | \--package.json
| | \--package.json
| | \--scripts
| | \--install: ng-packagr -p lib/package.json
| \--my_package_2
| \--my_package_XX
\--src
| \--some_kind_of_main_angular_application
\--tsconfig-flat.json
| \--compilerOptions:baseUrl: my_package_1 -> my_package_1/lib/
| \--compilerOptions:baseUrl: my_package_XX -> my_package_XX/lib/
\--tsconfig-use-packages.json
| \--compilerOptions:baseUrl: my_package_1 -> my_package_1/dist/package
| \--compilerOptions:baseUrl: my_package_XX -> my_package_XX/dist/package
\--package.json
\--workspaces
\--libs/*
When I run yarn command inside root folder of my project:
- yarn install all dependences for main application and for all my node packages in root node_modules directory.
- yarn create symlinks from all my node packages to root node_modules directory (as npm link).
- yarn run install scripts in all my installed node packages (inside node_modules directory). and this last point not work for my packages with angular modules because in this file https://github.com/dherges/ng-packagr/blob/master/src/lib/ts/analyse-dependencies-transformer.ts ng-packagr exclude all files, containing ‘/node_modules/’ string in their paths.
How To Reproduce
It can be reproduced if you make local install via npm link any node package and if you try to build your angular package with ng-packagr via [post/pre]install script. Because both npm and yarn for local installation jist create symlinks and then try to run install script inside.
I think it is important bug for utility which tries to implement the creation of packages.
Expected Behaviour
ng_packagr should not simply drop all paths containing nodel_modules string, but analyze whether this path leads to the current package folder installed in the module_module.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 2.4.2
@angular/compiler: 5.2.9
@angular/compiler-cli: 5.2.9
rollup: 0.55.5
tsickle: 0.27.5
typescript: 2.6.2
$ yarn -v
1.5.1
$ npm -v
5.6.0
$ ver
Microsoft Windows [Version 6.1.7601]
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I believe I also have this issue. We pull in source code for our library into node_modules and then run the cli build there. It appears the result is it can’t find .ts files to roll into the FESM2015 bundle.
Is there any workaround for this? I notice the link to the transformer no longer works which tells me the code has since been refactored? https://github.com/dherges/ng-packagr/blob/master/src/lib/ts/analyse-dependencies-transformer.ts
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.