Assets scan feature check for export and import#262
Draft
shafeeqd959 wants to merge 3 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a “deferred” plan/feature check flow for the assetsScan feature in the Contentstack import/export plugins by threading the OCLIF command context into the config setup stage (once credentials are available), and recording feature availability back onto the context.
Changes:
- Adds
planProtectedFeatures = ['assetsScan']to import/export commands and passesthis.contextinto config setup. - Adds deferred feature checks in import/export config handlers using
isFeatureEnabled(...)after auth/config is finalized. - Renames Asset Management config fields in import-setup tests to
csAssetsEnabled/csAssetsUrl, and bumps@contentstack/cli-utilitiesfor export.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/contentstack-import/src/utils/import-config-handler.ts | Adds optional context parameter and performs deferred feature checks after config/auth setup. |
| packages/contentstack-import/src/commands/cm/stacks/import.ts | Adds planProtectedFeatures and passes this.context into setupImportConfig. |
| packages/contentstack-import-setup/test/unit/modules/assets.test.ts | Updates test fixtures to use csAssetsEnabled/csAssetsUrl naming. |
| packages/contentstack-import-setup/test/unit/import-config-handler.test.ts | Updates stubbing approach and expectations for csAssetsEnabled/csAssetsUrl. |
| packages/contentstack-external-migrate/tsconfig.tsbuildinfo | Adds/updates a TypeScript build info artifact. |
| packages/contentstack-export/src/utils/export-config-handler.ts | Adds deferred feature checks and new @contentstack/cli-utilities imports. |
| packages/contentstack-export/src/commands/cm/stacks/export.ts | Adds planProtectedFeatures and passes this.context into setupExportConfig. |
| packages/contentstack-export/package.json | Bumps @contentstack/cli-utilities dependency to ~2.0.0-beta.10. |
| .talismanrc | Updates ignore list formatting and adds ignores for two source files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3
to
+12
| import { | ||
| configHandler, | ||
| isAuthenticated, | ||
| cliux, | ||
| sanitizePath, | ||
| log, | ||
| assertFeatureEnabled, | ||
| FeatureCtx, | ||
| isFeatureEnabled, | ||
| } from '@contentstack/cli-utilities'; |
| for (const featureUid of deferredFeatures) { | ||
| try { | ||
| const status = await isFeatureEnabled(featureUid, planCtx); | ||
| if (context) context.planStatus[featureUid] = status; |
| for (const featureUid of deferredFeatures) { | ||
| try { | ||
| const status = await isFeatureEnabled(featureUid, planCtx); | ||
| if (context) context.planStatus[featureUid] = status; |
Comment on lines
+4
to
+7
| - filename: packages/contentstack-import/src/utils/import-config-handler.ts | ||
| checksum: 25b986edf20dfd555f9ffc6f124d7d6eb7ac1134a5a67224a49ba48aa50b86f3 | ||
| - filename: packages/contentstack-export/src/utils/export-config-handler.ts | ||
| checksum: a024cdb82e21496794f49fd905f983c0d6677ac9d6761f2e46266fea9932041d |
| @@ -1 +1 @@ | |||
| {"root":["./src/index.ts","./src/adapters/registry.ts","./src/adapters/types.ts","./src/adapters/contentful/convert.ts","./src/adapters/contentful/export.ts","./src/adapters/contentful/index.ts","./src/adapters/contentful/validator.ts","./src/commands/external-migrate/audit.ts","./src/commands/external-migrate/convert.ts","./src/commands/external-migrate/create.ts","./src/commands/external-migrate/export.ts","./src/commands/external-migrate/import.ts","./src/commands/external-migrate/status.ts","./src/lib/bundle.ts","./src/lib/clear-import-state.ts","./src/lib/contentful-cli-spawn.ts","./src/lib/conversion-summary.ts","./src/lib/create-stack.ts","./src/lib/csdx-spawn.ts","./src/lib/local-date.ts","./src/lib/log.ts","./src/lib/manifest.ts","./src/lib/parse-json-loose.ts","./src/services/contentful/config.ts","./src/services/contentful/constants.ts","./src/services/contentful/content-type-creator.ts","./src/services/contentful/contentful.service.ts","./src/services/contentful/extension.service.ts","./src/services/contentful/market-app.utils.ts","./src/services/contentful/marketplace.service.ts","./src/services/contentful/releases.ts","./src/services/contentful/scheduled.ts","./src/services/contentful/tasks.ts","./src/services/contentful/types.ts","./src/services/contentful/users.ts","./src/services/contentful/workflows.ts","./src/services/contentful/contentful/jsonrte.ts","./src/services/contentful/contentful/markdown.ts","./src/services/contentful/contentful/roles.ts","./src/services/contentful/contentful/taxonomy.service.ts","./src/services/contentful/mapper/write.ts","./src/services/contentful/migration-contentful/index.js","./src/services/contentful/migration-contentful/libs/contenttypemapper.js","./src/services/contentful/migration-contentful/libs/createinitialmapper.js","./src/services/contentful/migration-contentful/libs/extractcontenttypes.js","./src/services/contentful/migration-contentful/libs/extractlocale.js","./src/services/contentful/migration-contentful/libs/extracttaxonomy.js","./src/services/contentful/migration-contentful/utils/helper.js","./src/services/contentful/prompts/master-locale.ts","./src/services/contentful/utils/custom-logger.utils.ts","./src/services/contentful/utils/index.ts"],"version":"5.9.3"} No newline at end of file | |||
| {"root":["./src/index.ts","./src/adapters/registry.ts","./src/adapters/types.ts","./src/adapters/contentful/convert.ts","./src/adapters/contentful/export.ts","./src/adapters/contentful/index.ts","./src/adapters/contentful/validator.ts","./src/commands/migrate/audit.ts","./src/commands/migrate/convert.ts","./src/commands/migrate/create.ts","./src/commands/migrate/export.ts","./src/commands/migrate/import.ts","./src/commands/migrate/status.ts","./src/lib/bundle.ts","./src/lib/clear-import-state.ts","./src/lib/contentful-cli-spawn.ts","./src/lib/conversion-summary.ts","./src/lib/create-stack.ts","./src/lib/csdx-spawn.ts","./src/lib/local-date.ts","./src/lib/log.ts","./src/lib/manifest.ts","./src/lib/parse-json-loose.ts","./src/services/contentful/config.ts","./src/services/contentful/constants.ts","./src/services/contentful/content-type-creator.ts","./src/services/contentful/contentful.service.ts","./src/services/contentful/extension.service.ts","./src/services/contentful/market-app.utils.ts","./src/services/contentful/marketplace.service.ts","./src/services/contentful/releases.ts","./src/services/contentful/scheduled.ts","./src/services/contentful/tasks.ts","./src/services/contentful/types.ts","./src/services/contentful/users.ts","./src/services/contentful/workflows.ts","./src/services/contentful/contentful/jsonrte.ts","./src/services/contentful/contentful/markdown.ts","./src/services/contentful/contentful/roles.ts","./src/services/contentful/contentful/taxonomy.service.ts","./src/services/contentful/mapper/write.ts","./src/services/contentful/migration-contentful/index.js","./src/services/contentful/migration-contentful/libs/contenttypemapper.js","./src/services/contentful/migration-contentful/libs/createinitialmapper.js","./src/services/contentful/migration-contentful/libs/extractcontenttypes.js","./src/services/contentful/migration-contentful/libs/extractlocale.js","./src/services/contentful/migration-contentful/libs/extracttaxonomy.js","./src/services/contentful/migration-contentful/utils/helper.js","./src/services/contentful/prompts/master-locale.ts","./src/services/contentful/utils/custom-logger.utils.ts","./src/services/contentful/utils/index.ts"],"version":"5.9.3"} No newline at end of file | |||
| import { ExportConfig } from '../types'; | ||
|
|
||
| const setupConfig = async (exportCmdFlags: any): Promise<ExportConfig> => { | ||
| const setupConfig = async (exportCmdFlags: any, context: any): Promise<ExportConfig> => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.