Skip to content
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

Custom folder structure causes node_modules folder to be left in output directory full of README.md files #2418

Closed
jdforsythe opened this issue Aug 31, 2022 · 1 comment · Fixed by #2419
Labels

Comments

@jdforsythe
Copy link

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

A bug: please describe the error that you encountered

We use a slightly customized setup because we only ever have one library in each repo. So instead of the projects subfolder, we simply use the root of the repo as the project folder.

So instead of /projects/my-lib/src we simply put our library in /src. This has worked fine until we upgraded Angular from v12 to v14.

Now when we build (our destination folder is /lib, not the default /dest), our output folder contains a node_modules folder, which contains a folder for what appears to be each of our dev dependencies and all the downstream dependencies, but those folders contain only README.md and nothing else.

Screen Shot 2022-08-31 at 2 14 52 PM

How To Reproduce

A bug: please include instructions how to reproduce. Issues without reproduction are likely to receive no feedback.

Reproduction based on below steps is here

ng new my-workspace --no-create-application`
cd my-workspace
ng generate library my-lib
  1. Move the contents of projects/my-lib (except package.json and README.md) into the root of the repo

  2. Open the root package.json, change the name to my-lib, remove all the dependencies and add angular/rxjs as peerDependencies and add necessary devDependencies from projects/my-lib:

    "peerDependencies": {
      "@angular/core": "14",
      "@angular/forms": "14",
      "@angular/router": "14",
      "rxjs": "7"
    },
    "devDependencies": {
      "@angular-devkit/build-angular": "14",
      "@angular/cli": "14",
      "@angular/compiler": "14",
      "@angular/compiler-cli": "14",
      "@angular/core": "14",
      "@angular/forms": "14",
      "@angular/platform-browser": "14",
      "@angular/platform-browser-dynamic": "14",
      "@angular/router": "14",
      "@types/jasmine": "~4.0.0",
      "@types/jasminewd2": "~2.0.3",
      "jasmine-core": "~4.3.0",
      "jasmine-spec-reporter": "~5.0.0",
      "karma": "~6.4.0",
      "karma-chrome-launcher": "~3.1.0",
      "karma-coverage": "~2.2.0",
      "karma-jasmine": "~5.1.0",
      "karma-jasmine-html-reporter": "~2.0.0",
      "ng-packagr": "14",
      "protractor": "~7.0.0",
      "ts-node": "~8.3.0",
      "tslib": "^2.3.1",
      "typescript": "~4.7.2",
      "zone.js": "~0.11.4"
    },
    "dependencies": {}
  3. Update angular.json paths:

  • root: ./
  • sourceRoot: ./src
  • architect.build.options.tsConfig: ./tsconfig.lib.json
  • architect.build.options.project: ./ng-package.json
  • architect.build.configurations.production.tsConfig: ./tsconfig.lib.prod.json
  1. Update destination folder and schema for ng-package.json (remove ../.. so it's just ./node_modules/... and set dest to lib/
  2. Update all the tsconfig.* files to reference e.g. ./tsconfig.json
  3. Run ng build --configuration production

At this point, there will be a lib folder containing the build, which also contains a node_modules folder with a bunch of README.md files in it

Screen Shot 2022-08-31 at 2 25 05 PM

Expected Behaviour

A bug: please describe what behaviour or result you expected

Before upgrading to Angular v14 the output folder did not contain this node_modules folder full of READMEs. Before changing the source and destination folders, running build produces a clean dist folder without this node_modules folder.

My guess is either the node_modules folder (and only the markdown files inside it) are erroneously being copied into the destination or the full node_modules folder is copied over and later cleaned up but there's an issue with removing the README files.

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr:            14.2.0
@angular/compiler:     14.2.0
rollup:                2.79.0
typescript:            4.7.4
node: 16.15.0
npm: 8.5.5
yarn: 1.22.19

Please include all version numbers that might be relevant, e.g. third-party libraries

@github-actions
Copy link

github-actions bot commented Oct 2, 2022

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.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

2 participants