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

fix(node): explicitly check that project is a library before updating imports #19040

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Sep 6, 2023

This PR fixes an issue where projects that have no type (e.g. application or library) cause the move/convert-to-monorepo generator to fail. You will see an error like this:

>  NX  Generating @nx/workspace:convert-to-monorepo


 >  NX   unable to find "" in tsconfig.base.json compilerOptions.paths


Error: unable to find "" in tsconfig.base.json compilerOptions.paths
    at updateImports (/Users/zackderose/standalone-example/node_modules/@nx/workspace/src/generators/move/lib/update-imports.js:75:23)
    at moveGeneratorInternal (/Users/zackderose/standalone-example/node_modules/@nx/workspace/src/generators/move/move.js:43:40)
    at async moveGenerator (/Users/zackderose/standalone-example/node_modules/@nx/workspace/src/generators/move/move.js:23:5)
    at async monorepoGenerator (/Users/zackderose/standalone-example/node_modules/@nx/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.js:25:9)
    at async /Users/zackderose/standalone-example/node_modules/nx/src/command-line/generate/generate.js:248:26
    at async handleErrors (/Users/zackderose/standalone-example/node_modules/nx/src/utils/params.js:9:16)
    at async Object.handler (/Users/zackderose/standalone-example/node_modules/nx/src/command-line/generate/command-object.js:13:22)

This happens because non-library projects don't have an entry in tsconfig paths, so let's check that projectType === 'library' instead of projectType !== 'application'.


Also, update the node app generator to set e2e project as type: 'application', which caused this issue to surface.

Current Behavior

move and convert-to-monorepo generators fail when project type is undefined.

Expected Behavior

move and convert-to-monorepo generators work even if project type is undefined.

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Sep 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Sep 6, 2023 9:24pm

@FrozenPandaz FrozenPandaz merged commit 214b531 into nrwl:master Sep 7, 2023
3 checks passed
FrozenPandaz pushed a commit that referenced this pull request Sep 7, 2023
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants