nx-extend icon indicating copy to clipboard operation
nx-extend copied to clipboard

Move Strapi dependencies to main package.json ?

Open Pii2 opened this issue 4 years ago • 2 comments

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 ?

Pii2 avatar Nov 27 '21 19:11 Pii2

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 avatar Nov 29 '21 15:11 TriPSs

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 :)

boar-is avatar Dec 24 '21 15:12 boar-is