Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/lucky-dots-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/app': minor
---

Add --allow-updates and --allow-delete flags to deploy and release
16 changes: 14 additions & 2 deletions docs-shopify.dev/commands/interfaces/app-deploy.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
// This is an autogenerated file. Don't edit this file manually.
export interface appdeploy {
/**
* Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.
* @environment SHOPIFY_FLAG_ALLOW_DELETES
*/
'--allow-deletes'?: ''

/**
* Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.
* @environment SHOPIFY_FLAG_ALLOW_UPDATES
*/
'--allow-updates'?: ''

/**
* The Client ID of your app.
* @environment SHOPIFY_FLAG_CLIENT_ID
Expand All @@ -13,7 +25,7 @@ export interface appdeploy {
'-c, --config <value>'?: string

/**
* Deploy without asking for confirmation.
* Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.
* @environment SHOPIFY_FLAG_FORCE
*/
'-f, --force'?: ''
Expand All @@ -37,7 +49,7 @@ export interface appdeploy {
'--no-color'?: ''

/**
* Creates a version but doesn't release it - it's not made available to merchants.
* Creates a version but doesn't release it - it's not made available to merchants. With this flag, a user confirmation is not required.
* @environment SHOPIFY_FLAG_NO_RELEASE
*/
'--no-release'?: ''
Expand Down
14 changes: 13 additions & 1 deletion docs-shopify.dev/commands/interfaces/app-release.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
// This is an autogenerated file. Don't edit this file manually.
export interface apprelease {
/**
* Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.
* @environment SHOPIFY_FLAG_ALLOW_DELETES
*/
'--allow-deletes'?: ''

/**
* Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.
* @environment SHOPIFY_FLAG_ALLOW_UPDATES
*/
'--allow-updates'?: ''

/**
* The Client ID of your app.
* @environment SHOPIFY_FLAG_CLIENT_ID
Expand All @@ -13,7 +25,7 @@ export interface apprelease {
'-c, --config <value>'?: string

/**
* Release without asking for confirmation.
* Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.
* @environment SHOPIFY_FLAG_FORCE
*/
'-f, --force'?: ''
Expand Down
46 changes: 41 additions & 5 deletions docs-shopify.dev/generated/generated_docs_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,24 @@
"name": "appdeploy",
"description": "",
"members": [
{
"filePath": "docs-shopify.dev/commands/interfaces/app-deploy.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--allow-deletes",
"value": "\"\"",
"description": "Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_ALLOW_DELETES"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/app-deploy.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--allow-updates",
"value": "\"\"",
"description": "Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_ALLOW_UPDATES"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/app-deploy.interface.ts",
"syntaxKind": "PropertySignature",
Expand Down Expand Up @@ -437,7 +455,7 @@
"syntaxKind": "PropertySignature",
"name": "--no-release",
"value": "\"\"",
"description": "Creates a version but doesn't release it - it's not made available to merchants.",
"description": "Creates a version but doesn't release it - it's not made available to merchants. With this flag, a user confirmation is not required.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_NO_RELEASE"
},
Expand Down Expand Up @@ -500,12 +518,12 @@
"syntaxKind": "PropertySignature",
"name": "-f, --force",
"value": "\"\"",
"description": "Deploy without asking for confirmation.",
"description": "Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_FORCE"
}
],
"value": "export interface appdeploy {\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Deploy without asking for confirmation.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Optional message that will be associated with this version. This is for internal use only and won't be available externally.\n * @environment SHOPIFY_FLAG_MESSAGE\n */\n '--message <value>'?: string\n\n /**\n * Use with caution: Skips building any elements of the app that require building. You should ensure your app has been prepared in advance, such as by running `shopify app build` or by caching build artifacts.\n * @environment SHOPIFY_FLAG_NO_BUILD\n */\n '--no-build'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Creates a version but doesn't release it - it's not made available to merchants.\n * @environment SHOPIFY_FLAG_NO_RELEASE\n */\n '--no-release'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * URL associated with the new app version.\n * @environment SHOPIFY_FLAG_SOURCE_CONTROL_URL\n */\n '--source-control-url <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * Optional version tag that will be associated with this app version. If not provided, an auto-generated identifier will be generated for this app version.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>'?: string\n}"
"value": "export interface appdeploy {\n /**\n * Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_ALLOW_DELETES\n */\n '--allow-deletes'?: ''\n\n /**\n * Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.\n * @environment SHOPIFY_FLAG_ALLOW_UPDATES\n */\n '--allow-updates'?: ''\n\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Optional message that will be associated with this version. This is for internal use only and won't be available externally.\n * @environment SHOPIFY_FLAG_MESSAGE\n */\n '--message <value>'?: string\n\n /**\n * Use with caution: Skips building any elements of the app that require building. You should ensure your app has been prepared in advance, such as by running `shopify app build` or by caching build artifacts.\n * @environment SHOPIFY_FLAG_NO_BUILD\n */\n '--no-build'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Creates a version but doesn't release it - it's not made available to merchants. With this flag, a user confirmation is not required.\n * @environment SHOPIFY_FLAG_NO_RELEASE\n */\n '--no-release'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * URL associated with the new app version.\n * @environment SHOPIFY_FLAG_SOURCE_CONTROL_URL\n */\n '--source-control-url <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * Optional version tag that will be associated with this app version. If not provided, an auto-generated identifier will be generated for this app version.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>'?: string\n}"
}
}
}
Expand Down Expand Up @@ -2421,6 +2439,24 @@
"name": "apprelease",
"description": "",
"members": [
{
"filePath": "docs-shopify.dev/commands/interfaces/app-release.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--allow-deletes",
"value": "\"\"",
"description": "Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_ALLOW_DELETES"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/app-release.interface.ts",
"syntaxKind": "PropertySignature",
"name": "--allow-updates",
"value": "\"\"",
"description": "Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_ALLOW_UPDATES"
},
{
"filePath": "docs-shopify.dev/commands/interfaces/app-release.interface.ts",
"syntaxKind": "PropertySignature",
Expand Down Expand Up @@ -2488,12 +2524,12 @@
"syntaxKind": "PropertySignature",
"name": "-f, --force",
"value": "\"\"",
"description": "Release without asking for confirmation.",
"description": "Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_FORCE"
}
],
"value": "export interface apprelease {\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Release without asking for confirmation.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * The name of the app version to release.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>': string\n}"
"value": "export interface apprelease {\n /**\n * Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_ALLOW_DELETES\n */\n '--allow-deletes'?: ''\n\n /**\n * Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.\n * @environment SHOPIFY_FLAG_ALLOW_UPDATES\n */\n '--allow-updates'?: ''\n\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * The name of the app version to release.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>': string\n}"
}
}
}
Expand Down
37 changes: 29 additions & 8 deletions packages/app/src/cli/commands/app/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {appFlags} from '../../flags.js'
import {deploy} from '../../services/deploy.js'
import {getAppConfigurationState} from '../../models/app/loader.js'
import {validateVersion} from '../../validations/version-name.js'
import {validateMessage} from '../../validations/message.js'
import metadata from '../../metadata.js'
Expand All @@ -27,13 +26,27 @@ export default class Deploy extends AppLinkedCommand {
...appFlags,
force: Flags.boolean({
hidden: false,
description: 'Deploy without asking for confirmation.',
description:
'Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.',
env: 'SHOPIFY_FLAG_FORCE',
char: 'f',
}),
'allow-updates': Flags.boolean({
hidden: false,
description:
'Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.',
env: 'SHOPIFY_FLAG_ALLOW_UPDATES',
}),
'allow-deletes': Flags.boolean({
hidden: false,
description:
'Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.',
env: 'SHOPIFY_FLAG_ALLOW_DELETES',
}),
'no-release': Flags.boolean({
hidden: false,
description: "Creates a version but doesn't release it - it's not made available to merchants.",
description:
"Creates a version but doesn't release it - it's not made available to merchants. With this flag, a user confirmation is not required.",
env: 'SHOPIFY_FLAG_NO_RELEASE',
default: false,
}),
Expand Down Expand Up @@ -80,10 +93,13 @@ export default class Deploy extends AppLinkedCommand {
cmd_app_reset_used: flags.reset,
}))

