Skip to content

Commit 48e3eb4

Browse files
Merge pull request #5979 from Shopify/skip-auth-for-app-build
Do not require authentication for app build command
2 parents 85961a8 + 448adb7 commit 48e3eb4

File tree

30 files changed

+336
-95
lines changed

30 files changed

+336
-95
lines changed

packages/app/src/cli/commands/app/app-logs/sources.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {appFlags} from '../../../flags.js'
22
import {linkedAppContext} from '../../../services/app-context.js'
33
import {sources} from '../../../services/app-logs/sources.js'
4-
import AppCommand, {AppCommandOutput} from '../../../utilities/app-command.js'
4+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
55
import {globalFlags} from '@shopify/cli-kit/node/cli'
66

7-
export default class Sources extends AppCommand {
7+
export default class Sources extends AppLinkedCommand {
88
static summary = 'Print out a list of sources that may be used with the logs command.'
99

1010
static descriptionWithMarkdown = `The output source names can be used with the \`--source\` argument of \`shopify app logs\` to filter log output. Currently only function extensions are supported as sources.`
@@ -16,7 +16,7 @@ export default class Sources extends AppCommand {
1616
...appFlags,
1717
}
1818

19-
public async run(): Promise<AppCommandOutput> {
19+
public async run(): Promise<AppLinkedCommandOutput> {
2020
const {flags} = await this.parse(Sources)
2121

2222
const {app} = await linkedAppContext({

packages/app/src/cli/commands/app/build.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {appFlags} from '../../flags.js'
22
import build from '../../services/build.js'
33
import {showApiKeyDeprecationWarning} from '../../prompts/deprecation-warnings.js'
4-
import AppCommand, {AppCommandOutput} from '../../utilities/app-command.js'
5-
import {linkedAppContext} from '../../services/app-context.js'
4+
import {localAppContext} from '../../services/app-context.js'
5+
import AppUnlinkedCommand, {AppUnlinkedCommandOutput} from '../../utilities/app-unlinked-command.js'
66
import {Flags} from '@oclif/core'
77
import {globalFlags} from '@shopify/cli-kit/node/cli'
88
import {addPublicMetadata} from '@shopify/cli-kit/node/metadata'
99

10-
export default class Build extends AppCommand {
10+
export default class Build extends AppUnlinkedCommand {
1111
static summary = 'Build the app, including extensions.'
1212

1313
static descriptionWithMarkdown = `This command executes the build script specified in the element's TOML file. You can specify a custom script in the file. To learn about configuration files in Shopify apps, refer to [App configuration](https://shopify.dev/docs/apps/tools/cli/configuration).
@@ -33,7 +33,7 @@ export default class Build extends AppCommand {
3333
}),
3434
}
3535

36-
async run(): Promise<AppCommandOutput> {
36+
async run(): Promise<AppUnlinkedCommandOutput> {
3737
const {flags} = await this.parse(Build)
3838
if (flags['api-key']) {
3939
await showApiKeyDeprecationWarning()
@@ -44,10 +44,8 @@ export default class Build extends AppCommand {
4444
cmd_app_dependency_installation_skipped: flags['skip-dependencies-installation'],
4545
}))
4646

47-
const {app} = await linkedAppContext({
47+
const app = await localAppContext({
4848
directory: flags.path,
49-
clientId: apiKey,
50-
forceRelink: flags.reset,
5149
userProvidedConfigName: flags.config,
5250
})
5351

packages/app/src/cli/commands/app/config/link.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {appFlags} from '../../../flags.js'
22
import {linkedAppContext} from '../../../services/app-context.js'
33
import link, {LinkOptions} from '../../../services/app/config/link.js'
4-
import AppCommand, {AppCommandOutput} from '../../../utilities/app-command.js'
4+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
55
import {globalFlags} from '@shopify/cli-kit/node/cli'
66

7-
export default class ConfigLink extends AppCommand {
7+
export default class ConfigLink extends AppLinkedCommand {
88
static summary = 'Fetch your app configuration from the Partner Dashboard.'
99

1010
static descriptionWithMarkdown = `Pulls app configuration from the Partner Dashboard and creates or overwrites a configuration file. You can create a new app with this command to start with a default configuration file.
@@ -19,7 +19,7 @@ export default class ConfigLink extends AppCommand {
1919
...appFlags,
2020
}
2121

22-
public async run(): Promise<AppCommandOutput> {
22+
public async run(): Promise<AppLinkedCommandOutput> {
2323
const {flags} = await this.parse(ConfigLink)
2424

2525
const options: LinkOptions = {

packages/app/src/cli/commands/app/config/use.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import {appFlags} from '../../../flags.js'
22
import {checkFolderIsValidApp} from '../../../models/app/loader.js'
33
import {linkedAppContext} from '../../../services/app-context.js'
44
import use from '../../../services/app/config/use.js'
5-
import AppCommand, {AppCommandOutput} from '../../../utilities/app-command.js'
5+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
66
import {Args} from '@oclif/core'
77
import {globalFlags} from '@shopify/cli-kit/node/cli'
88

99
// This is one of the few commands where we don't need a
1010
// `--config` flag, because we're passing it as an argument.
1111
const {config, ...appFlagsWithoutConfig} = appFlags
1212

13-
export default class ConfigUse extends AppCommand {
13+
export default class ConfigUse extends AppLinkedCommand {
1414
static summary = 'Activate an app configuration.'
1515

1616
static descriptionWithMarkdown = `Sets default configuration when you run app-related CLI commands. If you omit the \`config-name\` parameter, then you'll be prompted to choose from the configuration files in your project.`
@@ -32,7 +32,7 @@ export default class ConfigUse extends AppCommand {
3232
}),
3333
}
3434

35-
public async run(): Promise<AppCommandOutput> {
35+
public async run(): Promise<AppLinkedCommandOutput> {
3636
const {flags, args} = await this.parse(ConfigUse)
3737

3838
await checkFolderIsValidApp(flags.path)

packages/app/src/cli/commands/app/demo/watcher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {appFlags} from '../../../flags.js'
22
import {AppEventWatcher, EventType} from '../../../services/dev/app-events/app-event-watcher.js'
3-
import AppCommand, {AppCommandOutput} from '../../../utilities/app-command.js'
3+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
44
import {linkedAppContext} from '../../../services/app-context.js'
55
import colors from '@shopify/cli-kit/node/colors'
66
import {globalFlags} from '@shopify/cli-kit/node/cli'
77
import {outputInfo} from '@shopify/cli-kit/node/output'
88
import {endHRTimeInMs} from '@shopify/cli-kit/node/hrtime'
99

10-
export default class DemoWatcher extends AppCommand {
10+
export default class DemoWatcher extends AppLinkedCommand {
1111
static summary = 'Watch and prints out changes to an app.'
1212
static hidden = true
1313

@@ -16,7 +16,7 @@ export default class DemoWatcher extends AppCommand {
1616
...appFlags,
1717
}
1818

19-
public async run(): Promise<AppCommandOutput> {
19+
public async run(): Promise<AppLinkedCommandOutput> {
2020
const {flags} = await this.parse(DemoWatcher)
2121

2222
const {app} = await linkedAppContext({

packages/app/src/cli/commands/app/deploy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import {validateVersion} from '../../validations/version-name.js'
55
import {showApiKeyDeprecationWarning} from '../../prompts/deprecation-warnings.js'
66
import {validateMessage} from '../../validations/message.js'
77
import metadata from '../../metadata.js'
8-
import AppCommand, {AppCommandOutput} from '../../utilities/app-command.js'
8+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../utilities/app-linked-command.js'
99
import {linkedAppContext} from '../../services/app-context.js'
1010
import {Flags} from '@oclif/core'
1111
import {globalFlags} from '@shopify/cli-kit/node/cli'
1212
import {addPublicMetadata} from '@shopify/cli-kit/node/metadata'
1313

14-
export default class Deploy extends AppCommand {
14+
export default class Deploy extends AppLinkedCommand {
1515
static summary = 'Deploy your Shopify app.'
1616

1717
static descriptionWithMarkdown = `[Builds the app](https://shopify.dev/docs/api/shopify-cli/app/app-build), then deploys your app configuration and extensions.
@@ -63,7 +63,7 @@ export default class Deploy extends AppCommand {
6363
}),
6464
}
6565

66-
async run(): Promise<AppCommandOutput> {
66+
async run(): Promise<AppLinkedCommandOutput> {
6767
const {flags} = await this.parse(Deploy)
6868

6969
await metadata.addPublicMetadata(() => ({

packages/app/src/cli/commands/app/dev.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {appFlags} from '../../flags.js'
22
import {dev, DevOptions} from '../../services/dev.js'
33
import {showApiKeyDeprecationWarning} from '../../prompts/deprecation-warnings.js'
44
import {checkFolderIsValidApp} from '../../models/app/loader.js'
5-
import AppCommand, {AppCommandOutput} from '../../utilities/app-command.js'
5+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../utilities/app-linked-command.js'
66
import {linkedAppContext} from '../../services/app-context.js'
77
import {storeContext} from '../../services/store-context.js'
88
import {getTunnelMode} from '../../services/dev/tunnel-mode.js'
@@ -11,7 +11,7 @@ import {normalizeStoreFqdn} from '@shopify/cli-kit/node/context/fqdn'
1111
import {globalFlags} from '@shopify/cli-kit/node/cli'
1212
import {addPublicMetadata} from '@shopify/cli-kit/node/metadata'
1313

14-
export default class Dev extends AppCommand {
14+
export default class Dev extends AppLinkedCommand {
1515
static summary = 'Run the app.'
1616

1717
static descriptionWithMarkdown = `[Builds the app](https://shopify.dev/docs/api/shopify-cli/app/app-build) and lets you preview it on a [development store](https://shopify.dev/docs/apps/tools/development-stores) or [Plus sandbox store](https://help.shopify.com/partners/dashboard/managing-stores/plus-sandbox-store).
@@ -122,7 +122,7 @@ If you're using the Ruby app template, then you need to complete the following s
122122
return 'app dev stop'
123123
}
124124

125-
public async run(): Promise<AppCommandOutput> {
125+
public async run(): Promise<AppLinkedCommandOutput> {
126126
const {flags} = await this.parse(Dev)
127127

128128
if (!flags['api-key'] && process.env.SHOPIFY_API_KEY) {

packages/app/src/cli/commands/app/dev/clean.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {linkedAppContext} from '../../../services/app-context.js'
2-
import AppCommand, {AppCommandOutput} from '../../../utilities/app-command.js'
2+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
33
import {appFlags} from '../../../flags.js'
44
import {storeContext} from '../../../services/store-context.js'
55
import {devClean} from '../../../services/dev-clean.js'
66
import {globalFlags} from '@shopify/cli-kit/node/cli'
77
import {Flags} from '@oclif/core'
88
import {normalizeStoreFqdn} from '@shopify/cli-kit/node/context/fqdn'
99

10-
export default class DevClean extends AppCommand {
10+
export default class DevClean extends AppLinkedCommand {
1111
static summary = 'Cleans up the app preview from the selected store.'
1212

1313
static descriptionWithMarkdown = `Stop the app preview that was started with \`shopify app dev\`.
@@ -31,7 +31,7 @@ export default class DevClean extends AppCommand {
3131
}),
3232
}
3333

34-
public async run(): Promise<AppCommandOutput> {
34+
public async run(): Promise<AppLinkedCommandOutput> {
3535
const {flags} = await this.parse(DevClean)
3636

3737
const appContextResult = await linkedAppContext({

packages/app/src/cli/commands/app/env/pull.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {appFlags} from '../../../flags.js'
22
import {getDotEnvFileName} from '../../../models/app/loader.js'
33
import {pullEnv} from '../../../services/app/env/pull.js'
4-
import AppCommand, {AppCommandOutput} from '../../../utilities/app-command.js'
4+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
55
import {linkedAppContext} from '../../../services/app-context.js'
66
import {Flags} from '@oclif/core'
77
import {globalFlags} from '@shopify/cli-kit/node/cli'
88
import {outputResult} from '@shopify/cli-kit/node/output'
99
import {joinPath} from '@shopify/cli-kit/node/path'
1010

11-
export default class EnvPull extends AppCommand {
11+
export default class EnvPull extends AppLinkedCommand {
1212
static summary = 'Pull app and extensions environment variables.'
1313

1414
static descriptionWithMarkdown = `Creates or updates an \`.env\` files that contains app and app extension environment variables.
@@ -27,7 +27,7 @@ export default class EnvPull extends AppCommand {
2727
}),
2828
}
2929

30-
public async run(): Promise<AppCommandOutput> {
30+
public async run(): Promise<AppLinkedCommandOutput> {
3131
const {flags} = await this.parse(EnvPull)
3232

3333
const {app, remoteApp, organization} = await linkedAppContext({

packages/app/src/cli/commands/app/env/show.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {appFlags} from '../../../flags.js'
22
import {linkedAppContext} from '../../../services/app-context.js'
33
import {showEnv} from '../../../services/app/env/show.js'
4-
import AppCommand, {AppCommandOutput} from '../../../utilities/app-command.js'
4+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
55
import {globalFlags} from '@shopify/cli-kit/node/cli'
66
import {outputResult} from '@shopify/cli-kit/node/output'
77

8-
export default class EnvShow extends AppCommand {
8+
export default class EnvShow extends AppLinkedCommand {
99
static summary = 'Display app and extensions environment variables.'
1010

1111
static descriptionWithMarkdown = `Displays environment variables that can be used to deploy apps and app extensions.`
@@ -17,7 +17,7 @@ export default class EnvShow extends AppCommand {
1717
...appFlags,
1818
}
1919

20-
public async run(): Promise<AppCommandOutput> {
20+
public async run(): Promise<AppLinkedCommandOutput> {
2121
const {flags} = await this.parse(EnvShow)
2222
const {app, remoteApp, organization} = await linkedAppContext({
2323
directory: flags.path,

0 commit comments

Comments
 (0)