wake-runner
v1.0.2
Published
CLI to start Wake storefront projects
Maintainers
Readme
wake-runner
CLI to start Wake storefront projects from the project root.
wake-runner automates two common tasks in Wake projects:
- Start
fbits.storefrontusing the token fromConfigs/settings.json - Start
tailwindcss --watchfor everyinput*.cssfile insideAssets/CSS/
Requirements
- Node.js installed
fbits.storefrontinstalled on your machine and available in your PATH- Tailwind CSS 3.4.18 installed on your machine (via standalone CLI in PATH or npm)—required for compatibility with the Wake template padrão
- A Wake project containing:
Configs/settings.jsonAssets/CSS/
External tools
Before using wake-runner, install the required CLIs on your machine.
fbits.storefront
fbits.storefront is required to start the local Wake Storefront server.
Follow the official Wake Commerce installation guide for your operating system:
- https://wakecommerce.readme.io/docs/local#download
After installation, make sure fbits.storefront is available from your terminal.
Tailwind CSS (v3.4.18)
The default Wake template uses Tailwind CSS and recommends version 3.4.18. You must have this version installed. See the Wake Commerce – Template Padrão (TailwindCSS) documentation for details.
You can install Tailwind in either of these ways:
Standalone CLI (recommended in Wake docs)
Download the Tailwind CSS CLI release v3.4.18, add the binary to your system PATH, and ensure thetailwindcsscommand is available in your terminal.npm
Install globally or in your Wake project:npm install -g [email protected]Or locally in the Wake project:
npm install -D [email protected]
When you run wake tailwind or wake, the CLI will:
- use the local npm Tailwind when
node_modules/.bin/tailwindcssexists in the current project - otherwise use the global
tailwindcsscommand from your PATH
Expected project structure
Run the commands from the root of your Wake project:
your-wake-project/
├── Configs/
│ └── settings.json
└── Assets/
└── CSS/
├── input.css
├── input_login.css
└── input_checkout.csssettings.json must contain an access_token field:
{
"access_token": "your-token-here"
}Installation
Install globally from npm:
npm install -g wake-runnerFor local development of this package, inside the package folder:
npm install -g .Usage
Go to your Wake project root and run one of the commands below.
If you are using a local npm Tailwind installation, run these commands from the same project root where tailwindcss was installed.
Run wake --help at any time to see all commands, flags, and examples directly in the terminal.
Start everything
Starts fbits.storefront and all Tailwind watchers:
wakeExtra flags in wake (all) mode are forwarded to fbits.storefront only. Use wake tailwind [flags] to pass flags to tailwindcss:
wake --port 3000 # passes --port 3000 to fbits.storefront only
wake --no-minify # disables Tailwind minification onlyStart only storefront
wake storefrontOr:
wake-storefrontAny extra flags are forwarded directly to fbits.storefront:
wake storefront --port 3000
wake storefront --port 3000 --save
wake-storefront --port 3000Start only Tailwind watchers
Starts one watcher for each input*.css file found directly inside Assets/CSS/.
wake tailwindOr:
wake-tailwindCSS is minified by default. To disable minification:
wake tailwind --no-minify
wake-tailwind --no-minifyAny other extra flags are forwarded directly to tailwindcss:
wake tailwind --content "./src/**/*.html"
wake-tailwind --no-minify --content "./src/**/*.html"Help
wake --help
wake -hCSS file mapping
Each input file is mapped to an output file by replacing the leading input prefix with output.
Examples:
input.css->output.cssinput_login.css->output_login.cssinput_partner.css->output_partner.css
How it works
wake storefront
- Reads
Configs/settings.json - Extracts
access_token - Forwards any extra flags to
fbits.storefront - Runs:
fbits.storefront --token <access_token> [extra flags]wake tailwind
- Reads files directly from
Assets/CSS/ - Finds files that start with
inputand end with.css - Starts one process per file
- Minification enabled by default; pass
--no-minifyto disable - Forwards any extra flags (other than
--no-minify) totailwindcss - Uses local npm Tailwind when available, otherwise uses the global
tailwindcsscommand:
tailwindcss -i ./Assets/CSS/input.css -o ./Assets/CSS/output.css --watch --minify [extra flags]Errors
The CLI exits with code 1 when:
Configs/settings.jsondoes not existConfigs/settings.jsonis invalid JSONaccess_tokenis missing or emptyAssets/CSS/does not exist- No
input*.cssfiles are found
Notes
- Only files directly inside
Assets/CSS/are scanned - Subdirectories are not scanned
- The CLI uses only Node.js built-in modules
- Tailwind 3.4.18 can be installed via the standalone CLI (add to PATH) or via npm (global or local in the Wake project)
- On Windows, separate commands are exposed as
wake-storefrontandwake-tailwindinstead of names containing: - Any flag not recognized by
wake-runner(--help,--no-minify) is forwarded to the underlying CLI
License
MIT
