Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade contentful-import, add ability to skip entries #2684

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/cmds/init/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export const getSpace = async (context: any) => {
...context,
activeSpaceId: space.sys.id
},
skipAssetUpdates: false,
skipContentUpdates: false,
content: initialContent
})
} else {
Expand Down
20 changes: 19 additions & 1 deletion lib/cmds/space_cmds/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ export const builder = (yargs: Argv) => {
type: 'boolean',
default: false
})
.option('skip-asset-updates', {
describe:
'Skips asset updates. Skips updating existing assets, only new ones are created. Useful for incremental imports',
type: 'boolean',
default: false
})
.option('skip-content-updates', {
describe:
'Skips content updates. Skips updating existing content, only new content are created. Useful for incremental imports',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'Skips content updates. Skips updating existing content, only new content are created. Useful for incremental imports',
'Skips content updates. Skips updating existing content, only new content is created. Useful for incremental imports',

type: 'boolean',
default: false
})
.option('update', {
describe: 'Update entries if they already exist',
type: 'boolean',
Expand Down Expand Up @@ -117,6 +129,8 @@ interface ImportSpaceProps {
header?: string
proxy?: string
content?: object
skipAssetUpdates: boolean
skipContentUpdates: boolean
}

interface Options {
Expand All @@ -125,6 +139,8 @@ interface Options {
managementApplication: string
managementFeature: string
managementToken?: string
skipAssetUpdates: boolean
skipContentUpdates: boolean
host?: string
headers: string
proxy?: string
Expand All @@ -136,7 +152,7 @@ export const importSpace = async (argv: ImportSpaceProps) => {
warning('The --update option has been deprecated and will be ignored.')
}

const { context, feature = 'space-import' } = argv
const { context, skipAssetUpdates, skipContentUpdates, feature = 'space-import' } = argv
const {
managementToken,
activeSpaceId,
Expand All @@ -152,6 +168,8 @@ export const importSpace = async (argv: ImportSpaceProps) => {
environmentId: activeEnvironmentId,
managementApplication: `contentful.cli/${version}`,
managementFeature: feature,
skipAssetUpdates,
skipContentUpdates,
managementToken,
host,
headers: getHeadersFromOption(argv.header)
Expand Down
Loading