This folder lets you develop cnpmcore in a fully provisioned container, either in GitHub Codespaces (in the browser or VS Code) or locally with the Dev Containers extension. It bundles the external services cnpmcore needs (MySQL + Redis) and initializes the development database automatically.
- On GitHub, click Code -> Codespaces -> Create codespace on master.
- Wait for the container to build and
post-create.shto finish (installs deps and creates thecnpmcoredatabase). - Start the registry:
CNPMCORE_DATABASE_NAME=cnpmcore npm run dev
- Open the forwarded port 7001 to reach the registry.
- Install Docker and the Dev Containers extension.
- Open the repo and run Dev Containers: Reopen in Container.
- Same as steps 3-4 above.
See the Compose file for services and connection settings. Keep Redis running during tests. The test setup clears the test cache.
# Start the dev registry (MySQL)
CNPMCORE_DATABASE_NAME=cnpmcore npm run dev
# Run the full test suite (creates its own cnpmcore_unittest_* databases)
npm run test
# Run a single test file (fast)
npm run test:local test/path/to/file.test.ts
# Lint / format / type-check in one pass
npx vp check
npm run devneedsCNPMCORE_DATABASE_NAME=cnpmcorebecause the dev database name is intentionally not set globally (that keeps the test suite'scnpmcore_unittest_*databases separate from your dev data).
- In
docker-compose.yml, uncomment thepostgresservice and thecnpm-postgresvolume. - On the
appservice, set:and changeCNPMCORE_DATABASE_TYPE: PostgreSQL CNPMCORE_DATABASE_HOST: postgres CNPMCORE_DATABASE_PORT: '5432' CNPMCORE_DATABASE_USER: postgres CNPMCORE_DATABASE_PASSWORD: postgres
depends_onfrommysqltopostgres. - Rebuild the container (Dev Containers: Rebuild Container).
- Run with
npm run dev:postgresql/npm run test:postgresql.
The app image already includes the postgresql-client, so post-create.sh will pick
up CNPMCORE_DATABASE_TYPE=PostgreSQL and initialize the PostgreSQL database instead.