-
Notifications
You must be signed in to change notification settings - Fork 7
CLI scripts
Summary: This page documents the productivity scripts provided with StartER via npm run commands.
StartER comes with several scripts centralizing repetitive tasks (module creation, cleaning, database synchronization, code quality checking). These commands facilitate development and ensure project consistency.
All the commands listed below can be run directly in your terminal with npm run.
| Command | Description |
|---|---|
npm run make:clone |
Duplicates an existing module with automatic renaming |
npm run make:purge |
Removes example modules (item, auth, user) |
npm run database:schema:load |
Loads the SQL schema into the SQLite database |
npm run database:seeder:load |
Loads the test data into the SQLite database |
npm run database:sync |
Loads the SQL schema and the test data into the SQLite database |
npm run install:check |
Verifies the installation and the database file accessibility |
npm run biome:check |
Checks code style and quality with Biome |
npm run biome:fix |
Automatically fixes formatting issues (Biome) |
npm run types:check |
Checks TypeScript typing (tsc --noEmit) |
Duplicates a file or folder, automatically replacing all occurrences of a name with another:
npm run make:clone -- <source> <destination> <OldName> <NewName>For example, to create a post module from the item module:
npm run make:clone -- src/express/modules/item src/express/modules/post Item PostTip
Remember to register the new cloned module's routes in src/express/routes.ts.
Warning
The clone trade-off (WET code)
While make:clone is fantastic for rapid, isolated prototyping, it favors a WET (Write Everything Twice) approach. If you find yourself repeatedly adding the same logic (like identical validation rules, formatting, or auth checks) across multiple cloned modules, it might be a good time to extract that shared logic into the src/express/helpers/ or src/react/helpers/ directories.
Removes the example modules for a fresh start:
npm run make:purgeTo keep authentication:
npm run make:purge -- --keep-authWarning
This operation is reversible thanks to version control with Git.
Loads the SQL schema (src/database/schema.sql) into the SQLite database.
npm run database:schema:loadTo bypass the confirmation prompt (useful in CI/CD):
npm run database:schema:load -- -nLoads the test data (src/database/seeder.sql) into the SQLite database.
npm run database:seeder:loadTo bypass the confirmation prompt (useful in CI/CD):
npm run database:seeder:load -- -nResets your local SQLite database (data/sqlite/database.sqlite) from the SQL schema and the test data.
npm run database:syncThis is equivalent to:
npm run database:schema:load && npm run database:seeder:loadTo bypass the confirmation prompt (useful in CI/CD):
npm run database:sync -- -nVerifies that your .env file is correct and that the application can access the SQLite database file:
npm run install:checknpm run biome:check # Checks formatting
npm run biome:fix # Fixes formatting
npm run types:check # Checks typing-
Clean reset: use
npm run database:syncregularly during development to restart from a known and clean database state. -
Pre-commit check: the pre-commit hook runs
npm run types:check,npm run biome:checkandnpx vitest run --exclude tests/install. You can run them manually before committing your changes to ensure the code meets project standards. - Zero-Config: thanks to SQLite, none of these scripts require launching Docker beforehand, making the development cycle much faster.
AI co-creation
Getting started
Explanations
How-To Guides
Reference
Digging deeper