Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

75 changes: 0 additions & 75 deletions .eslintrc

This file was deleted.

47 changes: 47 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Simba.js agent instructions

## What this repo is
- Simba.js is a Node.js CLI that scaffolds TypeScript backend projects (`bin/index.js` → `lib/index.js` → `lib/src/index.js`).
- The generator writes files, installs deps, runs `prisma generate`, and initializes git for the target project folder.
- Most generated source files are embedded as template strings inside generator modules (not separate template files).

## Core architecture you must preserve
- CLI parsing and interactive mode live in `lib/index.js` (yargs + prompts). Keep option names/aliases aligned with README help text.
- Orchestration is in `lib/src/index.js`; cross-cutting generation happens via `lib/src/functions/*`.
- API generation branches by framework + GraphQL + database in:
- `lib/src/functions/api/index.js`
- `lib/src/functions/api/express.js`
- `lib/src/functions/api/fastify.js`
- `lib/src/functions/api/{database,schemas,services,utils}.js`
- Generated app structure follows layered boundaries (network, services, database, schemas, utils), described in `README.md` and implemented in the API generator modules.

## High-value workflows
- Run CLI locally: `npm run service` or `npm run service:q`.
- Lint generator source: `npm run lint` (Biome writes fixes), CI mode: `npm run lint:ci`.
- Rebuild all example outputs: `npm run build` (or targeted `build:express:*` / `build:fastify:*`).
- Main regression suite for generator outputs: `npm test`.
- `npm test` runs build + per-example tests and then `git restore .`.
- Use `npm run test:local` if you do not want the automatic restore step.
- Integration DB checks are separate: `npm run test:integration`.

## Environment and DB assumptions
- Node.js `>=20` is required (`package.json` engines).
- Root DB scripts and integration tests expect env vars:
- SQL: `DATABASE_URL`
- Mongo: `MONGO_URI`
- Generator behavior for `.env` values depends on `NODE_ENV` (`ci`/`local` use external URIs; otherwise defaults are scaffolded) in `lib/src/functions/api/index.js`.

## Project-specific coding conventions
- Generator runtime code is CommonJS (`require`, `module.exports`), while generated app code is TypeScript strings.
- Formatting/linting is Biome-based; prefer existing style: single quotes, no semicolons, 2-space indent.
- Keep changes symmetric across variants; if editing generated behavior, verify impact across:
- Express vs Fastify
- REST vs GraphQL
- Mongo vs SQL databases
- When changing generated package scripts/dependencies/config, update corresponding generator functions (`packageJson.js`, `biome.js`, `tsconfig.js`, `ghat.js`) rather than editing `example/*` directly.

## Practical change strategy for agents
- First edit generator modules in `lib/src/functions/*`.
- Then regenerate affected examples with targeted `npm run build:*` scripts.
- Validate with focused tests for touched examples, then broader `npm test` if needed.
- If docs/CLI flags change, keep `README.md` and `lib/index.js` in sync.
34 changes: 15 additions & 19 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,21 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
cache: "npm"

- name: Install Node.js dependencies
run: npm i --frozen-lockfile
run: npm ci

- name: Run linter
uses: wearerequired/lint-action@v2
with:
auto_fix: true
eslint: true
eslint_extensions: js
run: npm run lint:ci

test-sql:
name: Tests for Simba APIs with sql
Expand All @@ -37,21 +33,21 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
cache: "npm"

- name: Install Node.js dependencies
run: npm i --frozen-lockfile
run: npm ci

- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 9.x.x

Expand All @@ -70,21 +66,21 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
cache: "npm"

- name: Install Node.js dependencies
run: npm i --frozen-lockfile
run: npm ci

- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 9.x.x

Expand Down
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
"Andree",
"andreewa",
"anthonylzq",
"biomeignore",
"dirsfirst",
"eslintignore",
"fullname",
"hstore",
"LGPL",
"mariadb",
"nargs",
"nodemon",
"Securitec",
"sequelizerc",
"sqlserver",
"unlicensed",
"wearerequired"
]
}
],
"cSpell.language": "en,es-ES"
}
60 changes: 60 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"lineEnding": "lf"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useConst": "error",
"noParameterAssign": "off"
},
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noExplicitAny": "off"
}
}
},
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
},
"formatter": {
"quoteStyle": "single",
"quoteProperties": "asNeeded",
"trailingCommas": "none",
"semicolons": "asNeeded",
"arrowParentheses": "asNeeded",
"bracketSpacing": true
}
},
"json": {
"formatter": {
"trailingCommas": "none"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
18 changes: 18 additions & 0 deletions example/express-graphql/.biomeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Build outputs
dist/
build/

# Dependencies
node_modules/

# Test coverage
coverage/

# Environment files
.env*

# Logs
*.log

# Database
prisma/migrations/
1 change: 0 additions & 1 deletion example/express-graphql/.eslintignore

This file was deleted.

Loading