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

Deploy NPM Workspaces #146

Open
h1sashin opened this issue Sep 22, 2022 · 1 comment
Open

Deploy NPM Workspaces #146

h1sashin opened this issue Sep 22, 2022 · 1 comment

Comments

@h1sashin
Copy link

Hello, I have a problem with deploying npm workspaces/monorepo, I want to deploy ONLY the server file with my NestJS app, but pipeline screams that some packages are not found or types are wrong, how can I "wrap" my server package with files like package-lock.json or tsconfig.base.json? Do I need to dockerize my app? If yes, could someone explain how to do this?

@oswaldoacauan
Copy link

For future reference and for anyone that is running a monorepo using NPM workspaces.

You can workaround this issue by using the workspace option inside .npmrc file. This will make all npm commands to respect your workspace option, and that includes the npm ci that is automatically run in Heroku.

If anyone is deploying via Github Actions and using heroku-deploy action you can do something similar to this:

- name: ⬇️ checkout repo
  uses: actions/checkout@v4

- name: 🥁 update .npmrc with workspace option
  run: |
    printf "\nworkspace=\"your-app\"" >> .npmrc
    cat .npmrc
    git config --global user.email "${{secrets.HEROKU_DEPLOYMENT_EMAIL}}"
    git config --global user.name "github-actions[bot]"
    git add -A && git commit -m "updated .npmrc with workspace option"

- name: ♊️ deploy to heroku
  uses: akhileshns/[email protected]
  ...

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

No branches or pull requests

2 participants