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
syncsettings tocanvas.config.jsonvia@drupal-canvas/discovery:sync.pagessync.contentTemplatessync.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 intocanvas.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
- Run with no
synckey incanvas.config.jsonand confirm pages, content templates, and regions are included by default:
npx canvas push --yes
npx canvas pull --yes --skip-overwrite- 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- Test one-off CLI exclusions override
canvas.config.jsondefaults:
npx canvas push --yes --no-pages --no-content-templates --no-regions
npx canvas pull --yes --no-pages --no-content-templates --no-regions- Test deprecated CLI flags still work and warn:
npx canvas push --yes --include-pages=false
npx canvas pull --yes --include-regions=falseConfirm 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- Test deprecated env vars still work when the matching
sync.*key is omitted fromcanvas.config.json:
CANVAS_INCLUDE_PAGES=false npx canvas push --yes
CANVAS_INCLUDE_CONTENT_TEMPLATES=false CANVAS_INCLUDE_REGIONS=false npx canvas pull --yesConfirm warnings explain that sync settings are now managed in canvas.config.json.
- Test
canvas.config.jsontakes 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 --yesConfirm pages, content templates, and regions are still included because explicit sync.* config wins over deprecated env vars.
- In interactive mode, test env var migration when
sync.*is omitted:
CANVAS_INCLUDE_PAGES=false npx canvas pushAccept the migration prompt and confirm canvas.config.json is updated with the matching sync.* value:
{
"sync": {
"pages": false
}
}- Confirm env var migration does not overwrite existing
sync.*config. With this config:
{
"sync": {
"pages": true
}
}Run:
CANVAS_INCLUDE_PAGES=false npx canvas pushConfirm sync.pages remains true, and pages are included.
Closes #3591633 (closed). Authored with an AI coding agent.