const requiredNonTTYFlags = ['force']
const configurationState = await getAppConfigurationState(flags.path, flags.config)
if (configurationState.state === 'template-only' && !clientId) {
requiredNonTTYFlags.push('client-id')
const force = flags.force || flags['no-release']

// When releasing, we require --force or --allow-updates or --allow-deletes for non-TTY.
const requiredNonTTYFlags: string[] = []
const hasAnyForceFlags = force || flags['allow-updates'] || flags['allow-deletes']
if (!hasAnyForceFlags) {
requiredNonTTYFlags.push('allow-updates')
}
this.failMissingNonTTYFlags(flags, requiredNonTTYFlags)

Expand All @@ -94,13 +110,18 @@ export default class Deploy extends AppLinkedCommand {
userProvidedConfigName: flags.config,
})

const allowUpdates = force || flags['allow-updates']
const allowDeletes = force || flags['allow-deletes']

const result = await deploy({
app,
remoteApp,
organization,
developerPlatformClient,
reset: flags.reset,
force: flags.force,
force,
allowUpdates,
allowDeletes,
noRelease: flags['no-release'],
message: flags.message,
version: flags.version,
Expand Down
27 changes: 25 additions & 2 deletions packages/app/src/cli/commands/app/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,23 @@ export default class Release extends AppLinkedCommand {
...appFlags,
force: Flags.boolean({
hidden: false,
description: 'Release without asking for confirmation.',
description:
'Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.',
env: 'SHOPIFY_FLAG_FORCE',
char: 'f',
}),
'allow-updates': Flags.boolean({
hidden: false,
description:
'Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.',
env: 'SHOPIFY_FLAG_ALLOW_UPDATES',
}),
'allow-deletes': Flags.boolean({
hidden: false,
description:
'Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.',
env: 'SHOPIFY_FLAG_ALLOW_DELETES',
}),
version: Flags.string({
hidden: false,
description: 'The name of the app version to release.',
Expand All @@ -41,7 +54,12 @@ export default class Release extends AppLinkedCommand {
cmd_app_reset_used: flags.reset,
}))

const requiredNonTTYFlags = ['force']
// We require --force or --allow-updates or --allow-deletes for non-TTY.
const requiredNonTTYFlags: string[] = []
const hasAnyForceFlags = flags.force || flags['allow-updates'] || flags['allow-deletes']
if (!hasAnyForceFlags) {
requiredNonTTYFlags.push('allow-updates')
}
const configurationState = await getAppConfigurationState(flags.path, flags.config)
if (configurationState.state === 'template-only' && !clientId) {
requiredNonTTYFlags.push('client-id')
Expand All @@ -55,11 +73,16 @@ export default class Release extends AppLinkedCommand {
userProvidedConfigName: flags.config,
})

const allowUpdates = flags.force || flags['allow-updates']
const allowDeletes = flags.force || flags['allow-deletes']

await release({
app,
remoteApp,
developerPlatformClient,
force: flags.force,
allowUpdates,
allowDeletes,
version: flags.version,
})

Expand Down
Loading
Loading