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(nx): project.targets.build.options could be undefined #26

Closed
wants to merge 2 commits into from

Conversation

NexZhu
Copy link
Contributor

@NexZhu NexZhu commented Dec 19, 2023

This fix the issue that the last line below will throw an error if build.options is undefined:

export async function getNxTrueAffectedProjects(
  cwd: string
): Promise<TrueAffectedProject[]> {
  const projects = await getNxProjects(cwd);

  return projects.map(({ name, project }) => {
    let tsConfig = project.targets?.build?.options.tsConfig;
TypeError: Cannot read properties of undefined (reading 'tsConfig')
    at file:///root/dev/web/web-monorepo-starter/node_modules/.pnpm/@traf+nx@0.0.17/node_modules/@traf/nx/cli.js:299:51
    at Array.map (<anonymous>)
    at getNxTrueAffectedProjects (file:///root/dev/web/web-monorepo-starter/node_modules/.pnpm/@traf+nx@0.0.17/node_modules/@traf/nx/cli.js:298:19)
    at async affectedAction (file:///root/dev/web/web-monorepo-starter/node_modules/.pnpm/@traf+nx@0.0.17/node_modules/@traf/nx/cli.js:337:18)
    at async Object.handler (file:///root/dev/web/web-monorepo-starter/node_modules/.pnpm/@traf+nx@0.0.17/node_modules/@traf/nx/cli.js:443:5)
[root@Nife web-monorepo-starter]# git commit -m "setup(root): add scripts/tsconf
ig.json to root \"sourceRoot\" to workaround @traf/nx issue"

@EladBezalel
Copy link
Collaborator

Hey, thanks for this PR! Can you please add tests?

@NexZhu NexZhu force-pushed the fix/build-options-undefined branch from f13a534 to ad4aab1 Compare December 21, 2023 06:48
@NexZhu
Copy link
Contributor Author

NexZhu commented Dec 21, 2023

@EladBezalel Test added :)

@EladBezalel
Copy link
Collaborator

Fixed in v0.0.19
thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants