Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 3.37 KB

File metadata and controls

53 lines (37 loc) · 3.37 KB
name dev-workflow
description Local build, test, lint, coverage, TypeScript layout, ESLint, and oclif-generated docs for contentstack-cli-content-type. Use when changing package.json scripts, tsconfig, .eslintrc, Jest config, README/oclif manifest, or validating before a PR.

dev-workflow – contentstack-cli-content-type

When to use

  • Running or changing npm scripts (test, test:coverage, posttest, prepack, version).
  • Editing tsconfig.json, .eslintrc, or jest.config.js.
  • Regenerating README.md or oclif.manifest.json after command or flag changes.
  • Checking expectations before opening a PR (tests + lint + coverage).

Instructions

Validation before a PR

  • Run npm test; fix failures before review.
  • npm run posttest runs ESLint on .ts files per package.json (eslint . --ext .ts --config .eslintrc). Keep it green when shipping changes.
  • When changing behavior in src/core/ or src/utils/, run npm run test:coverage and ensure coverage meets jest.config.js global thresholds (see AGENTS.md).
  • After changing command IDs, flags, or descriptions, regenerate CLI docs with npm run prepack or the version script so README.md and oclif.manifest.json stay aligned.

TypeScript build

  • Preserve tsconfig.json: strict: true, rootDir: src, outDir: lib, module: commonjs, target: es2017.
  • Changes to include, compilerOptions.paths, or rootDir/outDir affect the whole package and published lib/ output—validate with tsc -b (as in prepack).
  • Source of truth for app code is src/; compiled JS lives under lib/ (do not hand-edit lib/).

ESLint

  • Config extends oclif-typescript and @typescript-eslint/recommended (see .eslintrc).
  • Notable conventions: single quotes, eqeqeq smart, @typescript-eslint/no-unused-vars (args none), no-var. New rule overrides should not break npm run posttest.
  • Prefer fixing lint in src/ and tests/ rather than disabling rules project-wide without team agreement.

Oclif docs and manifest

  • README.md command sections and oclif.manifest.json are generated by oclif readme and oclif manifest (see package.json prepack, version).
  • Prefer changing src/commands/**/*.ts (descriptions, flags, examples), then run npm run prepack or the relevant oclif script so README and manifest stay consistent—avoid hand-editing generated command blocks unless you regenerate immediately after.

CI

This repository’s .github/workflows includes policy scans, SCA, release automation, and issue integration—there is no dedicated workflow that only runs npm test. Align local validation with team expectations and any checks run on merge.

References