Open
Description
What's the problem?
The existing setup required maintaining 12 nearly identical scripts in package.json
to support all combinations of run
/build
, chrome
/firefox
, and local
/sandbox
/production
. This was error-prone, hard to update, and added unnecessary duplication.
What's your solution?
Refactor the scripts into a single dynamic Bash script (ceb.sh
) that takes action, scope, and environment as arguments. Update package.json
to follow the consistent pattern:
pnpm <action>:<scope>:<env>
Example:
pnpm run:chrome:local
pnpm build:firefox:production
This approach uses the same underlying logic for all combinations, simplifies maintenance, and ensures consistency across environments.
Any alternatives?
- Use a Node.js CLI tool (instead of Bash) for cross-platform compatibility.
- Use
zx
for more flexible and readable scripting in the future. - Dynamically register commands via a custom CLI tool instead of hardcoding them into
package.json
.
Anything else?
This refactor improves maintainability and DX. Follow-up actions could include:
- Adding CI support using the same command structure.
- Adding validation or auto-completion with a custom CLI wrapper.