Skip to content
Closed
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
5 changes: 0 additions & 5 deletions .changeset/autocomplete-instant-local-search.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/guard-bundle-upload-size-and-paths.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export type Scalars = {
ActionAuditID: { input: any; output: any; }
/** The ID for a Address. */
AddressID: { input: any; output: any; }
/** The ID for a Attestation. */
AttestationID: { input: any; output: any; }
/** The ID for a BulkDataOperation. */
BulkDataOperationID: { input: any; output: any; }
/** The ID for a BusinessUser. */
Expand Down
4 changes: 4 additions & 0 deletions packages/app/src/cli/commands/app/generate/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export default class AppGenerateExtension extends AppLinkedCommand {
}),
}

public static analyticsNameOverride(): string | undefined {
return 'app scaffold extension'
}

public async run(): Promise<AppLinkedCommandOutput> {
const {flags} = await this.parse(AppGenerateExtension)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('executeIncludeAssetsStep', () => {
options: {
stdout: mockStdout,
stderr: mockStderr,
app: {directory: '/test'} as any,
app: {} as any,
environment: 'production',
},
stepResults: new Map(),
Expand Down Expand Up @@ -552,11 +552,6 @@ describe('executeIncludeAssetsStep', () => {
})

describe('pattern entries', () => {
beforeEach(() => {
// copyByPattern now short-circuits if sourceDir doesn't exist; default true here.
vi.mocked(fs.fileExists).mockResolvedValue(true)
})

test('copies files matching include patterns', async () => {
// Given
vi.mocked(fs.glob).mockResolvedValue(['/test/extension/public/logo.png', '/test/extension/public/style.css'])
Expand Down Expand Up @@ -948,13 +943,11 @@ describe('executeIncludeAssetsStep', () => {
})

test('writes manifest.json with files array when generatesAssetsManifest is true and only pattern inclusions exist', async () => {
// Given — pattern entries contribute output paths to the manifest "files" array.
// sourceDir must exist for copyByPattern's pre-glob fileExists check to pass;
// everything else can read false (the parent beforeEach default).
// Given — pattern entries contribute output paths to the manifest "files" array
vi.mocked(fs.glob).mockResolvedValue(['/test/extension/public/logo.png'])
vi.mocked(fs.copyFile).mockResolvedValue()
vi.mocked(fs.mkdir).mockResolvedValue()
vi.mocked(fs.fileExists).mockImplementation(async (path) => String(path) === '/test/extension/public')
vi.mocked(fs.fileExists).mockResolvedValue(false)
vi.mocked(fs.writeFile).mockResolvedValue()

const step: LifecycleStep = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export async function executeIncludeAssetsStep(
const config = IncludeAssetsConfigSchema.parse(step.config)
const {extension, options} = context
const outputDir = resolveOutputDir(extension.outputPath)
const appDirectory = options.app.directory

const aggregatedPathMap = new Map<string, string | string[]>()
// Track basenames written across all configKey entries in this build. In
Expand All @@ -148,7 +147,6 @@ export async function executeIncludeAssetsStep(
baseDir: extension.directory,
outputDir,
context,
appDirectory,
destination: sanitizedDest,
usedBasenames,
preserveFilePaths: entry.preserveFilePaths,
Expand All @@ -174,8 +172,6 @@ export async function executeIncludeAssetsStep(
outputDir: destinationDir,
patterns: entry.include,
ignore: entry.ignore ?? [],
appDirectory,
sourceDirConfigValue: entry.baseDir ?? '.',
},
options,
)
Expand All @@ -193,7 +189,6 @@ export async function executeIncludeAssetsStep(
destination: sanitizedDest,
baseDir: extension.directory,
outputDir,
appDirectory,
},
options,
)
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ describe('copyByPattern', () => {

beforeEach(() => {
mockStdout = {write: vi.fn()}
vi.mocked(fs.fileExists).mockResolvedValue(true)
})

test('copies matched files preserving relative paths', async () => {
Expand All @@ -25,8 +24,6 @@ describe('copyByPattern', () => {
outputDir: '/out',
patterns: ['**/*.ts', '**/*.tsx'],
ignore: [],
appDirectory: '/src',
sourceDirConfigValue: '.',
},
{stdout: mockStdout},
)
Expand All @@ -50,8 +47,6 @@ describe('copyByPattern', () => {
outputDir: '/out',
patterns: ['**/*.png'],
ignore: [],
appDirectory: '/src',
sourceDirConfigValue: '.',
},
{stdout: mockStdout},
)
Expand All @@ -77,8 +72,6 @@ describe('copyByPattern', () => {
outputDir: '/out/sub',
patterns: ['**/*'],
ignore: [],
appDirectory: '/out',
sourceDirConfigValue: 'sub',
},
{stdout: mockStdout},
)
Expand All @@ -103,8 +96,6 @@ describe('copyByPattern', () => {
outputDir: '/out',
patterns: ['*.png'],
ignore: [],
appDirectory: '/out',
sourceDirConfigValue: '.',
},
{stdout: mockStdout},
)
Expand All @@ -129,8 +120,6 @@ describe('copyByPattern', () => {
outputDir: '/out/dist',
patterns: ['*.js'],
ignore: [],
appDirectory: '/src',
sourceDirConfigValue: '.',
},
{stdout: mockStdout},
)
Expand All @@ -150,8 +139,6 @@ describe('copyByPattern', () => {
outputDir: '/out',
patterns: ['**/*'],
ignore: ['**/*.test.ts', 'node_modules/**'],
appDirectory: '/src',
sourceDirConfigValue: '.',
},
{stdout: mockStdout},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {assertPathWithinAppDir} from './assert-path-within-app.js'
import {joinPath, dirname, relativePath} from '@shopify/cli-kit/node/path'
import {glob, copyFile, mkdir, fileExists} from '@shopify/cli-kit/node/fs'
import {glob, copyFile, mkdir} from '@shopify/cli-kit/node/fs'

/**
* Pattern strategy: glob-based file selection.
Expand All @@ -11,21 +10,10 @@ export async function copyByPattern(
outputDir: string
patterns: string[]
ignore: string[]
appDirectory: string
sourceDirConfigValue: string
},
options: {stdout: NodeJS.WritableStream},
): Promise<{filesCopied: number; outputPaths: string[]}> {
const {sourceDir, outputDir, patterns, ignore, appDirectory, sourceDirConfigValue} = config

// Validate the boundary up front, before touching the filesystem. Realpath
// would throw on a missing sourceDir, so preserve the existing "missing dir
// = no files" behavior by short-circuiting first.
if (!(await fileExists(sourceDir))) {
return {filesCopied: 0, outputPaths: []}
}
await assertPathWithinAppDir(sourceDir, appDirectory, sourceDirConfigValue)

const {sourceDir, outputDir, patterns, ignore} = config
const files = await glob(patterns, {
absolute: true,
cwd: sourceDir,
Expand Down
Loading
Loading