CLI Usage
The ExisJS CLI (exis / exisjs) can be executed in two primary contexts: globally / on-demand via npx, or locally via your project's package.json scripts.
Global vs. Local Execution
When bootstrapping a brand-new project, invoke the initialization tool using npx:
$ npx exisjs init my-apiOnce inside an initialized ExisJS project, execution through npm run ensures deterministic behavior pinned to the local exisjs version in node_modules.
Default Package Scripts
Every ExisJS project scaffolded with init includes the standard script targets in package.json:
{ "scripts": { "dev": "exisjs dev", "build": "exisjs build", "start": "exisjs start", "test": "exisjs test" }}Invoke these scripts using your package manager:
$ npm run dev$ npm run build$ npm run start$ npm testPassing Arguments via Scripts
To pass options through npm run, append a double-dash (--) before the CLI flags:
# Start the dev server on port 5000$ npm run dev -- -p 5000
# Run a specific test file$ npm test -- tests/users.test.tsDirect commands can also be called via npx exisjs:
# Scaffold a new resource slice$ npx exisjs g resource users
# Print the routing table$ npx exisjs routes
# Inspect available public exports$ npx exisjs exportsRecommended Workflow
- Use
npx exisjs init <name>to scaffold new applications. - Use
npm run devfor local hot-reloading development with automatic port conflict handling. - Use
npx exisjs generate <type> <name>to scaffold file conventions (route,service,schema,boundary,resource). - Use
npm testto run the integrated test runner. - Use
npm run buildandnpm run startfor production deployment.