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

Move Strapi dependencies to main package.json ? #27

Open
Pii2 opened this issue Nov 27, 2021 · 2 comments
Open

Move Strapi dependencies to main package.json ? #27

Pii2 opened this issue Nov 27, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@Pii2
Copy link

Pii2 commented Nov 27, 2021

To follow the mono repository approach, it should be possible to install the dependencies for Strapi in the general node_modules folder, instead of in a separate one inside the app folder.

Is this possible ?

@TriPSs
Copy link
Owner

TriPSs commented Nov 29, 2021

I think this should be possible yes, but since we use the strapi provided package to generate the project its placed there. You can if you want move the deps from that one manually to the root package.

We could also update the generator to move all the deps after it generated the project to the root package.json

@TriPSs TriPSs added the enhancement New feature or request label Nov 29, 2021
@boar-is
Copy link

boar-is commented Dec 24, 2021

Also, keep in mind that you have to set cwd to process.cwd() because if you run npx strapi build in an application folder (not root), the build will fail since Strapi internals check for package.json file alongside Strapi app.

Even so, npx strapi develop must be executed within Strapi app because it requires src folder. The bad part is that npx strapi develop also requires you to have a package.json within Strapi app. So the workaround is to create a package.json that meets Strapi requirements:

{
  "dependencies": {
    "@strapi/strapi": "*"
  }
}

But, based on this, you don't have to run npx strapi build in a root anymore. In general, everything is not so straightforward :)

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

No branches or pull requests

3 participants