Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: prefix all nx package scripts with npx #7988

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

Merged

Conversation

JoshuaKGoldberg
Copy link
Member

PR Checklist

Overview

Prefixes all the commands that use nx with npx .

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Nov 24, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 518dff3
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/656078b5000bc700084e87fe
😎 Deploy Preview https://deploy-preview-7988--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 96 (🟢 up 5 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@merceyz merceyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with the inner workings of npx but wont this use whatever version is installed globally and if none is found prompt the user to install it?

This repository also doesn't use npm so this doesn't seem like an ideal solution.

If what you're after is using the nx version installed in the root workspace then you should use yarn run -T nx or run -T nx.
If not then you should add nx as a dependency to each workspace that needs it.

Ref https://yarnpkg.com/getting-started/qa#how-to-share-scripts-between-workspaces
Ref #7987 (comment)

@bradzacher
Copy link
Member

Could we just add nx as a dep and then prefix with yarn instead?

@JoshuaKGoldberg
Copy link
Member Author

JoshuaKGoldberg commented Nov 24, 2023

Swapping "start": "npx nx start" with "start": "yarn nx start" yields:

josh ~/repos/typescript-eslint/packages/website $ yarn start
Usage Error: Couldn't find a script named "nx".

Same with yarn run nx start. I've been reading through https://nx.dev/core-features/run-tasks & co but don't see any recommendations around this?

cc @JamesHenry too

@bradzacher
Copy link
Member

Yeah I'm not quite sure - I would have thought that yarn nx would run the locally installed verison of nx - do we need to add nx as a dependency to each and every package so that yarn can see it?

IDK how Yarn3 works - you didn't need to do that with yarn1 as it'd just look in the parent folder.

@JamesHenry
Copy link
Member

How frustrating yeah this definitely worked fine in yarn 1. FWIW you can also install nx globally one time and it will always work as well, it will resolve your most local installation possible before attempting to run the actually globally installed code.

I’ll need to play with this to get a real sense of what might optimal here, I’m afraid I lost all of the weekend because of moving apartments and my next availability will be this coming weekend, so feel free to do whatever makes the most sense in the immediate term if this is blocking

@JoshuaKGoldberg JoshuaKGoldberg merged commit 4dae083 into typescript-eslint:main Nov 28, 2023
@JoshuaKGoldberg JoshuaKGoldberg deleted the prefix-nx-with-npx branch November 28, 2023 14:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 6, 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.

Repo: Many dev commands require a global nx command
4 participants