-
Notifications
You must be signed in to change notification settings - Fork 231
Add client steps implementation to support existing functionalities #6966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alfonso-noriega
wants to merge
3
commits into
03-10-create_abstract_client_steps_infrastracture_to_externalize_the_ap_modules_client_configurations
Choose a base branch
from
03-10-add_client_steps_implementation_to_support_existing_functionalities
base: 03-10-create_abstract_client_steps_infrastracture_to_externalize_the_ap_modules_client_configurations
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,070
−5
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
98eb79b
Add client steps implementation to support existing functionalities
alfonso-noriega be957c2
Guard include_assets step against path traversal in destinations and …
alfonso-noriega 0874d8c
Fix prettier lint errors in include_assets_step.ts
alfonso-noriega File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/app/src/cli/services/build/steps/build-function-step.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import {buildFunctionExtension} from '../extension.js' | ||
| import type {LifecycleStep, BuildContext} from '../client-steps.js' | ||
|
|
||
| /** | ||
| * Executes a build_function build step. | ||
| * | ||
| * Compiles the function extension (JavaScript or other language) to WASM, | ||
| * applying wasm-opt and trampoline as configured. | ||
| */ | ||
| export async function executeBuildFunctionStep(_step: LifecycleStep, context: BuildContext): Promise<void> { | ||
| return buildFunctionExtension(context.extension, context.options) | ||
| } |
14 changes: 14 additions & 0 deletions
14
packages/app/src/cli/services/build/steps/build-theme-step.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import {runThemeCheck} from '../theme-check.js' | ||
| import type {LifecycleStep, BuildContext} from '../client-steps.js' | ||
|
|
||
| /** | ||
| * Executes a build_theme build step. | ||
| * | ||
| * Runs theme check on the extension directory and writes any offenses to stdout. | ||
| */ | ||
| export async function executeBuildThemeStep(_step: LifecycleStep, context: BuildContext): Promise<void> { | ||
| const {extension, options} = context | ||
| options.stdout.write(`Running theme check on your Theme app extension...`) | ||
| const offenses = await runThemeCheck(extension.directory) | ||
| if (offenses) options.stdout.write(offenses) | ||
| } |
30 changes: 30 additions & 0 deletions
30
packages/app/src/cli/services/build/steps/bundle-theme-step.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import {themeExtensionFiles} from '../../../utilities/extensions/theme.js' | ||
| import {copyFile} from '@shopify/cli-kit/node/fs' | ||
| import {relativePath, joinPath} from '@shopify/cli-kit/node/path' | ||
| import type {LifecycleStep, BuildContext} from '../client-steps.js' | ||
|
|
||
| /** | ||
| * Executes a bundle_theme build step. | ||
| * | ||
| * Copies theme extension files to the output directory, preserving relative paths. | ||
| * Respects the extension's .shopifyignore file and the standard ignore patterns. | ||
| */ | ||
| export async function executeBundleThemeStep( | ||
| _step: LifecycleStep, | ||
| context: BuildContext, | ||
| ): Promise<{filesCopied: number}> { | ||
| const {extension, options} = context | ||
| options.stdout.write(`Bundling theme extension ${extension.localIdentifier}...`) | ||
| const files = await themeExtensionFiles(extension) | ||
|
|
||
| await Promise.all( | ||
| files.map(async (filepath) => { | ||
| const relativePathName = relativePath(extension.directory, filepath) | ||
| const outputFile = joinPath(extension.outputPath, relativePathName) | ||
| if (filepath === outputFile) return | ||
| await copyFile(filepath, outputFile) | ||
| }), | ||
| ) | ||
|
|
||
| return {filesCopied: files.length} | ||
| } |
11 changes: 11 additions & 0 deletions
11
packages/app/src/cli/services/build/steps/bundle-ui-step.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import {buildUIExtension} from '../extension.js' | ||
| import type {LifecycleStep, BuildContext} from '../client-steps.js' | ||
|
|
||
| /** | ||
| * Executes a bundle_ui build step. | ||
| * | ||
| * Bundles the UI extension using esbuild, writing output to extension.outputPath. | ||
| */ | ||
| export async function executeBundleUIStep(_step: LifecycleStep, context: BuildContext): Promise<void> { | ||
| return buildUIExtension(context.extension, context.options) | ||
| } |
11 changes: 11 additions & 0 deletions
11
packages/app/src/cli/services/build/steps/copy-static-assets-step.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import type {LifecycleStep, BuildContext} from '../client-steps.js' | ||
|
|
||
| /** | ||
| * Executes a copy_static_assets build step. | ||
| * | ||
| * Copies static assets defined in the extension's build_manifest to the output directory. | ||
| * This is a no-op for extensions that do not define static assets. | ||
| */ | ||
| export async function executeCopyStaticAssetsStep(_step: LifecycleStep, context: BuildContext): Promise<void> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we ever using |
||
| return context.extension.copyStaticAssets() | ||
| } | ||
14 changes: 14 additions & 0 deletions
14
packages/app/src/cli/services/build/steps/create-tax-stub-step.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import {touchFile, writeFile} from '@shopify/cli-kit/node/fs' | ||
| import type {LifecycleStep, BuildContext} from '../client-steps.js' | ||
|
|
||
| /** | ||
| * Executes a create_tax_stub build step. | ||
| * | ||
| * Creates a minimal JavaScript stub file at the extension's output path, | ||
| * satisfying the tax calculation extension bundle format. | ||
| */ | ||
| export async function executeCreateTaxStubStep(_step: LifecycleStep, context: BuildContext): Promise<void> { | ||
| const {extension} = context | ||
| await touchFile(extension.outputPath) | ||
| await writeFile(extension.outputPath, '(()=>{})();') | ||
alfonso-noriega marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.