a8cteam51 / team51-project-scaffold

GNU General Public License v3.0
5 stars 5 forks source link

Add build scripts #22

Open otakupahp opened 4 months ago

otakupahp commented 4 months ago

Description

The composer.json file is great for dev, but needs extra scripts to make an easy build deployment.

Additional context

Usually I update the file to include additional scripts needed to deploy to production:

after "internationalize" scripts

    "localize": [
      "@makemo:theme",
      "@makemo:blocks",
      "@makemo:features"
    ],

And this before "packages-install"

    "install-build": [
      "@composer run-script internationalize",
      "@composer run-script localize",
      "@composer install --no-dev -o"
    ],

This way, when I need to push this, then I just run the install-build script

otakupahp commented 3 months ago

Improved a bit, moved the install-build before packages-install to the end of scripts

    "install-build": [
      "@composer run-script packages-install",
      "@format:php",
      "@lint:php",
      "@internationalize",
      "@localize",
      "@composer install --no-dev -o"
    ]
otakupahp commented 3 months ago

Final improvement adding scripts:

Added this to package.json

"build-production": "npm-run-all --sequential format:scripts format:styles lint:scripts lint:styles build",

And added this to composer.json

"npm run build-production"

so, when I run install-build I have everything in on command

The full script:

    "install-build": [
      "@composer run-script packages-install",
      "@format:php",
      "@lint:php",
      "@internationalize",
      "@localize",
      "@composer install --no-dev -o",
      "npm run build-production"
    ]
ahegyes commented 3 weeks ago

This is pretty cool! I'll look into it again after my AFK 😄