Skip to content

Commit

Permalink
Remove ngrok plugin and references
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloriestra committed Jul 10, 2023
1 parent 45f52b1 commit 6e0d872
Show file tree
Hide file tree
Showing 37 changed files with 35 additions and 1,386 deletions.
1 change: 0 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"@shopify/cli-kit",
"@shopify/theme",
"@shopify/ui-extensions-dev-console-app",
"@shopify/plugin-ngrok",
"@shopify/plugin-cloudflare",
"@shopify/plugin-did-you-mean"
]],
Expand Down
8 changes: 8 additions & 0 deletions .changeset/nervous-gorillas-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@shopify/plugin-cloudflare': minor
'@shopify/create-app': minor
'@shopify/app': minor
'@shopify/cli': minor
---

Remove ngrok plugin
8 changes: 0 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ The [`@shopify/cli-kit`](https://www.npmjs.com/package/@shopify/cli-kit) NPM pac
- [Using UI Kit](cli-kit/ui-kit/readme.md)
- [Contributing to UI Kit](cli-kit/ui-kit/contributing.md)

## Plugins

[Plugins](./cli/plugins.md) are NPM packages that extend, customize, and augment core CLI functionality. Some plugins are developed by Shopify (included in the list below), and we refer to them as official plugins, while external developers develop others. If you want to develop a plugin, we recommend checking out the resources in the development section below.

### List of official plugins

* [Ngrok tunnel](./plugins/ngrok.md)

## Decision Record

The following pages document the rationale behind some decisions that we made:
Expand Down
16 changes: 0 additions & 16 deletions docs/cli/plugins.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/plugins/ngrok.md

This file was deleted.

16 changes: 0 additions & 16 deletions packages/app/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,22 +285,6 @@
"tunnel"
]
},
"tunnel": {
"name": "tunnel",
"type": "option",
"description": "Select the tunnel provider",
"hidden": false,
"multiple": false,
"options": [
"cloudflare",
"ngrok"
],
"exclusive": [
"tunnel-url",
"no-tunnel"
],
"default": "cloudflare"
},
"theme": {
"name": "theme",
"type": "option",
Expand Down
2 changes: 0 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"@shopify/cli-kit": "3.47.0",
"@shopify/function-runner": "4.1.0",
"@shopify/plugin-cloudflare": "3.47.0",
"@shopify/plugin-ngrok": "3.47.0",
"abort-controller": "3.0.0",
"chokidar": "3.5.3",
"diff": "5.1.0",
Expand Down Expand Up @@ -91,7 +90,6 @@
"sensitive_command_metadata": "./dist/cli/hooks/sensitive_metadata"
},
"plugins": [
"@shopify/plugin-ngrok",
"@shopify/plugin-cloudflare"
]
}
Expand Down
6 changes: 0 additions & 6 deletions packages/app/src/cli/api/graphql/find_org_basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export const FindOrganizationBasicQuery = gql`
id
businessName
website
betas {
cliTunnelAlternative
}
}
}
}
Expand All @@ -21,9 +18,6 @@ export interface FindOrganizationBasicQuerySchema {
id: string
businessName: string
website: string
betas: {
cliTunnelAlternative?: boolean
}
}[]
}
}
9 changes: 0 additions & 9 deletions packages/app/src/cli/commands/app/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ export default class Dev extends Command {
default: false,
exclusive: ['tunnel-url', 'tunnel'],
}),
tunnel: Flags.string({
hidden: false,
description: 'Select the tunnel provider',
env: 'SHOPIFY_FLAG_TUNNEL',
default: 'cloudflare',
options: ['cloudflare', 'ngrok'],
exclusive: ['tunnel-url', 'no-tunnel'],
}),
theme: Flags.string({
hidden: false,
char: 't',
Expand Down Expand Up @@ -128,7 +120,6 @@ export default class Dev extends Command {
subscriptionProductUrl: flags['subscription-product-url'],
checkoutCartUrl: flags['checkout-cart-url'],
tunnelUrl: flags['tunnel-url'],
tunnelProvider: flags.tunnel,
noTunnel: flags['no-tunnel'],
theme: flags.theme,
themeExtensionPort: flags['theme-app-extension-port'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Please check the configuration in ${tomlPath}`),
})

