feat(CLI Tool): #3591633 Move CLI sync settings to canvas.config.json, enable everything by default

Makes pages, content templates, and global regions part of Canvas CLI push/pull by default, and moves their project-level configuration into canvas.config.json.

Changes

  • Added sync settings to canvas.config.json via @drupal-canvas/discovery:
    • sync.pages
    • sync.contentTemplates
    • sync.regions
  • Defaulted all three sync settings to true.
  • Added preferred one-off exclusion flags:
    • --no-pages
    • --no-content-templates
    • --no-regions
  • Kept deprecated --include-* flags for backwards compatibility, with migration warnings.
  • Kept deprecated CANVAS_INCLUDE_* env vars for current-run compatibility, with migration support into canvas.config.json.
  • Normalized CLI option handling so sync options use the same shape as canvas.config.json.
  • Updated docs and tests for the new defaults, config shape, migration behavior, and compatibility paths.

Backwards compatibility testing

  1. Run with no sync key in canvas.config.json and confirm pages, content templates, and regions are included by default:
npx canvas push --yes
npx canvas pull --yes --skip-overwrite
  1. Test project-level opt-outs in canvas.config.json:
{
  "sync": {
    "pages": false,
    "contentTemplates": false,
    "regions": false
  }
}

Then confirm push and pull exclude pages, content templates, and regions without any CLI flags:

npx canvas push --yes
npx canvas pull --yes --skip-overwrite
  1. Test one-off CLI exclusions override canvas.config.json defaults:
npx canvas push --yes --no-pages --no-content-templates --no-regions
npx canvas pull --yes --no-pages --no-content-templates --no-regions
  1. Test deprecated CLI flags still work and warn:
npx canvas push --yes --include-pages=false
npx canvas pull --yes --include-regions=false

Confirm the warning recommends the matching --no-* flag. Also confirm bare or true include flags warn that the resource is included by default:

npx canvas push --yes --include-pages
npx canvas pull --yes --include-content-templates=true
  1. Test deprecated env vars still work when the matching sync.* key is omitted from canvas.config.json:
CANVAS_INCLUDE_PAGES=false npx canvas push --yes
CANVAS_INCLUDE_CONTENT_TEMPLATES=false CANVAS_INCLUDE_REGIONS=false npx canvas pull --yes

Confirm warnings explain that sync settings are now managed in canvas.config.json.

  1. Test canvas.config.json takes precedence over deprecated env vars when both are set. With this config:
{
  "sync": {
    "pages": true,
    "contentTemplates": true,
    "regions": true
  }
}

Run:

CANVAS_INCLUDE_PAGES=false \
CANVAS_INCLUDE_CONTENT_TEMPLATES=false \
CANVAS_INCLUDE_REGIONS=false \
npx canvas push --yes

Confirm pages, content templates, and regions are still included because explicit sync.* config wins over deprecated env vars.

  1. In interactive mode, test env var migration when sync.* is omitted:
CANVAS_INCLUDE_PAGES=false npx canvas push

Accept the migration prompt and confirm canvas.config.json is updated with the matching sync.* value:

{
  "sync": {
    "pages": false
  }
}
  1. Confirm env var migration does not overwrite existing sync.* config. With this config:
{
  "sync": {
    "pages": true
  }
}

Run:

CANVAS_INCLUDE_PAGES=false npx canvas push

Confirm sync.pages remains true, and pages are included.

Closes #3591633 (closed). Authored with an AI coding agent.

Edited by Bálint Kléri

Merge request reports

Loading