More One CLI

/buildawesome-one/kit/tree/main/cli

npm install @buildawesome.one/cli

Reuse it in your project by linking under .cli/ subfolder like this:

mkdir .cli
cd .cli/
ln -s ../node_modules/@buildawesome.one/cli/package.json
cd ..

Finally, register it in your package.json like this:

  "scripts": {
    "cli": "npm -C .cli/ run",
    "start": "npm run cli -- start",
    "stage": "npm run cli -- stage",
    "build": "npm run cli -- build"
  },
Done! 🥷
@buildawesome.one/cli's npm run start / stage / build ready to use in your project, yet easy to maintain!

Live example: /buildawesome-one/kit/tree/main/cli/e2e


Appendix

How it works:

{
  "name": "@buildawesome.one/cli",
  "version": "1.5.1",
  "bin": "bin/dev.js",
  "type": "module",
  "scripts": {
    "ba": "cd ../ && NODE_OPTIONS=--preserve-symlinks ${BA_CMD:-buildawesome} ${BA_OPTIONS}",
    "build": "npm run ba",
    "start": "npm run ba -- --serve --incremental",
    "stage": "rm -r ../_site; npm run build && serve ../_site/",
    "? stage": "1) !!! `rm -r` w/o trailing slash to avoid symlink catastrophe 2) `;` to bypass no dir errors",
    "--- TAILWIND": "written so that extra arguments can be passed",
    "tw": "[ -z \"$TW_OPTIONS\" ] && exit 0; cd ../ && tailwindcss ${TW_OPTIONS}",
    "build+tw": "npm run tw && npm run build",
    "start+tw": "trap 'kill 0' INT; npm start & npm run tw -- --watch & wait",
    "? start+tw": "1) `&` for parallel run 2) `tw` is last to stay alive 3) trap/wait for graceful exit",
    "stage+tw": "npm run tw && npm run stage"
  },
  "--- METADATA": "---",
  "author": "Anton Staroverov",
  "homepage": "https://buildawesome.one/cli/",
  "keywords": [
    "11ty",
    "buildawesome",
    "buildawesome-one",
    "cli",
    "eleventy"
  ],
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/buildawesome-one/kit.git",
    "directory": "cli/"
  },
  "---": "---"
}

Find and kill 11ty processes

ps aux | grep eleventy
pkill -f eleventy

You can even combine it with other processes hanging around:

ps aux | grep -E 'eleventy|tailwind|.bin/serve'
pkill -f tailwind
pkill -f .bin/serve