-
Notifications
You must be signed in to change notification settings - Fork 126
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
Fix --nodelete behaviour on dev command #4662
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/cli': patch | ||
--- | ||
|
||
Fix theme dev command deleting remote files even if using --nodelete flag |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,12 +100,12 @@ | |
switch (eventName) { | ||
case 'add': | ||
case 'change': | ||
return handleFileUpdate(eventName, themeId, adminSession, fileKey) | ||
Check warning on line 103 in packages/theme/src/cli/utilities/theme-fs.ts GitHub Actions / ESLint Report Analysispackages/theme/src/cli/utilities/theme-fs.ts#L103
|
||
case 'unlink': | ||
return handleFileDelete(themeId, adminSession, fileKey) | ||
Check warning on line 105 in packages/theme/src/cli/utilities/theme-fs.ts GitHub Actions / ESLint Report Analysispackages/theme/src/cli/utilities/theme-fs.ts#L105
|
||
} | ||
}) | ||
.catch((error) => { | ||
Check warning on line 108 in packages/theme/src/cli/utilities/theme-fs.ts GitHub Actions / ESLint Report Analysispackages/theme/src/cli/utilities/theme-fs.ts#L108
|
||
outputWarn(`Error handling file event for ${fileKey}: ${error}`) | ||
}) | ||
} | ||
|
@@ -133,7 +133,7 @@ | |
unsyncedFileKeys.add(fileKey) | ||
} | ||
|
||
return file.value || file.attachment || '' | ||
Check warning on line 136 in packages/theme/src/cli/utilities/theme-fs.ts GitHub Actions / ESLint Report Analysispackages/theme/src/cli/utilities/theme-fs.ts#L136
Check warning on line 136 in packages/theme/src/cli/utilities/theme-fs.ts GitHub Actions / ESLint Report Analysispackages/theme/src/cli/utilities/theme-fs.ts#L136
|
||
}) | ||
|
||
const syncPromise = contentPromise | ||
|
@@ -155,7 +155,7 @@ | |
|
||
return true | ||
}) | ||
.catch(createSyncingCatchError(fileKey, 'upload')) | ||
Check warning on line 158 in packages/theme/src/cli/utilities/theme-fs.ts GitHub Actions / ESLint Report Analysispackages/theme/src/cli/utilities/theme-fs.ts#L158
|
||
|
||
emitEvent(eventName, { | ||
fileKey, | ||
|
@@ -178,7 +178,7 @@ | |
} | ||
|
||
const handleFileDelete = (themeId: string, adminSession: AdminSession, fileKey: string) => { | ||
if (isFileIgnored(fileKey)) return | ||
if (isFileIgnored(fileKey) || options?.noDelete) return | ||
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. Can we add a test for this? Maybe for the |
||
|
||
// Optimistically delete the file from the local file system. | ||
files.delete(fileKey) | ||
|
@@ -197,7 +197,7 @@ | |
outputSyncResult('delete', fileKey) | ||
return true | ||
}) | ||
.catch((error) => { | ||
Check warning on line 200 in packages/theme/src/cli/utilities/theme-fs.ts GitHub Actions / ESLint Report Analysispackages/theme/src/cli/utilities/theme-fs.ts#L200
|
||
createSyncingCatchError(fileKey, 'delete')(error) | ||
return false | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add a test case for this?