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

NEX-175: Add the possibility of running npx commands in lando #258

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Conversation

vermario
Copy link
Collaborator

This branch adds the npx command to lando.

To test:

  1. switch to this branch
  2. if you were working with an app router branch before (it will delete untracked file, so be careful?) git clean -d -f
  3. ./setup-lando.sh -c
  4. stop the server with control-c
  5. cd next (the npx command will be executed in the directory you are in
  6. for example: lando npx shadcn@latest add badge

@@ -154,6 +158,8 @@ services:
# We instruct node to use the Lando CA certificate for HTTPS connections:
NODE_EXTRA_CA_CERTS: /lando/certs/LandoCA.crt
build:
# This is needed to be able to run lando npx commands:
- "mkdir -p /var/www/.npm-global/lib"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for the nodeuser inside the docker container /var/www is the home folder, the directory needs to be there for npx to work, apparently.

Copy link
Member

Choose a reason for hiding this comment

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

tooling:
  npx:
    service: node

doesn't work?

Copy link
Collaborator

@jekku123 jekku123 Oct 19, 2024

Choose a reason for hiding this comment

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

Seems to work both ways.

Lets add

dir: /app/next

there too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@tormi without this line:

  1. lando destroy
  2. lando start
image

Copy link
Member

Choose a reason for hiding this comment

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

Ok, thanks for the explanation.

Copy link
Member

Choose a reason for hiding this comment

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

I suggest installing npm globally instead. This would be a cleaner solution:

services:
  node:
    type: node:20
    globals:
      npm: latest

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nice! I tested it and it works, let's switch to that.

Committed in faefbac

Copy link
Collaborator

@jekku123 jekku123 left a comment

Choose a reason for hiding this comment

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

Awesome, makes Shadcn'izing much easier :)

@vermario vermario merged commit 0d3605c into main Oct 21, 2024
6 checks passed
@vermario vermario deleted the NEX-175 branch October 21, 2024 04:27
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.

3 participants