@squiz/dxp-cli-next 5.33.0-develop.1 → 5.33.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/bin/dxp.js +6 -1
- package/dist/dxp.js +4480 -0
- package/package.json +36 -30
- package/lib/ApiService.d.ts +0 -39
- package/lib/ApiService.js +0 -120
- package/lib/ApiService.spec.d.ts +0 -1
- package/lib/ApiService.spec.js +0 -182
- package/lib/ApplicationConfig.d.ts +0 -7
- package/lib/ApplicationConfig.js +0 -38
- package/lib/ApplicationConfig.spec.d.ts +0 -1
- package/lib/ApplicationConfig.spec.js +0 -84
- package/lib/ApplicationStore.d.ts +0 -13
- package/lib/ApplicationStore.js +0 -53
- package/lib/__tests__/cmp/dev-mode.spec.d.ts +0 -1
- package/lib/__tests__/cmp/dev-mode.spec.js +0 -54
- package/lib/__tests__/helpers.d.ts +0 -17
- package/lib/__tests__/helpers.js +0 -54
- package/lib/__tests__/integration/main.spec.d.ts +0 -1
- package/lib/__tests__/integration/main.spec.js +0 -45
- package/lib/__tests__/smoke/validate.spec.d.ts +0 -1
- package/lib/__tests__/smoke/validate.spec.js +0 -37
- package/lib/__tests__/unit/cli.d.ts +0 -0
- package/lib/__tests__/unit/cli.js +0 -7
- package/lib/auth/index.d.ts +0 -3
- package/lib/auth/index.js +0 -14
- package/lib/auth/login/login.d.ts +0 -22
- package/lib/auth/login/login.js +0 -268
- package/lib/auth/login/login.spec.d.ts +0 -1
- package/lib/auth/login/login.spec.js +0 -179
- package/lib/auth/logout/logout.d.ts +0 -3
- package/lib/auth/logout/logout.js +0 -115
- package/lib/auth/logout/logout.spec.d.ts +0 -1
- package/lib/auth/logout/logout.spec.js +0 -67
- package/lib/cdp/constants.d.ts +0 -1
- package/lib/cdp/constants.js +0 -4
- package/lib/cdp/index.d.ts +0 -3
- package/lib/cdp/index.js +0 -16
- package/lib/cdp/instance/activate/activate.d.ts +0 -5
- package/lib/cdp/instance/activate/activate.js +0 -107
- package/lib/cdp/instance/activate/activate.spec.d.ts +0 -1
- package/lib/cdp/instance/activate/activate.spec.js +0 -274
- package/lib/cdp/instance/instanceCommand.d.ts +0 -3
- package/lib/cdp/instance/instanceCommand.js +0 -15
- package/lib/cdp/schema/deploy/deploy.const.d.ts +0 -5
- package/lib/cdp/schema/deploy/deploy.const.js +0 -8
- package/lib/cdp/schema/deploy/deploy.d.ts +0 -4
- package/lib/cdp/schema/deploy/deploy.js +0 -107
- package/lib/cdp/schema/deploy/deploy.spec.d.ts +0 -1
- package/lib/cdp/schema/deploy/deploy.spec.js +0 -137
- package/lib/cdp/schema/schemaCommand.d.ts +0 -3
- package/lib/cdp/schema/schemaCommand.js +0 -15
- package/lib/cdp/utils.d.ts +0 -23
- package/lib/cdp/utils.js +0 -133
- package/lib/cmp/deploy.d.ts +0 -3
- package/lib/cmp/deploy.js +0 -124
- package/lib/cmp/dev-mode-ui.d.ts +0 -4
- package/lib/cmp/dev-mode-ui.js +0 -51
- package/lib/cmp/dev-mode.d.ts +0 -4
- package/lib/cmp/dev-mode.js +0 -58
- package/lib/cmp/edge-components/compiler.d.ts +0 -13
- package/lib/cmp/edge-components/compiler.js +0 -55
- package/lib/cmp/index.d.ts +0 -3
- package/lib/cmp/index.js +0 -18
- package/lib/cmp/init.d.ts +0 -3
- package/lib/cmp/init.js +0 -105
- package/lib/cmp/utils/definitions.d.ts +0 -481
- package/lib/cmp/utils/definitions.js +0 -262
- package/lib/cmp/utils/definitions.spec.d.ts +0 -1
- package/lib/cmp/utils/definitions.spec.js +0 -503
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +0 -4
- package/lib/datastore/blueprint/add/add.d.ts +0 -3
- package/lib/datastore/blueprint/add/add.js +0 -119
- package/lib/datastore/blueprint/add/add.spec.d.ts +0 -1
- package/lib/datastore/blueprint/add/add.spec.js +0 -134
- package/lib/datastore/blueprint/blueprintCommand.d.ts +0 -3
- package/lib/datastore/blueprint/blueprintCommand.js +0 -21
- package/lib/datastore/blueprint/list/list.d.ts +0 -3
- package/lib/datastore/blueprint/list/list.js +0 -76
- package/lib/datastore/blueprint/list/list.spec.d.ts +0 -1
- package/lib/datastore/blueprint/list/list.spec.js +0 -51
- package/lib/datastore/blueprint/rename/rename.d.ts +0 -3
- package/lib/datastore/blueprint/rename/rename.js +0 -93
- package/lib/datastore/blueprint/rename/rename.spec.d.ts +0 -1
- package/lib/datastore/blueprint/rename/rename.spec.js +0 -142
- package/lib/datastore/blueprint/update/update.d.ts +0 -3
- package/lib/datastore/blueprint/update/update.js +0 -89
- package/lib/datastore/blueprint/update/update.spec.d.ts +0 -1
- package/lib/datastore/blueprint/update/update.spec.js +0 -99
- package/lib/datastore/bundle/bundle.d.ts +0 -3
- package/lib/datastore/bundle/bundle.js +0 -176
- package/lib/datastore/bundle/bundle.spec.d.ts +0 -1
- package/lib/datastore/bundle/bundle.spec.js +0 -94
- package/lib/datastore/index.d.ts +0 -3
- package/lib/datastore/index.js +0 -16
- package/lib/datastore/simulator/add/add.d.ts +0 -3
- package/lib/datastore/simulator/add/add.js +0 -125
- package/lib/datastore/simulator/add/add.spec.d.ts +0 -1
- package/lib/datastore/simulator/add/add.spec.js +0 -114
- package/lib/datastore/simulator/clear/clear.d.ts +0 -3
- package/lib/datastore/simulator/clear/clear.js +0 -70
- package/lib/datastore/simulator/clear/clear.spec.d.ts +0 -1
- package/lib/datastore/simulator/clear/clear.spec.js +0 -224
- package/lib/datastore/simulator/list/list.d.ts +0 -3
- package/lib/datastore/simulator/list/list.js +0 -115
- package/lib/datastore/simulator/list/list.spec.d.ts +0 -1
- package/lib/datastore/simulator/list/list.spec.js +0 -95
- package/lib/datastore/simulator/pause/pause.d.ts +0 -3
- package/lib/datastore/simulator/pause/pause.js +0 -84
- package/lib/datastore/simulator/pause/pause.spec.d.ts +0 -1
- package/lib/datastore/simulator/pause/pause.spec.js +0 -90
- package/lib/datastore/simulator/remove/remove.d.ts +0 -3
- package/lib/datastore/simulator/remove/remove.js +0 -68
- package/lib/datastore/simulator/remove/remove.spec.d.ts +0 -1
- package/lib/datastore/simulator/remove/remove.spec.js +0 -224
- package/lib/datastore/simulator/resume/resume.d.ts +0 -3
- package/lib/datastore/simulator/resume/resume.js +0 -84
- package/lib/datastore/simulator/resume/resume.spec.d.ts +0 -1
- package/lib/datastore/simulator/resume/resume.spec.js +0 -90
- package/lib/datastore/simulator/simulatorCommand.d.ts +0 -3
- package/lib/datastore/simulator/simulatorCommand.js +0 -27
- package/lib/datastore/simulator/upgrade/upgrade.d.ts +0 -3
- package/lib/datastore/simulator/upgrade/upgrade.js +0 -157
- package/lib/datastore/simulator/upgrade/upgrade.spec.d.ts +0 -1
- package/lib/datastore/simulator/upgrade/upgrade.spec.js +0 -199
- package/lib/datastore/simulator/utils.d.ts +0 -29
- package/lib/datastore/simulator/utils.js +0 -218
- package/lib/datastore/simulator/utils.spec.d.ts +0 -1
- package/lib/datastore/simulator/utils.spec.js +0 -201
- package/lib/datastore/utils.d.ts +0 -20
- package/lib/datastore/utils.js +0 -241
- package/lib/datastore/utils.spec.d.ts +0 -1
- package/lib/datastore/utils.spec.js +0 -113
- package/lib/dxp.d.ts +0 -1
- package/lib/dxp.js +0 -57
- package/lib/job-runner/index.d.ts +0 -3
- package/lib/job-runner/index.js +0 -22
- package/lib/job-runner/job/listJobs/listJobs.d.ts +0 -3
- package/lib/job-runner/job/listJobs/listJobs.js +0 -66
- package/lib/job-runner/job/listJobs/listJobs.spec.d.ts +0 -1
- package/lib/job-runner/job/listJobs/listJobs.spec.js +0 -42
- package/lib/job-runner/job/uploadJob/uploadJob.d.ts +0 -3
- package/lib/job-runner/job/uploadJob/uploadJob.js +0 -56
- package/lib/job-runner/job/uploadJob/uploadJob.spec.d.ts +0 -1
- package/lib/job-runner/job/uploadJob/uploadJob.spec.js +0 -42
- package/lib/job-runner/jobContext/listJobContexts.d.ts +0 -3
- package/lib/job-runner/jobContext/listJobContexts.js +0 -66
- package/lib/job-runner/jobContext/listJobContexts.spec.d.ts +0 -1
- package/lib/job-runner/jobContext/listJobContexts.spec.js +0 -58
- package/lib/job-runner/jobExecution/beginJob/beginJob.d.ts +0 -3
- package/lib/job-runner/jobExecution/beginJob/beginJob.js +0 -68
- package/lib/job-runner/jobExecution/beginJob/beginJob.spec.d.ts +0 -1
- package/lib/job-runner/jobExecution/beginJob/beginJob.spec.js +0 -62
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.d.ts +0 -3
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.js +0 -67
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.spec.d.ts +0 -1
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.spec.js +0 -64
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.d.ts +0 -3
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.js +0 -64
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.spec.d.ts +0 -1
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.spec.js +0 -61
- package/lib/job-runner/utils.d.ts +0 -19
- package/lib/job-runner/utils.js +0 -145
- package/lib/job-runner/utils.spec.d.ts +0 -1
- package/lib/job-runner/utils.spec.js +0 -116
- package/lib/migration/create/create.d.ts +0 -3
- package/lib/migration/create/create.js +0 -56
- package/lib/migration/create/create.spec.d.ts +0 -1
- package/lib/migration/create/create.spec.js +0 -280
- package/lib/migration/get/get.d.ts +0 -3
- package/lib/migration/get/get.js +0 -46
- package/lib/migration/get/get.spec.d.ts +0 -1
- package/lib/migration/get/get.spec.js +0 -287
- package/lib/migration/index.d.ts +0 -3
- package/lib/migration/index.js +0 -24
- package/lib/migration/list/list.d.ts +0 -3
- package/lib/migration/list/list.js +0 -45
- package/lib/migration/list/list.spec.d.ts +0 -1
- package/lib/migration/list/list.spec.js +0 -138
- package/lib/migration/next/next.d.ts +0 -3
- package/lib/migration/next/next.js +0 -75
- package/lib/migration/next/next.spec.d.ts +0 -1
- package/lib/migration/next/next.spec.js +0 -253
- package/lib/migration/pre/pre.d.ts +0 -3
- package/lib/migration/pre/pre.js +0 -54
- package/lib/migration/pre/pre.spec.d.ts +0 -1
- package/lib/migration/pre/pre.spec.js +0 -269
- package/lib/migration/revert/revert.d.ts +0 -3
- package/lib/migration/revert/revert.js +0 -47
- package/lib/migration/revert/revert.spec.d.ts +0 -1
- package/lib/migration/revert/revert.spec.js +0 -153
- package/lib/migration/settings/settings.d.ts +0 -3
- package/lib/migration/settings/settings.js +0 -63
- package/lib/migration/settings/settings.spec.d.ts +0 -1
- package/lib/migration/settings/settings.spec.js +0 -339
- package/lib/migration/types/common.types.d.ts +0 -29
- package/lib/migration/types/common.types.js +0 -2
- package/lib/migration/types/createMigration.types.d.ts +0 -10
- package/lib/migration/types/createMigration.types.js +0 -2
- package/lib/migration/types/getMigration.types.d.ts +0 -5
- package/lib/migration/types/getMigration.types.js +0 -2
- package/lib/migration/types/index.d.ts +0 -7
- package/lib/migration/types/index.js +0 -23
- package/lib/migration/types/listMigrations.types.d.ts +0 -2
- package/lib/migration/types/listMigrations.types.js +0 -2
- package/lib/migration/types/nextStage.types.d.ts +0 -10
- package/lib/migration/types/nextStage.types.js +0 -2
- package/lib/migration/types/preMigration.types.d.ts +0 -10
- package/lib/migration/types/preMigration.types.js +0 -2
- package/lib/migration/types/revert.types.d.ts +0 -6
- package/lib/migration/types/revert.types.js +0 -2
- package/lib/migration/types/settings.types.d.ts +0 -15
- package/lib/migration/types/settings.types.js +0 -2
- package/lib/migration/utils/common.d.ts +0 -39
- package/lib/migration/utils/common.js +0 -134
- package/lib/migration/utils/common.spec.d.ts +0 -1
- package/lib/migration/utils/common.spec.js +0 -165
- package/lib/migration/utils/createMigration.d.ts +0 -33
- package/lib/migration/utils/createMigration.js +0 -125
- package/lib/migration/utils/createMigration.spec.d.ts +0 -1
- package/lib/migration/utils/createMigration.spec.js +0 -259
- package/lib/migration/utils/getMigration.d.ts +0 -2
- package/lib/migration/utils/getMigration.js +0 -41
- package/lib/migration/utils/getMigration.spec.d.ts +0 -1
- package/lib/migration/utils/getMigration.spec.js +0 -156
- package/lib/migration/utils/index.d.ts +0 -9
- package/lib/migration/utils/index.js +0 -25
- package/lib/migration/utils/listMigrations.d.ts +0 -3
- package/lib/migration/utils/listMigrations.js +0 -41
- package/lib/migration/utils/listMigrations.spec.d.ts +0 -1
- package/lib/migration/utils/listMigrations.spec.js +0 -108
- package/lib/migration/utils/loadCctIdsFromFile.d.ts +0 -1
- package/lib/migration/utils/loadCctIdsFromFile.js +0 -32
- package/lib/migration/utils/loadCctIdsFromFile.spec.d.ts +0 -1
- package/lib/migration/utils/loadCctIdsFromFile.spec.js +0 -91
- package/lib/migration/utils/loadStageOptionsFromFile.d.ts +0 -1
- package/lib/migration/utils/loadStageOptionsFromFile.js +0 -32
- package/lib/migration/utils/loadStageOptionsFromFile.spec.d.ts +0 -1
- package/lib/migration/utils/loadStageOptionsFromFile.spec.js +0 -77
- package/lib/migration/utils/nextStage.d.ts +0 -2
- package/lib/migration/utils/nextStage.js +0 -45
- package/lib/migration/utils/nextStage.spec.d.ts +0 -1
- package/lib/migration/utils/nextStage.spec.js +0 -151
- package/lib/migration/utils/options.d.ts +0 -15
- package/lib/migration/utils/options.js +0 -106
- package/lib/migration/utils/options.spec.d.ts +0 -1
- package/lib/migration/utils/options.spec.js +0 -115
- package/lib/migration/utils/promptForMorphConfirmation.d.ts +0 -5
- package/lib/migration/utils/promptForMorphConfirmation.js +0 -55
- package/lib/migration/utils/promptForMorphConfirmation.spec.d.ts +0 -1
- package/lib/migration/utils/promptForMorphConfirmation.spec.js +0 -101
- package/lib/migration/utils/revertMigration.d.ts +0 -2
- package/lib/migration/utils/revertMigration.js +0 -38
- package/lib/migration/utils/revertMigration.spec.d.ts +0 -1
- package/lib/migration/utils/revertMigration.spec.js +0 -95
- package/lib/migration/utils/setMigrationSettings.d.ts +0 -2
- package/lib/migration/utils/setMigrationSettings.js +0 -52
- package/lib/migration/utils/setMigrationSettings.spec.d.ts +0 -1
- package/lib/migration/utils/setMigrationSettings.spec.js +0 -163
- package/lib/page/index.d.ts +0 -3
- package/lib/page/index.js +0 -12
- package/lib/page/layouts/deploy/deploy.d.ts +0 -5
- package/lib/page/layouts/deploy/deploy.js +0 -157
- package/lib/page/layouts/deploy/deploy.spec.d.ts +0 -1
- package/lib/page/layouts/deploy/deploy.spec.js +0 -319
- package/lib/page/layouts/dev/dev.d.ts +0 -5
- package/lib/page/layouts/dev/dev.js +0 -84
- package/lib/page/layouts/dev/dev.spec.d.ts +0 -1
- package/lib/page/layouts/dev/dev.spec.js +0 -271
- package/lib/page/layouts/layouts.d.ts +0 -3
- package/lib/page/layouts/layouts.js +0 -17
- package/lib/page/layouts/layouts.spec.d.ts +0 -1
- package/lib/page/layouts/layouts.spec.js +0 -29
- package/lib/page/layouts/validation/index.d.ts +0 -3
- package/lib/page/layouts/validation/index.js +0 -9
- package/lib/page/layouts/validation/property-consistency.d.ts +0 -7
- package/lib/page/layouts/validation/property-consistency.js +0 -92
- package/lib/page/layouts/validation/property-consistency.spec.d.ts +0 -1
- package/lib/page/layouts/validation/property-consistency.spec.js +0 -305
- package/lib/page/layouts/validation/validateLayoutFormat.d.ts +0 -2
- package/lib/page/layouts/validation/validateLayoutFormat.js +0 -27
- package/lib/page/layouts/validation/validateLayoutFormat.spec.d.ts +0 -1
- package/lib/page/layouts/validation/validateLayoutFormat.spec.js +0 -42
- package/lib/page/layouts/validation/zone-consistency.d.ts +0 -7
- package/lib/page/layouts/validation/zone-consistency.js +0 -50
- package/lib/page/layouts/validation/zone-consistency.spec.d.ts +0 -1
- package/lib/page/layouts/validation/zone-consistency.spec.js +0 -99
- package/lib/page/templates/validation.d.ts +0 -11
- package/lib/page/templates/validation.js +0 -30
- package/lib/page/templates/validation.spec.d.ts +0 -1
- package/lib/page/templates/validation.spec.js +0 -89
- package/lib/page/utils/definitions.d.ts +0 -552
- package/lib/page/utils/definitions.js +0 -241
- package/lib/page/utils/definitions.spec.d.ts +0 -1
- package/lib/page/utils/definitions.spec.js +0 -749
- package/lib/page/utils/normalize.d.ts +0 -8
- package/lib/page/utils/normalize.js +0 -54
- package/lib/page/utils/normalize.spec.d.ts +0 -1
- package/lib/page/utils/normalize.spec.js +0 -315
- package/lib/page/utils/parse-args.d.ts +0 -44
- package/lib/page/utils/parse-args.js +0 -119
- package/lib/page/utils/parse-args.spec.d.ts +0 -1
- package/lib/page/utils/parse-args.spec.js +0 -284
- package/lib/page/utils/render.d.ts +0 -51
- package/lib/page/utils/render.js +0 -112
- package/lib/page/utils/render.spec.d.ts +0 -1
- package/lib/page/utils/render.spec.js +0 -134
- package/lib/page/utils/server.d.ts +0 -12
- package/lib/page/utils/server.js +0 -201
- package/lib/page/utils/server.spec.d.ts +0 -1
- package/lib/page/utils/server.spec.js +0 -275
- package/lib/porter/constants.d.ts +0 -11
- package/lib/porter/constants.js +0 -14
- package/lib/porter/index.d.ts +0 -3
- package/lib/porter/index.js +0 -24
- package/lib/porter/port/abort/abort.d.ts +0 -3
- package/lib/porter/port/abort/abort.js +0 -80
- package/lib/porter/port/abort/abort.spec.d.ts +0 -1
- package/lib/porter/port/abort/abort.spec.js +0 -182
- package/lib/porter/port/get/get.d.ts +0 -3
- package/lib/porter/port/get/get.js +0 -96
- package/lib/porter/port/get/get.spec.d.ts +0 -1
- package/lib/porter/port/get/get.spec.js +0 -277
- package/lib/porter/port/start/start.d.ts +0 -3
- package/lib/porter/port/start/start.js +0 -82
- package/lib/porter/port/start/start.spec.d.ts +0 -1
- package/lib/porter/port/start/start.spec.js +0 -198
- package/lib/porter/project/add/add.d.ts +0 -3
- package/lib/porter/project/add/add.js +0 -138
- package/lib/porter/project/add/add.spec.d.ts +0 -1
- package/lib/porter/project/add/add.spec.js +0 -269
- package/lib/porter/project/get/get.d.ts +0 -3
- package/lib/porter/project/get/get.js +0 -65
- package/lib/porter/project/get/get.spec.d.ts +0 -1
- package/lib/porter/project/get/get.spec.js +0 -185
- package/lib/porter/project/remove/remove.d.ts +0 -3
- package/lib/porter/project/remove/remove.js +0 -69
- package/lib/porter/project/remove/remove.spec.d.ts +0 -1
- package/lib/porter/project/remove/remove.spec.js +0 -201
- package/lib/porter/types.d.ts +0 -5
- package/lib/porter/types.js +0 -2
- package/lib/porter/utils/BuildDXPUrl/BuildDXPUrl.d.ts +0 -4
- package/lib/porter/utils/BuildDXPUrl/BuildDXPUrl.js +0 -34
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.d.ts +0 -1
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.js +0 -21
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.spec.d.ts +0 -1
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.spec.js +0 -52
- package/lib/porter/utils/CoreUtils/CoreUtils.d.ts +0 -2
- package/lib/porter/utils/CoreUtils/CoreUtils.js +0 -13
- package/lib/porter/utils/CoreUtils/CoreUtils.spec.d.ts +0 -1
- package/lib/porter/utils/CoreUtils/CoreUtils.spec.js +0 -36
- package/lib/porter/utils/DoesPathExist/DoesPathExist.d.ts +0 -1
- package/lib/porter/utils/DoesPathExist/DoesPathExist.js +0 -27
- package/lib/porter/utils/DoesPathExist/DoesPathExist.spec.d.ts +0 -1
- package/lib/porter/utils/DoesPathExist/DoesPathExist.spec.js +0 -40
- package/lib/porter/utils/ErrorUtils/ErrorUtils.d.ts +0 -4
- package/lib/porter/utils/ErrorUtils/ErrorUtils.js +0 -66
- package/lib/porter/utils/ErrorUtils/ErrorUtils.spec.d.ts +0 -1
- package/lib/porter/utils/ErrorUtils/ErrorUtils.spec.js +0 -176
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.d.ts +0 -2
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.js +0 -33
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.spec.d.ts +0 -1
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.spec.js +0 -50
- package/lib/porter/utils/GetProjectName/GetProjectName.d.ts +0 -4
- package/lib/porter/utils/GetProjectName/GetProjectName.js +0 -30
- package/lib/porter/utils/GetProjectName/GetProjectName.spec.d.ts +0 -1
- package/lib/porter/utils/GetProjectName/GetProjectName.spec.js +0 -91
- package/lib/porter/utils/index.d.ts +0 -7
- package/lib/porter/utils/index.js +0 -23
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const property_consistency_1 = require("./property-consistency");
|
|
4
|
-
describe('validatePropertyConsistency', () => {
|
|
5
|
-
const createMockLayout = (layout) => (Object.assign({ name: 'test-layout', displayName: 'Test Layout', description: 'A test layout', zones: [], template: '' }, layout));
|
|
6
|
-
describe('new format (manifest.json)', () => {
|
|
7
|
-
it('should return null for valid property consistency', () => {
|
|
8
|
-
const layout = createMockLayout({
|
|
9
|
-
properties: {
|
|
10
|
-
title: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
title: 'Title',
|
|
13
|
-
description: 'Page title',
|
|
14
|
-
},
|
|
15
|
-
showHeader: {
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
title: 'Show Header',
|
|
18
|
-
description: 'Whether to show header',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
template: '<div>{{properties.title}}</div><div>{{#if properties.showHeader}}Header{{/if}}</div>',
|
|
22
|
-
});
|
|
23
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
24
|
-
expect(result).toBeNull();
|
|
25
|
-
});
|
|
26
|
-
it('should return null when no template is provided', () => {
|
|
27
|
-
const layout = createMockLayout({
|
|
28
|
-
properties: {
|
|
29
|
-
title: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
title: 'Title',
|
|
32
|
-
description: 'Page title',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
37
|
-
expect(result).toBeNull();
|
|
38
|
-
});
|
|
39
|
-
it('should return null when layout has empty properties object', () => {
|
|
40
|
-
const layout = createMockLayout({
|
|
41
|
-
properties: {},
|
|
42
|
-
template: '<div>Static content only</div>',
|
|
43
|
-
});
|
|
44
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
45
|
-
expect(result).toBeNull();
|
|
46
|
-
});
|
|
47
|
-
it('should return null when layout has undefined properties', () => {
|
|
48
|
-
const layout = createMockLayout({
|
|
49
|
-
template: '<div>Static content only</div>',
|
|
50
|
-
});
|
|
51
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
52
|
-
expect(result).toBeNull();
|
|
53
|
-
});
|
|
54
|
-
it('should allow properties that are defined in the layout, but not used in template', () => {
|
|
55
|
-
const layout = createMockLayout({
|
|
56
|
-
properties: {
|
|
57
|
-
title: {
|
|
58
|
-
type: 'string',
|
|
59
|
-
title: 'Title',
|
|
60
|
-
description: 'Page title',
|
|
61
|
-
},
|
|
62
|
-
unused: {
|
|
63
|
-
type: 'string',
|
|
64
|
-
title: 'Unused',
|
|
65
|
-
description: 'Unused property',
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
template: '<div>{{properties.title}}</div>',
|
|
69
|
-
});
|
|
70
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
71
|
-
expect(result).toBeNull();
|
|
72
|
-
});
|
|
73
|
-
it('should detect properties used in template but not defined in layout', () => {
|
|
74
|
-
const layout = createMockLayout({
|
|
75
|
-
properties: {
|
|
76
|
-
title: {
|
|
77
|
-
type: 'string',
|
|
78
|
-
title: 'Title',
|
|
79
|
-
description: 'Page title',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
template: '<div>{{properties.title}}</div><div>{{properties.undefined}}</div>',
|
|
83
|
-
});
|
|
84
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
85
|
-
expect(result).toContain('Property consistency validation failed');
|
|
86
|
-
expect(result).toContain('Properties used in template but not defined in layout definition: undefined');
|
|
87
|
-
});
|
|
88
|
-
it('should handle both unused and undefined properties', () => {
|
|
89
|
-
const layout = createMockLayout({
|
|
90
|
-
properties: {
|
|
91
|
-
title: {
|
|
92
|
-
type: 'string',
|
|
93
|
-
title: 'Title',
|
|
94
|
-
description: 'Page title',
|
|
95
|
-
},
|
|
96
|
-
unused: {
|
|
97
|
-
type: 'string',
|
|
98
|
-
title: 'Unused',
|
|
99
|
-
description: 'Unused property',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
template: '<div>{{properties.title}}</div><div>{{properties.undefined}}</div>',
|
|
103
|
-
});
|
|
104
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
105
|
-
expect(result).toContain('Property consistency validation failed');
|
|
106
|
-
expect(result).toContain('Properties used in template but not defined in layout definition: undefined');
|
|
107
|
-
});
|
|
108
|
-
it('should reject options usage in manifest.json format', () => {
|
|
109
|
-
const layout = createMockLayout({
|
|
110
|
-
properties: {
|
|
111
|
-
title: {
|
|
112
|
-
type: 'string',
|
|
113
|
-
title: 'Title',
|
|
114
|
-
description: 'Page title',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
template: '<div>{{properties.title}}</div><div>{{options.invalid}}</div>',
|
|
118
|
-
});
|
|
119
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
120
|
-
expect(result).toContain('Property consistency validation failed');
|
|
121
|
-
expect(result).toContain('Options are not supported in the Handlebars template for a layout defined with "manifest.json". Please use properties instead.');
|
|
122
|
-
});
|
|
123
|
-
it('should handle complex Handlebars patterns', () => {
|
|
124
|
-
const layout = createMockLayout({
|
|
125
|
-
properties: {
|
|
126
|
-
title: {
|
|
127
|
-
type: 'string',
|
|
128
|
-
title: 'Title',
|
|
129
|
-
description: 'Page title',
|
|
130
|
-
},
|
|
131
|
-
showHeader: {
|
|
132
|
-
type: 'boolean',
|
|
133
|
-
title: 'Show Header',
|
|
134
|
-
description: 'Whether to show header',
|
|
135
|
-
},
|
|
136
|
-
theme: {
|
|
137
|
-
type: 'string',
|
|
138
|
-
title: 'Theme',
|
|
139
|
-
description: 'Page theme',
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
template: `
|
|
143
|
-
<div>{{properties.title}}</div>
|
|
144
|
-
<div>{{toLowerCase properties.title}}</div>
|
|
145
|
-
<div>
|
|
146
|
-
{{#if properties.showHeader}}
|
|
147
|
-
<header>Header</header>
|
|
148
|
-
{{/if}}
|
|
149
|
-
{{#ifEq "dark" properties.theme}}
|
|
150
|
-
<div class="dark">Dark theme</div>
|
|
151
|
-
{{/ifEq}}
|
|
152
|
-
</div>
|
|
153
|
-
`,
|
|
154
|
-
});
|
|
155
|
-
const manifestResult = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
156
|
-
expect(manifestResult).toBeNull();
|
|
157
|
-
const pageLayoutResult = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/page-layout.yaml');
|
|
158
|
-
expect(pageLayoutResult).toContain('Option consistency validation failed');
|
|
159
|
-
expect(pageLayoutResult).toContain('Properties are only allowed in the Handlebars template for a layout defined with "manifest.json". Please use options instead.');
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
describe('old format (page-layout.yaml)', () => {
|
|
163
|
-
it('should return null for valid option consistency', () => {
|
|
164
|
-
const layout = createMockLayout({
|
|
165
|
-
properties: {
|
|
166
|
-
title: {
|
|
167
|
-
type: 'string',
|
|
168
|
-
title: 'Title',
|
|
169
|
-
description: 'Page title',
|
|
170
|
-
},
|
|
171
|
-
showHeader: {
|
|
172
|
-
type: 'boolean',
|
|
173
|
-
title: 'Show Header',
|
|
174
|
-
description: 'Whether to show header',
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
template: '<div>{{options.title}}</div><div>{{#if options.showHeader}}Header{{/if}}</div>',
|
|
178
|
-
});
|
|
179
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/page-layout.yaml');
|
|
180
|
-
expect(result).toBeNull();
|
|
181
|
-
});
|
|
182
|
-
it('should allow options that are defined in the layout, but not used in template', () => {
|
|
183
|
-
const layout = createMockLayout({
|
|
184
|
-
properties: {
|
|
185
|
-
title: {
|
|
186
|
-
type: 'string',
|
|
187
|
-
title: 'Title',
|
|
188
|
-
description: 'Page title',
|
|
189
|
-
},
|
|
190
|
-
unused: {
|
|
191
|
-
type: 'string',
|
|
192
|
-
title: 'Unused',
|
|
193
|
-
description: 'Unused option',
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
template: '<div>{{options.title}}</div>',
|
|
197
|
-
});
|
|
198
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/page-layout.yaml');
|
|
199
|
-
expect(result).toBeNull();
|
|
200
|
-
});
|
|
201
|
-
it('should detect options used in template but not defined in layout', () => {
|
|
202
|
-
const layout = createMockLayout({
|
|
203
|
-
properties: {
|
|
204
|
-
title: {
|
|
205
|
-
type: 'string',
|
|
206
|
-
title: 'Title',
|
|
207
|
-
description: 'Page title',
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
template: '<div>{{options.title}}</div><div>{{options.undefined}}</div>',
|
|
211
|
-
});
|
|
212
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/page-layout.yaml');
|
|
213
|
-
expect(result).toContain('Option consistency validation failed');
|
|
214
|
-
expect(result).toContain('Options used in template but not defined in layout definition: undefined');
|
|
215
|
-
});
|
|
216
|
-
it('should reject properties usage in old format', () => {
|
|
217
|
-
const layout = createMockLayout({
|
|
218
|
-
properties: {
|
|
219
|
-
title: {
|
|
220
|
-
type: 'string',
|
|
221
|
-
title: 'Title',
|
|
222
|
-
description: 'Page title',
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
template: '<div>{{options.title}}</div><div>{{properties.invalid}}</div>',
|
|
226
|
-
});
|
|
227
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/page-layout.yaml');
|
|
228
|
-
expect(result).toContain('Option consistency validation failed');
|
|
229
|
-
expect(result).toContain('Properties are only allowed in the Handlebars template for a layout defined with "manifest.json". Please use options instead.');
|
|
230
|
-
});
|
|
231
|
-
it('should handle complex Handlebars patterns', () => {
|
|
232
|
-
const layout = createMockLayout({
|
|
233
|
-
properties: {
|
|
234
|
-
title: {
|
|
235
|
-
type: 'string',
|
|
236
|
-
title: 'Title',
|
|
237
|
-
description: 'Page title',
|
|
238
|
-
},
|
|
239
|
-
showHeader: {
|
|
240
|
-
type: 'boolean',
|
|
241
|
-
title: 'Show Header',
|
|
242
|
-
description: 'Whether to show header',
|
|
243
|
-
},
|
|
244
|
-
theme: {
|
|
245
|
-
type: 'string',
|
|
246
|
-
title: 'Theme',
|
|
247
|
-
description: 'Page theme',
|
|
248
|
-
},
|
|
249
|
-
},
|
|
250
|
-
template: `
|
|
251
|
-
<div>{{options.title}}</div>
|
|
252
|
-
<div>{{toLowerCase options.title}}</div>
|
|
253
|
-
<div>
|
|
254
|
-
{{#if options.showHeader}}
|
|
255
|
-
<header>Header</header>
|
|
256
|
-
{{/if}}
|
|
257
|
-
{{#ifEq "dark" options.theme}}
|
|
258
|
-
<div class="dark">Dark theme</div>
|
|
259
|
-
{{/ifEq}}
|
|
260
|
-
</div>
|
|
261
|
-
`,
|
|
262
|
-
});
|
|
263
|
-
const pageLayoutResult = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/page-layout.yaml');
|
|
264
|
-
expect(pageLayoutResult).toBeNull();
|
|
265
|
-
const manifestResult = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
266
|
-
expect(manifestResult).toContain('Property consistency validation failed');
|
|
267
|
-
expect(manifestResult).toContain('Options are not supported in the Handlebars template for a layout defined with "manifest.json". Please use properties instead.');
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
describe('edge cases', () => {
|
|
271
|
-
it('should handle multiple property references in same template', () => {
|
|
272
|
-
const layout = createMockLayout({
|
|
273
|
-
properties: {
|
|
274
|
-
title: {
|
|
275
|
-
type: 'string',
|
|
276
|
-
title: 'Title',
|
|
277
|
-
description: 'Page title',
|
|
278
|
-
},
|
|
279
|
-
},
|
|
280
|
-
template: '<div>{{properties.title}}</div><div>{{properties.title}}</div><div>{{#if properties.title}}Yes{{/if}}</div>',
|
|
281
|
-
});
|
|
282
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
283
|
-
expect(result).toBeNull();
|
|
284
|
-
});
|
|
285
|
-
it('should handle property names with different casing', () => {
|
|
286
|
-
const layout = createMockLayout({
|
|
287
|
-
properties: {
|
|
288
|
-
title: {
|
|
289
|
-
type: 'string',
|
|
290
|
-
title: 'Title',
|
|
291
|
-
description: 'Page title',
|
|
292
|
-
},
|
|
293
|
-
Title: {
|
|
294
|
-
type: 'string',
|
|
295
|
-
title: 'Title Capitalized',
|
|
296
|
-
description: 'Title with capital T',
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
template: '<div>{{properties.title}}</div><div>{{properties.Title}}</div>',
|
|
300
|
-
});
|
|
301
|
-
const result = (0, property_consistency_1.validatePropertyConsistency)(layout, '/path/to/manifest.json');
|
|
302
|
-
expect(result).toBeNull();
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateLayoutFormat = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const definitions_1 = require("../../utils/definitions");
|
|
9
|
-
function validateLayoutFormat(logger, layoutFile) {
|
|
10
|
-
// Warn that the default layout file has been changed
|
|
11
|
-
if (!layoutFile) {
|
|
12
|
-
logger.warn(`⚠️ DEFAULT CONFIG FILE: "${definitions_1.LAYOUT_MANIFEST_FILE}" has replaced "page-layout.yaml" as the default config file. ` +
|
|
13
|
-
`Please migrate to "${definitions_1.LAYOUT_MANIFEST_FILE}" using the new layout definition format. ` +
|
|
14
|
-
`Support for files other than "${definitions_1.LAYOUT_MANIFEST_FILE}" will be removed in a future version. ` +
|
|
15
|
-
'For more information, visit https://docs.squiz.net/component-service/latest/layouts/layout-files.html');
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
// Warn that any file other than manifest.json is deprecated
|
|
19
|
-
const fileName = node_path_1.default.basename(layoutFile);
|
|
20
|
-
if (fileName !== definitions_1.LAYOUT_MANIFEST_FILE) {
|
|
21
|
-
logger.warn(`⚠️ DEPRECATED: The file name "${fileName}" is deprecated. ` +
|
|
22
|
-
`Please migrate to "${definitions_1.LAYOUT_MANIFEST_FILE}" using the new layout definition format. ` +
|
|
23
|
-
`Support for files other than "${definitions_1.LAYOUT_MANIFEST_FILE}" will be removed in a future version. ` +
|
|
24
|
-
'For more information, visit https://docs.squiz.net/component-service/latest/layouts/layout-files.html');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.validateLayoutFormat = validateLayoutFormat;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const validateLayoutFormat_1 = require("./validateLayoutFormat");
|
|
4
|
-
const definitions_1 = require("../../utils/definitions");
|
|
5
|
-
describe('validateLayoutFormat', () => {
|
|
6
|
-
let mockLogger;
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
mockLogger = {
|
|
9
|
-
warn: jest.fn(),
|
|
10
|
-
};
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
jest.clearAllMocks();
|
|
14
|
-
});
|
|
15
|
-
it('should not log a warning when file is manifest.json', () => {
|
|
16
|
-
const layoutFile = `/some/path/${definitions_1.LAYOUT_MANIFEST_FILE}`;
|
|
17
|
-
(0, validateLayoutFormat_1.validateLayoutFormat)(mockLogger, layoutFile);
|
|
18
|
-
expect(mockLogger.warn).not.toHaveBeenCalled();
|
|
19
|
-
});
|
|
20
|
-
it('should log a deprecation warning when file is not manifest.json', () => {
|
|
21
|
-
const layoutFile = '/some/path/page-layout.yaml';
|
|
22
|
-
(0, validateLayoutFormat_1.validateLayoutFormat)(mockLogger, layoutFile);
|
|
23
|
-
expect(mockLogger.warn).toHaveBeenCalledTimes(1);
|
|
24
|
-
expect(mockLogger.warn).toHaveBeenCalledWith('⚠️ DEPRECATED: The file name "page-layout.yaml" is deprecated. ' +
|
|
25
|
-
`Please migrate to "${definitions_1.LAYOUT_MANIFEST_FILE}" using the new layout definition format. ` +
|
|
26
|
-
`Support for files other than "${definitions_1.LAYOUT_MANIFEST_FILE}" will be removed in a future version. ` +
|
|
27
|
-
'For more information, visit https://docs.squiz.net/component-service/latest/layouts/layout-files.html');
|
|
28
|
-
});
|
|
29
|
-
it('should extract filename correctly from full path', () => {
|
|
30
|
-
const layoutFile = '/very/deep/nested/path/to/layout/page-layout.yaml';
|
|
31
|
-
(0, validateLayoutFormat_1.validateLayoutFormat)(mockLogger, layoutFile);
|
|
32
|
-
expect(mockLogger.warn).toHaveBeenCalledWith(expect.stringContaining('"page-layout.yaml"'));
|
|
33
|
-
});
|
|
34
|
-
it('should log a default config file warning when file is not provided', () => {
|
|
35
|
-
(0, validateLayoutFormat_1.validateLayoutFormat)(mockLogger);
|
|
36
|
-
expect(mockLogger.warn).toHaveBeenCalledTimes(1);
|
|
37
|
-
expect(mockLogger.warn).toHaveBeenCalledWith('⚠️ DEFAULT CONFIG FILE: "manifest.json" has replaced "page-layout.yaml" as the default config file. ' +
|
|
38
|
-
`Please migrate to "${definitions_1.LAYOUT_MANIFEST_FILE}" using the new layout definition format. ` +
|
|
39
|
-
`Support for files other than "${definitions_1.LAYOUT_MANIFEST_FILE}" will be removed in a future version. ` +
|
|
40
|
-
'For more information, visit https://docs.squiz.net/component-service/latest/layouts/layout-files.html');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { LayoutDefinition } from '../../utils/definitions';
|
|
2
|
-
/**
|
|
3
|
-
* Validates that zones defined in layout definition match zones used in the Handlebars template
|
|
4
|
-
* @param layout The layout definition containing zones and template
|
|
5
|
-
* @returns Error message if validation fails, null if validation passes
|
|
6
|
-
*/
|
|
7
|
-
export declare function validateZoneConsistency(layout: LayoutDefinition): string | null;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateZoneConsistency = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Validates that zones defined in layout definition match zones used in the Handlebars template
|
|
6
|
-
* @param layout The layout definition containing zones and template
|
|
7
|
-
* @returns Error message if validation fails, null if validation passes
|
|
8
|
-
*/
|
|
9
|
-
function validateZoneConsistency(layout) {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
const layoutZones = (_b = (_a = layout.zones) === null || _a === void 0 ? void 0 : _a.map(zone => zone.key)) !== null && _b !== void 0 ? _b : [];
|
|
12
|
-
const template = layout.template;
|
|
13
|
-
// If no template is provided, skip validation
|
|
14
|
-
if (!template) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
// Extract zone references from Handlebars template
|
|
18
|
-
// Look for patterns like {{#each zones.zoneName}}, {{zones.zoneName}}, {{#if zones.zoneName}}
|
|
19
|
-
const zonePattern = /\{\{(?:#(?:each|if)\s+)?zones\.(\w+)/g;
|
|
20
|
-
const templateZones = new Set();
|
|
21
|
-
let match;
|
|
22
|
-
// Loop through the template and extract the zone names
|
|
23
|
-
while ((match = zonePattern.exec(template)) !== null) {
|
|
24
|
-
templateZones.add(match[1]);
|
|
25
|
-
}
|
|
26
|
-
// Convert the set to an array
|
|
27
|
-
const templateZoneArray = Array.from(templateZones);
|
|
28
|
-
// Find zones defined in layout definition but not used in template
|
|
29
|
-
const unusedLayoutZones = layoutZones.filter(zone => !templateZones.has(zone));
|
|
30
|
-
// Find zones used in template but not defined in layout definition
|
|
31
|
-
const undefinedTemplateZones = templateZoneArray.filter(zone => !layoutZones.includes(zone));
|
|
32
|
-
// Create an array of errors
|
|
33
|
-
const errors = [];
|
|
34
|
-
// Add the unused zones to the errors
|
|
35
|
-
if (unusedLayoutZones.length > 0) {
|
|
36
|
-
errors.push(`Zones defined in layout definition but not used in template: ${unusedLayoutZones.join(', ')}`);
|
|
37
|
-
}
|
|
38
|
-
// Add the undefined zones to the errors
|
|
39
|
-
if (undefinedTemplateZones.length > 0) {
|
|
40
|
-
errors.push(`Zones used in template but not defined in layout definition: ${undefinedTemplateZones.join(', ')}`);
|
|
41
|
-
}
|
|
42
|
-
// If there are errors, return the errors
|
|
43
|
-
if (errors.length > 0) {
|
|
44
|
-
return `Zone consistency validation failed:\n${errors
|
|
45
|
-
.map(err => ` - ${err}`)
|
|
46
|
-
.join('\n')}`;
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
exports.validateZoneConsistency = validateZoneConsistency;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const zone_consistency_1 = require("./zone-consistency");
|
|
4
|
-
describe('validateZoneConsistency', () => {
|
|
5
|
-
const createMockLayout = (zones, template) => ({
|
|
6
|
-
name: 'test-layout',
|
|
7
|
-
displayName: 'Test Layout',
|
|
8
|
-
description: 'A test layout',
|
|
9
|
-
zones,
|
|
10
|
-
template,
|
|
11
|
-
});
|
|
12
|
-
it('should return null for valid zone consistency', () => {
|
|
13
|
-
const layout = createMockLayout([
|
|
14
|
-
{ key: 'header', displayName: 'Header', description: 'Header zone' },
|
|
15
|
-
{ key: 'content', displayName: 'Content', description: 'Content zone' },
|
|
16
|
-
], '<div>{{zones.header}}</div><div>{{zones.content}}</div>');
|
|
17
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
18
|
-
expect(result).toBeNull();
|
|
19
|
-
});
|
|
20
|
-
it('should return null when no template is provided', () => {
|
|
21
|
-
const layout = createMockLayout([{ key: 'header', displayName: 'Header', description: 'Header zone' }], '');
|
|
22
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
23
|
-
expect(result).toBeNull();
|
|
24
|
-
});
|
|
25
|
-
it('should detect zones defined in YAML but not used in template', () => {
|
|
26
|
-
const layout = createMockLayout([
|
|
27
|
-
{ key: 'header', displayName: 'Header', description: 'Header zone' },
|
|
28
|
-
{ key: 'sidebar', displayName: 'Sidebar', description: 'Sidebar zone' },
|
|
29
|
-
], '<div>{{zones.header}}</div>');
|
|
30
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
31
|
-
expect(result).toContain('Zone consistency validation failed');
|
|
32
|
-
expect(result).toContain('Zones defined in layout definition but not used in template: sidebar');
|
|
33
|
-
});
|
|
34
|
-
it('should detect zones used in template but not defined in YAML', () => {
|
|
35
|
-
const layout = createMockLayout([{ key: 'header', displayName: 'Header', description: 'Header zone' }], '<div>{{zones.header}}</div><div>{{zones.footer}}</div>');
|
|
36
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
37
|
-
expect(result).toContain('Zone consistency validation failed');
|
|
38
|
-
expect(result).toContain('Zones used in template but not defined in layout definition: footer');
|
|
39
|
-
});
|
|
40
|
-
it('should detect both unused and undefined zones', () => {
|
|
41
|
-
const layout = createMockLayout([
|
|
42
|
-
{ key: 'header', displayName: 'Header', description: 'Header zone' },
|
|
43
|
-
{ key: 'sidebar', displayName: 'Sidebar', description: 'Sidebar zone' },
|
|
44
|
-
], '<div>{{zones.header}}</div><div>{{zones.footer}}</div>');
|
|
45
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
46
|
-
expect(result).toContain('Zone consistency validation failed');
|
|
47
|
-
expect(result).toContain('Zones defined in layout definition but not used in template: sidebar');
|
|
48
|
-
expect(result).toContain('Zones used in template but not defined in layout definition: footer');
|
|
49
|
-
});
|
|
50
|
-
it('should handle Handlebars each loops', () => {
|
|
51
|
-
const layout = createMockLayout([{ key: 'items', displayName: 'Items', description: 'Items zone' }], '<div>{{#each zones.items}}<p>{{this}}</p>{{/each}}</div>');
|
|
52
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
53
|
-
expect(result).toBeNull();
|
|
54
|
-
});
|
|
55
|
-
it('should handle Handlebars if conditions', () => {
|
|
56
|
-
const layout = createMockLayout([
|
|
57
|
-
{
|
|
58
|
-
key: 'optional',
|
|
59
|
-
displayName: 'Optional',
|
|
60
|
-
description: 'Optional zone',
|
|
61
|
-
},
|
|
62
|
-
], '<div>{{#if zones.optional}}{{zones.optional}}{{/if}}</div>');
|
|
63
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
64
|
-
expect(result).toBeNull();
|
|
65
|
-
});
|
|
66
|
-
it('should handle complex Handlebars patterns', () => {
|
|
67
|
-
const layout = createMockLayout([
|
|
68
|
-
{ key: 'header', displayName: 'Header', description: 'Header zone' },
|
|
69
|
-
{ key: 'content', displayName: 'Content', description: 'Content zone' },
|
|
70
|
-
{ key: 'sidebar', displayName: 'Sidebar', description: 'Sidebar zone' },
|
|
71
|
-
], `
|
|
72
|
-
<div>{{zones.header}}</div>
|
|
73
|
-
<div>
|
|
74
|
-
{{#if zones.sidebar}}
|
|
75
|
-
<aside>{{zones.sidebar}}</aside>
|
|
76
|
-
{{/if}}
|
|
77
|
-
<main>{{zones.content}}</main>
|
|
78
|
-
</div>
|
|
79
|
-
`);
|
|
80
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
81
|
-
expect(result).toBeNull();
|
|
82
|
-
});
|
|
83
|
-
it('should handle empty zones object', () => {
|
|
84
|
-
const layout = createMockLayout([], '<div>Static content only</div>');
|
|
85
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
86
|
-
expect(result).toBeNull();
|
|
87
|
-
});
|
|
88
|
-
it('should handle undefined zones property', () => {
|
|
89
|
-
const layout = {
|
|
90
|
-
name: 'test-layout',
|
|
91
|
-
displayName: 'Test Layout',
|
|
92
|
-
description: 'A test layout',
|
|
93
|
-
zones: undefined,
|
|
94
|
-
template: '<div>Static content only</div>',
|
|
95
|
-
};
|
|
96
|
-
const result = (0, zone_consistency_1.validateZoneConsistency)(layout);
|
|
97
|
-
expect(result).toBeNull();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2025, Squiz Australia Pty Ltd.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Validates a template file and returns detailed results
|
|
8
|
-
* @param content - The template to validate
|
|
9
|
-
* @returns An array of errors
|
|
10
|
-
*/
|
|
11
|
-
export declare function validateTemplateFile(content: string): string[];
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright (c) 2025, Squiz Australia Pty Ltd.
|
|
5
|
-
* All rights reserved.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.validateTemplateFile = void 0;
|
|
9
|
-
/**
|
|
10
|
-
* Validates a template file and returns detailed results
|
|
11
|
-
* @param content - The template to validate
|
|
12
|
-
* @returns An array of errors
|
|
13
|
-
*/
|
|
14
|
-
function validateTemplateFile(content) {
|
|
15
|
-
const errors = [];
|
|
16
|
-
// Check for top-level HTML structure tags that should not be in body content
|
|
17
|
-
const topLevelTags = [
|
|
18
|
-
{ name: 'html', regex: /<html(\s|>)/gi },
|
|
19
|
-
{ name: 'head', regex: /<head(\s|>)/gi },
|
|
20
|
-
{ name: 'body', regex: /<body(\s|>)/gi },
|
|
21
|
-
{ name: 'doctype', regex: /<!DOCTYPE[^>]*>/gi },
|
|
22
|
-
];
|
|
23
|
-
for (const tag of topLevelTags) {
|
|
24
|
-
if (tag.regex.test(content)) {
|
|
25
|
-
errors.push(`Template should not contain top-level HTML structure tag: <${tag.name}>. Templates should only contain body content.`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return errors;
|
|
29
|
-
}
|
|
30
|
-
exports.validateTemplateFile = validateTemplateFile;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|