75 lines
3.2 KiB
Markdown
75 lines
3.2 KiB
Markdown
# Instrucciones para GitHub Copilot 🔧
|
|
|
|
**Resumen breve**
|
|
Quasar es una aplicación web para gestionar una biblioteca personal de videojuegos. Este repositorio está en estado inicial: contiene `package.json` y `README.md` pero no hay código fuente ni tests aún. Prioridad: configurar pruebas (Playwright), scripts útiles y prácticas de seguridad para manejar claves/API.
|
|
|
|
## Estilo de código ✅
|
|
|
|
- Mantener **CommonJS** (`type: commonjs` en `package.json`).
|
|
- Añadir ESLint + Prettier para consistencia (recomendado si se añade código).
|
|
|
|
## Build y Test 🧪
|
|
|
|
- Instalación: `yarn install` (usar Yarn/local; `packageManager` se indica en `package.json`).
|
|
- `package.json` actual tiene un `test` placeholder. Reemplazar por un runner real tras inicializar Playwright. (recomendado)
|
|
- Inicializar Playwright: `npx playwright test --init`. (recomendado)
|
|
- Instalar dependencias de navegadores: `npm run test:install` (sugerido script abajo).
|
|
- En CI: `yarn install && yarn test:install && yarn test`.
|
|
|
|
## Convenciones 🔁
|
|
|
|
- Código fuente: `src/` (recomendado).
|
|
- Tests: `tests/*.spec.(js|ts)` (recomendado).
|
|
- Preferir tests reproducibles y ejemplo básico al iniciar el proyecto. (recomendado)
|
|
|
|
## Puntos de integración 🔗
|
|
|
|
- `README.md` menciona fuentes de metadatos: **IGDB**, **Screenscraper**, **MobyGames**. Documentar qué APIs se usarán y dónde se guardan claves. (recomendado)
|
|
- Guardar tokens en variables de entorno y no en el repositorio.
|
|
|
|
## Seguridad 🔒
|
|
|
|
- `.gitignore` ya incluye `.env` — **no** commitear archivos con secretos.
|
|
- Usar GitHub Secrets para credenciales en workflows. (recomendado)
|
|
|
|
## Scripts sugeridos para `package.json` (ejemplo)
|
|
|
|
```json
|
|
"scripts": {
|
|
"test": "playwright test",
|
|
"test:install": "playwright install --with-deps",
|
|
"test:ci": "playwright test --reporter=github",
|
|
"lint": "eslint . --ext .js,.ts",
|
|
"format": "prettier --write .",
|
|
"start": "node src/index.js"
|
|
}
|
|
```
|
|
|
|
> Nota: el `test` actual es `echo "Error: no test specified" && exit 1`. Reemplazarlo por `playwright test` tras inicializar tests. (recomendado)
|
|
|
|
## Pasos rápidos iniciales ▶️
|
|
|
|
1. `yarn install`
|
|
2. `node -v` (asegurar **Node >= 18**)
|
|
3. `npx playwright test --init`
|
|
4. `yarn test:install`
|
|
5. `yarn test` (validar que al menos un test ejemplo pase)
|
|
|
|
## Estado actual (modificaciones aplicadas) ✅
|
|
|
|
- Añadidos: `.eslintrc.cjs`, `.prettierrc`, `tsconfig.json`, `.eslintignore`, `.prettierignore`.
|
|
- Inicializado Playwright: `playwright.config.ts` y `tests/example.spec.ts` (TypeScript).
|
|
- Actualizados: `package.json` — scripts (`test`, `test:install`, `lint`, `format`, `start`) y `packageManager` (ahora `yarn@4.12.0`).
|
|
- Dependencias dev instaladas con Yarn: ESLint, Prettier, TypeScript, `@typescript-eslint/*` y Playwright.
|
|
- Resultado: `yarn test` pasó (3 tests) en Chromium, Firefox y WebKit.
|
|
|
|
---
|
|
|
|
¿Feedback rápido? Si quieres, puedo:
|
|
|
|
- Scaffold inicial (crear `src/`, `tests/example.spec.js`, actualizar `package.json` con scripts).
|
|
- Añadir ESLint + Prettier y sus scripts.
|
|
- Proponer un workflow de GitHub Actions para ejecutar tests en PRs.
|
|
|
|
Por favor indica si prefieres **JavaScript** o **TypeScript** para el scaffold (recomendado: JavaScript si no quieres migrar a TS ahora).
|