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

Implement npm workspaces #1653

Open
wants to merge 65 commits into
base: main
Choose a base branch
from
Open

Implement npm workspaces #1653

wants to merge 65 commits into from

Conversation

infomiho
Copy link
Contributor

@infomiho infomiho commented Jan 21, 2024

We had some issues with duplicate package installations and resolution issues since we are effectively managing multiple packages e.g. sdk, web app and server.

npm has a feature called workspaces that solves the issue of multiple packages having deps that they need: https://docs.npmjs.com/cli/v8/using-npm/workspaces

Specifying our packages in the workspaces field, and running a single npm install in the root of the project achieves the following:

  • there is only one node_modules in the root of the project
  • deps are "deduped" automatically e.g. there isn't react in the root dir and in the web app dir
  • we shouldn't have Prisma and React problems like we did before
  • npm install has to be run only in one folder i.e. project root

Warning

I've tested out this locally and it worked for me with the prototype. This should be tested more with different fail cases we had. Also, wasp build should be tested as well.

@@ -181,27 +166,3 @@ installProjectNpmDependencies messagesChan projectDir =
case J._data jobMsg of
J.JobOutput {} -> printJobMessagePrefixed jobMsg >> processMessages chan
J.JobExit {} -> return ()

installWebAppAndServerNpmDependencies ::
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the project root npm install handles all of the subpackages we define, no need to run separate npm install for the subpackages.

Base automatically changed from filip-sdk to filip-restructuring January 29, 2024 15:08
Base automatically changed from filip-restructuring to main January 29, 2024 16:23
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.

None yet

2 participants