About this tool
Compose npm scripts with pre/post hooks, sequential and parallel combinations, and cross-platform safety checks for Windows shells.
This builder composes an npm scripts block with automatic pre/post hooks, combined sequential (run-s, &&) or parallel (run-p, concurrently) runners, and a cross-platform audit based on how npm executes scripts through cmd.exe on Windows. It is for JavaScript developers who want lint-test-build pipelines in package.json that behave identically on macOS, Linux and Windows, and it tells you exactly which devDependencies (npm-run-all, concurrently, cross-env, rimraf) the generated block needs.
Open npm Scripts Builder on AltFTool — it loads instantly in your browser.
Provide your input — an image, text, or data.
Let the tool analyze or generate the result.
Review, refine, and reuse the output wherever you need it.
Detects pre/post pairs and shows which scripts npm will chain automatically — and which orphan hooks never fire.
Generates run-p or concurrently commands instead of the & operator that cmd.exe treats as sequential.
Flags inline env vars, rm/cp/mv, single quotes and $VAR expansion with the standard portable fix for each.
For any script named X, npm automatically runs preX before it and postX after it whenever you invoke npm run X. So defining pretest = npm run lint makes every npm test run the linter first — no extra tooling needed. Note that pnpm does not run these hooks by default (enable-pre-post-scripts must be set).
Use npm-run-all's run-p command (run-p watch:css watch:js) or concurrently (concurrently "npm:watch:css" "npm:watch:js"). The shell form npm run a & npm run b is not portable — on Windows cmd.exe a single & is a sequential separator, so the second command waits for the first.
Because npm runs scripts through cmd.exe by default, and cmd has no VAR=value prefix syntax — it fails with "'NODE_ENV' is not recognized". The standard fix is the cross-env package: cross-env NODE_ENV=production node app.js works in every shell.
npm-run-all covers both directions: run-s runs scripts sequentially and run-p in parallel, with glob support like run-p watch:*. concurrently focuses on parallel execution with better output labelling, colouring and kill-others behaviour for long-running dev processes. Many projects use run-s for builds and concurrently for dev servers.