Skip to content

Commit 707e8c2

Browse files
committed
Merge branch 'main' into 03-26-refactor_remotespecification
2 parents 1039df1 + e8bdb75 commit 707e8c2

49 files changed

Lines changed: 1298 additions & 409 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/download-and-publish-test-coverage/action.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/actions/run-and-save-test-coverage/action.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/tests-main.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,3 @@ jobs:
7070
}
7171
env:
7272
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
73-
- name: Run and save test coverage
74-
uses: ./.github/actions/run-and-save-test-coverage
75-
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '24.1.0' }}
76-
with:
77-
branch-name: ${{ github.ref_name }}

.github/workflows/tests-pr.yml

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -215,77 +215,6 @@ jobs:
215215
if: needs.unit-tests.result != 'success'
216216
run: exit 1
217217

218-
test-coverage-shard:
219-
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
220-
name: "Test Coverage (shard ${{ matrix.shard }})"
221-
runs-on: ubuntu-latest
222-
timeout-minutes: 30
223-
strategy:
224-
matrix:
225-
shard: ['1/2', '2/2']
226-
steps:
227-
- uses: actions/checkout@v3
228-
with:
229-
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
230-
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
231-
fetch-depth: 1
232-
- name: Setup deps
233-
uses: ./.github/actions/setup-cli-deps
234-
with:
235-
node-version: ${{ env.DEFAULT_NODE_VERSION }}
236-
- name: Unit tests with coverage (shard)
237-
run: pnpm vitest run --coverage --coverage.all=false --reporter=blob --outputFile=vitest-blob-reports/blob-${{ matrix.shard == '1/2' && '1' || '2' }}.json --shard ${{ matrix.shard }}
238-
env:
239-
VITEST_MIN_THREADS: "1"
240-
VITEST_MAX_THREADS: "4"
241-
- uses: actions/upload-artifact@v4
242-
with:
243-
name: coverage-blob-${{ matrix.shard == '1/2' && '1' || '2' }}
244-
path: vitest-blob-reports/
245-
retention-days: 1
246-
247-
test-coverage-merge:
248-
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
249-
needs: test-coverage-shard
250-
name: 'Test Coverage'
251-
runs-on: ubuntu-latest
252-
timeout-minutes: 15
253-
steps:
254-
- uses: actions/checkout@v3
255-
with:
256-
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
257-
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
258-
fetch-depth: 1
259-
- name: Setup deps
260-
uses: ./.github/actions/setup-cli-deps
261-
with:
262-
node-version: ${{ env.DEFAULT_NODE_VERSION }}
263-
- uses: actions/download-artifact@v4
264-
with:
265-
pattern: coverage-blob-*
266-
path: vitest-blob-reports
267-
merge-multiple: true
268-
- name: Merge coverage reports
269-
run: pnpm vitest --mergeReports vitest-blob-reports --reporter=json --outputFile=./coverage/report.json --coverage --coverage.all=false
270-
- name: Convert coverage to Jest
271-
run: ./bin/save-coverage-file.js
272-
- name: Take copy of report as new baseline for branch
273-
run: cp ./report.json ./baseline-report.json
274-
- name: Clean ref name
275-
env:
276-
SAFE_REF_NAME: "${{ github.head_ref }}"
277-
run: |
278-
SAFE_REF_NAME="${SAFE_REF_NAME//[\/.]/}"
279-
echo "SAFE_REF_NAME=${SAFE_REF_NAME}" >> $GITHUB_ENV
280-
- uses: actions/upload-artifact@v4
281-
with:
282-
name: ${{ env.SAFE_REF_NAME }}--coverage-report
283-
path: ./baseline-report.json
284-
- name: Download and publish test coverage
285-
uses: ./.github/actions/download-and-publish-test-coverage
286-
with:
287-
base-branch-name: '${{ github.base_ref }}'
288-
289218
e2e-tests:
290219
name: 'E2E tests'
291220
if: github.event.pull_request.head.repo.full_name == github.repository

bin/save-coverage-file.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs-shopify.dev/commands/upgrade.doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
33

