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
10 changes: 5 additions & 5 deletions packages/cli/bin/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const hookEntryPoints = glob.sync('./src/hooks/*.ts', {
})

// Build esbuild entry points for app/theme commands so they get bundled into
// the CLI's own dist/ with all imports resolved. This is needed because
// @shopify/app and @shopify/theme are devDependencies (private packages) and
// won't exist as real node_modules in the published snapshot.
// the CLI's own dist/ with all imports resolved. These entrypoints use the
// app/theme dist outputs so package imports and per-command imports share the
// same module graph.
const manifest = JSON.parse(readFileSync(joinPath(process.cwd(), 'oclif.manifest.json'), 'utf8'))
const commandEntryPointOverrides = {
'app:logs:sources': 'cli/commands/app/app-logs/sources',
Expand All @@ -58,13 +58,13 @@ const commandEntryPointOverrides = {
'doctor-release': 'cli/commands/doctor-release/doctor-release',
'doctor-release:theme': 'cli/commands/doctor-release/theme/index',
}
const externalPackageDirs = {'@shopify/app': '../app/', '@shopify/theme': '../theme/'}
const externalPackageDirs = {'@shopify/app': '../app/dist/', '@shopify/theme': '../theme/dist/'}

const externalCommandEntryPoints = Object.entries(manifest.commands)
.filter(([, cmd]) => externalPackageDirs[cmd.customPluginName])
.map(([id, cmd]) => {
const out = commandEntryPointOverrides[id] ?? `cli/commands/${id.replace(/:/g, '/')}`
const inPath = externalPackageDirs[cmd.customPluginName] + `src/${out}.ts`
const inPath = externalPackageDirs[cmd.customPluginName] + `${out}.js`
return {in: inPath, out}
})

Expand Down
1 change: 1 addition & 0 deletions packages/e2e/setup/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const envFixture = base.extend<{testSection: void}, {env: E2EEnv}>({
...xdgEnv,
SHOPIFY_CLI_CLOUDFLARED_PATH: cloudflaredPath,
SHOPIFY_RUN_AS_USER: '0',
SHOPIFY_CLI_NO_ANALYTICS: '1',
NODE_OPTIONS: '',
CI: '1',
SHOPIFY_CLI_1P_DEV: undefined,
Expand Down
1 change: 1 addition & 0 deletions packages/e2e/setup/global-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default async function globalSetup() {
...process.env,
...xdgEnv,
SHOPIFY_RUN_AS_USER: '0',
SHOPIFY_CLI_NO_ANALYTICS: '1',
NODE_OPTIONS: '',
CI: '1',
SHOPIFY_CLI_1P_DEV: undefined,
Expand Down
27 changes: 26 additions & 1 deletion packages/e2e/tests/app-deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {appTestFixture as test, createApp, deployApp, versionsList, configLink}
import {teardownAll} from '../setup/teardown.js'
import {TEST_TIMEOUT} from '../setup/constants.js'
import {requireEnv} from '../setup/env.js'
import {stripAnsi} from '../helpers/strip-ansi.js'
import {expect} from '@playwright/test'
import * as fs from 'fs'
// eslint-disable-next-line no-restricted-imports
Expand Down Expand Up @@ -30,6 +31,13 @@ interface VersionLine {
status: string
}

function assertDeployAnalytics(opts: {output: string; appName: string; step: string}) {
const output = stripAnsi(opts.output)
expect(output, `${opts.step} - expected deploy analytics command`).toContain('"command": "app deploy"')
expect(output, `${opts.step} - expected deploy analytics success`).toContain('"success": true')
expect(output, `${opts.step} - expected deploy analytics app name`).toContain(`"app_name": "${opts.appName}"`)
}

/**
* Asserts a `versions list --json` result shows:
* - `expectedTag` is present and `active`
Expand Down Expand Up @@ -85,9 +93,26 @@ test.describe('App deploy', () => {

// Step 2: Deploy with a tagged version
const versionTag = `E2E-v1-${Date.now()}`
const deployResult = await deployApp({cli, appDir, version: versionTag, message: 'E2E A primary deployment'})
const deployResult = await cli.exec(
[
'app',
'deploy',
'--version',
versionTag,
'--message',
'E2E A primary deployment',
'--allow-updates',
'--path',
appDir,
],
{
env: {SHOPIFY_FLAG_VERBOSE: '1'},
timeout: TEST_TIMEOUT.long,
},
)
const deployOutput = deployResult.stdout + deployResult.stderr
expect(deployResult.exitCode, `Step 2 - deploy failed:\n${deployOutput}`).toBe(0)
assertDeployAnalytics({output: deployOutput, appName, step: 'Step 2'})

// Step 3: Verify the primary tag is active and no other version is stuck active.
const listResult = await versionsList({cli, appDir})
Expand Down
Loading