superhuit-agency / superstack

Our opinionated headless WordPress boilerplate - with GraphQL, RSC, PostCSS
MIT License
24 stars 4 forks source link

Setup simplification / npm scripts #52

Open kuuak opened 3 months ago

kuuak commented 3 months ago

To simplify the setup, we could use the power of npm life-cycle scripts.

For instance instead of having to run a command to install both root & wp deps, we can add a postinstall to install WP deps

diff --git a/package.json b/package.json
   "scripts": {
+    "postinstall": "npm --prefix ./wordpress install",
      "dev": "next dev",
      "build": "next build",
      "start": "next start",

Which would simplify the setup


diff --git a/docs/setup/installation.md b/docs/setup/installation.md
    -   `cp .env.local.example .env.local` - make default environment variables available to Next.js, Storybook and WordPress
    -   `nvm use`
-   -   `npm install` - install global packages
+   -   `npm install` - install packages
-   -   `npm --prefix ./wordpress install` - install WordPress-specific packages

### WordPress