// When
const host = 'http://1234.ngrok.io'
const host = 'http://1234.cloudflare.io'
const previewMessage = await uiExtension.previewMessage(host, 'not_used')

// Then
Expand Down
3 changes: 0 additions & 3 deletions packages/app/src/cli/models/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ export interface Organization {
id: string
businessName: string
website?: string
betas?: {
cliTunnelAlternative?: boolean
}
}

export interface MinimalOrganizationApp {
Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/cli/prompts/dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ vi.mock('@shopify/cli-kit/node/ui')
const ORG1: Organization = {
id: '1',
businessName: 'org1',
betas: {},
}
const ORG2: Organization = {
id: '2',
businessName: 'org2',
betas: {},
}
const APP1 = testOrganizationApp({apiKey: 'key1'})
const APP2 = testOrganizationApp({
Expand Down
28 changes: 0 additions & 28 deletions packages/app/src/cli/services/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,11 @@ const APP_WITH_UNIFIED_APP_DEPLOYMENTS_BETA: OrganizationApp = {
const ORG1: Organization = {
id: '1',
businessName: 'org1',
betas: {cliTunnelAlternative: false},
website: '',
}
const ORG2: Organization = {
id: '2',
businessName: 'org2',
betas: {cliTunnelAlternative: true},
website: '',
}

Expand Down Expand Up @@ -307,7 +305,6 @@ describe('ensureDevContext', async () => {
remoteApp: {...APP2, apiSecret: 'secret2'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: true,
useCloudflareTunnels: true,
updateURLs: true,
config: CACHED1_WITH_CONFIG.configFile,
deploymentMode: 'legacy',
Expand Down Expand Up @@ -485,7 +482,6 @@ dev_store_url = "domain1"
remoteApp: {...APP1, apiSecret: 'secret1'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: true,
useCloudflareTunnels: true,
updateURLs: undefined,
deploymentMode: 'legacy',
})
Expand Down Expand Up @@ -518,32 +514,12 @@ dev_store_url = "domain1"
remoteApp: {...APP1, apiSecret: 'secret1'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: true,
useCloudflareTunnels: true,
updateURLs: undefined,
deploymentMode: 'legacy',
config: CACHED1_WITH_CONFIG.configFile,
})
})

test('returns useCloudflareTunnels false if the beta is enabled in partners', async () => {
// Given
vi.mocked(getAppInfo).mockReturnValue(undefined)
vi.mocked(fetchOrgFromId).mockResolvedValueOnce(ORG2)

// When
const got = await ensureDevContext(INPUT, 'token')

// Then
expect(got).toEqual({
remoteApp: {...APP1, apiSecret: 'secret1'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: true,
useCloudflareTunnels: false,
updateURLs: undefined,
deploymentMode: 'legacy',
})
})

test('returns selected data and updates internal state, with cached state', async () => {
// Given
vi.mocked(getAppInfo).mockReturnValue({...CACHED1, previousAppId: APP1.apiKey})
Expand All @@ -558,7 +534,6 @@ dev_store_url = "domain1"
remoteApp: {...APP1, apiSecret: 'secret1'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: false,
useCloudflareTunnels: true,
updateURLs: undefined,
deploymentMode: 'legacy',
})
Expand Down Expand Up @@ -608,7 +583,6 @@ dev_store_url = "domain1"
remoteApp: {...APP2, apiSecret: 'secret2'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: true,
useCloudflareTunnels: true,
updateURLs: undefined,
deploymentMode: 'legacy',
})
Expand Down Expand Up @@ -666,7 +640,6 @@ dev_store_url = "domain1"
remoteApp: {...APP_WITH_UNIFIED_APP_DEPLOYMENTS_BETA, apiSecret: 'secret2'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: true,
useCloudflareTunnels: false,
updateURLs: undefined,
deploymentMode: 'unified',
})
Expand All @@ -692,7 +665,6 @@ dev_store_url = "domain1"
remoteApp: {...APP_WITH_UNIFIED_APP_DEPLOYMENTS_BETA, apiSecret: 'secret2'},
storeFqdn: STORE1.shopDomain,
remoteAppUpdated: true,
useCloudflareTunnels: false,
updateURLs: undefined,
deploymentMode: 'unified',
})
Expand Down
6 changes: 1 addition & 5 deletions packages/app/src/cli/services/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ interface DevContextOutput {
remoteAppUpdated: boolean
storeFqdn: string
updateURLs: boolean | undefined
useCloudflareTunnels: boolean
config?: string
deploymentMode: DeploymentMode
}
Expand Down Expand Up @@ -160,7 +159,6 @@ export async function ensureDevContext(options: DevContextOptions, token: string

let {app: selectedApp, store: selectedStore} = await fetchDevDataFromOptions(options, orgId, token)
const organization = await fetchOrgFromId(orgId, token)
const useCloudflareTunnels = organization.betas?.cliTunnelAlternative !== true

if (!selectedApp || !selectedStore) {
// if we have selected an app or a dev store from a command flag, we keep them
Expand Down Expand Up @@ -217,7 +215,7 @@ export async function ensureDevContext(options: DevContextOptions, token: string

await enableDeveloperPreview(selectedApp, token)
const deploymentMode = selectedApp.betas?.unifiedAppDeployment ? 'unified' : 'legacy'
const result = buildOutput(selectedApp, selectedStore, useCloudflareTunnels, deploymentMode, cachedInfo)
const result = buildOutput(selectedApp, selectedStore, deploymentMode, cachedInfo)
await logMetadataForLoadedDevContext(result)
return result
}
Expand All @@ -243,7 +241,6 @@ const storeFromFqdn = async (storeFqdn: string, orgId: string, token: string): P
function buildOutput(
app: OrganizationApp,
store: OrganizationStore,
useCloudflareTunnels: boolean,
deploymentMode: DeploymentMode,
cachedInfo?: CachedAppInfo,
): DevContextOutput {
Expand All @@ -255,7 +252,6 @@ function buildOutput(
remoteAppUpdated: app.apiKey !== cachedInfo?.previousAppId,
storeFqdn: store.shopDomain,
updateURLs: cachedInfo?.updateURLs,
useCloudflareTunnels,
config: cachedInfo?.configFile,
deploymentMode,
}
Expand Down
10 changes: 1 addition & 9 deletions packages/app/src/cli/services/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export interface DevOptions {
subscriptionProductUrl?: string
checkoutCartUrl?: string
tunnelUrl?: string
tunnelProvider: string
noTunnel: boolean
theme?: string
themeExtensionPort?: number
Expand All @@ -81,7 +80,7 @@ async function dev(options: DevOptions) {

let tunnelClient: TunnelClient | undefined
if (!options.tunnelUrl && !options.noTunnel) {
tunnelClient = await startTunnelPlugin(options.commandConfig, tunnelPort, options.tunnelProvider)
tunnelClient = await startTunnelPlugin(options.commandConfig, tunnelPort, 'cloudflare')
}

const token = await ensureAuthenticatedPartners()
Expand All @@ -90,17 +89,10 @@ async function dev(options: DevOptions) {
remoteApp,
remoteAppUpdated,
updateURLs: cachedUpdateURLs,
useCloudflareTunnels,
config,
deploymentMode,
} = await ensureDevContext(options, token)

if (!options.tunnelUrl && !options.noTunnel && !useCloudflareTunnels && options.tunnelProvider === 'cloudflare') {
// If we can't use cloudflare, stop the previous optimistic tunnel and start a new one
tunnelClient?.stopTunnel()
tunnelClient = await startTunnelPlugin(options.commandConfig, tunnelPort, 'ngrok')
}

const apiKey = remoteApp.apiKey
const specifications = await fetchSpecifications({token, apiKey, config: options.commandConfig})

Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/cli/services/dev/fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const FETCH_ORG_RESPONSE_VALUE = {
{
id: ORG1.id,
businessName: ORG1.businessName,
betas: ORG1.betas,
apps: {nodes: [APP1, APP2], pageInfo: {hasNextPage: false}},
stores: {nodes: [STORE1]},
},
Expand All @@ -60,7 +59,6 @@ const FETCH_STORE_RESPONSE_VALUE = {
{
id: ORG1.id,
businessName: ORG1.businessName,
betas: ORG1.betas,
website: ORG1.website,
stores: {nodes: [STORE1]},
},
Expand Down
Loading

0 comments on commit 6e0d872

Please sign in to comment.