44
const data: ReferenceEntityTemplateSchema = {
55
name: 'upgrade',
6-
description: `Shows details on how to upgrade Shopify CLI.`,
7-
overviewPreviewDescription: `Shows details on how to upgrade Shopify CLI.`,
6+
description: `Upgrades Shopify CLI using your package manager.`,
7+
overviewPreviewDescription: `Upgrades Shopify CLI.`,
88
type: 'command',
99
isVisualComponent: false,
1010
defaultExample: {

docs-shopify.dev/generated/generated_docs_data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8125,8 +8125,8 @@
81258125
},
81268126
{
81278127
"name": "upgrade",
8128-
"description": "Shows details on how to upgrade Shopify CLI.",
8129-
"overviewPreviewDescription": "Shows details on how to upgrade Shopify CLI.",
8128+
"description": "Upgrades Shopify CLI using your package manager.",
8129+
"overviewPreviewDescription": "Upgrades Shopify CLI.",
81308130
"type": "command",
81318131
"isVisualComponent": false,
81328132
"defaultExample": {

packages/app/src/cli/api/graphql/business-platform-organizations/generated/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export type Scalars = {
2626
BulkDataOperationID: { input: any; output: any; }
2727
/** The ID for a BusinessUser. */
2828
BusinessUserID: { input: any; output: any; }
29+
/** The ID for a BusinessUsersImport. */
30+
BusinessUsersImportID: { input: any; output: any; }
2931
/** A signed decimal number, which supports arbitrary precision and is serialized as a string. */
3032
Decimal: { input: any; output: any; }
3133
/** The ID for a DocumentAttachment. */

packages/app/src/cli/models/extensions/extension-instance.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ vi.mock('../../services/build/extension.js', async () => {
3232
return {
3333
...actual,
3434
buildUIExtension: vi.fn(),
35-
buildThemeExtension: vi.fn(),
3635
buildFunctionExtension: vi.fn(),
3736
}
3837
})
@@ -148,8 +147,16 @@ describe('build', async () => {
148147
// Given
149148
const extensionInstance = await testTaxCalculationExtension(tmpDir)
150149
const options: ExtensionBuildOptions = {
151-
stdout: new Writable(),
152-
stderr: new Writable(),
150+
stdout: new Writable({
151+
write(chunk, enc, cb) {
152+
cb()
153+
},
154+
}),
155+
stderr: new Writable({
156+
write(chunk, enc, cb) {
157+
cb()
158+
},
159+
}),
153160
app: testApp(),
154161
environment: 'production',
155162
}

packages/app/src/cli/models/extensions/extension-instance.ts

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,19 @@ import {BaseConfigType, MAX_EXTENSION_HANDLE_LENGTH, MAX_UID_LENGTH} from './sch
22
import {FunctionConfigType} from './specifications/function.js'
33
import {ExtensionFeature, ExtensionSpecification} from './specification.js'
44
import {SingleWebhookSubscriptionType} from './specifications/app_config_webhook_schemas/webhooks_schema.js'
5-
import {
6-
ExtensionBuildOptions,
7-
buildFunctionExtension,
8-
buildThemeExtension,
9-
buildUIExtension,
10-
bundleFunctionExtension,
11-
} from '../../services/build/extension.js'
12-
import {bundleThemeExtension, copyFilesForExtension} from '../../services/extensions/bundle.js'
5+
import {ExtensionBuildOptions, bundleFunctionExtension} from '../../services/build/extension.js'
6+
import {bundleThemeExtension} from '../../services/extensions/bundle.js'
137
import {Identifiers} from '../app/identifiers.js'
148
import {DeveloperPlatformClient} from '../../utilities/developer-platform-client.js'
159
import {AppConfiguration} from '../app/app.js'
1610
import {ApplicationURLs} from '../../services/dev/urls.js'
11+
import {executeStep, BuildContext} from '../../services/build/client-steps.js'
1712
import {ok} from '@shopify/cli-kit/node/result'
1813
import {constantize, slugify} from '@shopify/cli-kit/common/string'
1914
import {hashString, nonRandomUUID} from '@shopify/cli-kit/node/crypto'
2015
import {partnersFqdn} from '@shopify/cli-kit/node/context/fqdn'
2116
import {joinPath, normalizePath, resolvePath, relativePath, basename} from '@shopify/cli-kit/node/path'
22-
import {fileExists, touchFile, moveFile, writeFile, glob, copyFile, globSync} from '@shopify/cli-kit/node/fs'
17+
import {fileExists, moveFile, glob, copyFile, globSync} from '@shopify/cli-kit/node/fs'
2318
import {getPathValue} from '@shopify/cli-kit/common/object'
2419
import {outputDebug} from '@shopify/cli-kit/node/output'
2520
import {
@@ -320,32 +315,24 @@ export class ExtensionInstance<TConfiguration extends BaseConfigType = BaseConfi
320315
}
321316

322317
async build(options: ExtensionBuildOptions): Promise<void> {
323-
const mode = this.specification.buildConfig.mode
324-
325-
switch (mode) {
326-
case 'theme':
327-
await buildThemeExtension(this, options)
328-
return bundleThemeExtension(this, options)
329-
case 'function':
330-
return buildFunctionExtension(this, options)
331-
case 'ui':
332-
await buildUIExtension(this, options)
333-
// Copy static assets after build completes
334-
return this.copyStaticAssets()
335-
case 'tax_calculation':
336-
await touchFile(this.outputPath)
337-
await writeFile(this.outputPath, '(()=>{})();')
338-
break
339-
case 'copy_files':
340-
return copyFilesForExtension(
341-
this,
342-
options,
343-
this.specification.buildConfig.filePatterns,
344-
this.specification.buildConfig.ignoredFilePatterns,
345-
)
346-
case 'hosted_app_home':
347-
case 'none':
348-
break
318+
const {clientSteps = []} = this.specification
319+
320+
const context: BuildContext = {
321+
extension: this,
322+
options,
323+
stepResults: new Map(),
324+
}
325+
326+
const steps = clientSteps.find((lifecycle) => lifecycle.lifecycle === 'deploy')?.steps ?? []
327+
328+
for (const step of steps) {
329+
// eslint-disable-next-line no-await-in-loop
330+
const result = await executeStep(step, context)
331+
context.stepResults.set(step.id, result)
332+
333+
if (!result.success && !step.continueOnError) {
334+
throw new Error(`Build step "${step.name}" failed: ${result.error?.message}`)
335+
}
349336
}
350337
}
351338

@@ -546,6 +533,8 @@ export class ExtensionInstance<TConfiguration extends BaseConfigType = BaseConfi
546533
} else {
547534
return nonRandomUUID(JSON.stringify(this.configuration))
548535
}
536+
default:
537+
return this.specification.identifier
549538
}
550539
}
551540

0 commit comments

Comments
 (0)