| name | dev-workflow |
|---|---|
| description | Branches, CI, pnpm workspace commands, PR expectations, and TDD workflow for the Contentstack CLI plugins monorepo. |
- Before you run builds or tests across the workspace
- When wiring CI or interpreting
.github/workflows/ - When following TDD expectations for a plugin under
packages/
Plugins live under packages/ (pnpm workspaces: packages/*). Current packages include:
contentstack-apps-cli— Developer Hub apps (app:*commands); npm package@contentstack/apps-clicontentstack-cli-tsgen— TypeScript typings (csdx tsgen); npm packagecontentstack-cli-tsgencontentstack-migrate-rte— HTML → JSON RTE (cm:entries:migrate-html-rte); npm@contentstack/cli-cm-migrate-rtecontentstack-bulk-operations— bulk publish/unpublish (cm:stacks:bulk-*); npm@contentstack/cli-bulk-operationscontentstack-audit,contentstack-bootstrap,contentstack-branches,contentstack-clone,contentstack-export,contentstack-export-to-csv,contentstack-import,contentstack-import-setup,contentstack-migration,contentstack-query-export,contentstack-seed,contentstack-variants
Plugins typically depend on @contentstack/cli-command and @contentstack/cli-utilities. Match dependency major/beta lines to the repo branch (v1-dev vs v2-dev).
From repo root or the package directory:
| Command | Purpose |
|---|---|
pnpm --filter @contentstack/apps-cli run build |
Compile src/ → lib/ |
pnpm --filter @contentstack/apps-cli test |
Mocha unit tests + lint (posttest) |
pnpm --filter @contentstack/apps-cli run test:unit:report |
Unit tests with nyc coverage |
CI runs apps-cli tests in .github/workflows/unit-test.yml.
| Command | Purpose |
|---|---|
pnpm --filter contentstack-cli-tsgen run build |
Compile src/ → lib/ + OCLIF manifest |
pnpm --filter contentstack-cli-tsgen test |
Jest + ESLint (posttest) |
pnpm --filter contentstack-cli-tsgen run test:integration |
Live csdx tsgen integration tests |
CI: integration in .github/workflows/tsgen-integration-test.yml; lint in unit-test.yml.
| Command | Purpose |
|---|---|
pnpm --filter @contentstack/cli-cm-migrate-rte run build |
oclif manifest |
pnpm --filter @contentstack/cli-cm-migrate-rte test |
Mocha + nyc |
| Command | Purpose |
|---|---|
pnpm --filter @contentstack/cli-bulk-operations run build |
Compile src/ → lib/ |
pnpm --filter @contentstack/cli-bulk-operations test |
Mocha + lint (posttest) |
| Command | Purpose |
|---|---|
pnpm install |
Install all workspace dependencies |
pnpm build |
pnpm -r --filter './packages/*' run build |
pnpm test |
pnpm -r --filter './packages/*' run test |
pnpm prepack |
pnpm -r --filter './packages/*' run prepack |
There is no root lint script; run ESLint in a package that defines lint (e.g. cd packages/contentstack-import && pnpm run lint). Filter example: pnpm --filter @contentstack/cli-cm-import test (adjust scope to the package you change).
- RED — one failing test in the package’s unit test tree
- GREEN — minimal
src/change to pass - REFACTOR — keep tests green
Do not commit test.only / test.skip. Target 80% coverage where nyc is configured. Mock external APIs; no real API calls in unit tests.
- Workflows:
.github/workflows/— e.g.unit-test.yml,tsgen-integration-test.yml,release-v2-beta-plugins.yml,sca-scan.yml,policy-scan.yml,codeql-analysis.yml - Husky:
.husky/when present
- Tests and build pass for affected packages
- No stray
.only/.skipin tests - Follow testing and code-review