Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Commit bcb0da2

Browse files
author
azlam-abdulsalam
committed
fix(patch): add support for diff packages
Diff packages have to reset the entire folder with whats in version control, not just whats in artifactory
1 parent 934bd16 commit bcb0da2

File tree

1 file changed

+17
-6
lines changed
  • packages/sfpowerscripts-cli/src/commands/repo

1 file changed

+17
-6
lines changed

packages/sfpowerscripts-cli/src/commands/repo/patch.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import FetchImpl from '../../impl/artifacts/FetchImpl';
88
import ReleaseDefinitionSchema from '../../impl/release/ReleaseDefinitionSchema';
99
import path = require('path');
1010
import ArtifactFetcher, { Artifact } from '@dxatscale/sfpowerscripts.core/lib/artifacts/ArtifactFetcher';
11-
import SfpPackage from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackage';
11+
import SfpPackage, { PackageType } from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackage';
1212
import SfpPackageBuilder from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackageBuilder';
1313
import SFPLogger, { ConsoleLogger, Logger, LoggerLevel } from '@dxatscale/sfp-logger';
1414
import SfpPackageInquirer from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackageInquirer';
@@ -219,11 +219,22 @@ export default class Patch extends SfpowerscriptsCommand {
219219
//Create new path as mentioned in artifact
220220
fs.mkdirpSync(path.join(temporaryWorkingDirectory, sfpPackage.packageDirectory));
221221

222-
//Copy from artifacts to each package directory
223-
fs.copySync(
224-
path.join(sfpPackage.sourceDir, sfpPackage.packageDirectory),
225-
path.join(temporaryWorkingDirectory, sfpPackage.packageDirectory)
226-
);
222+
223+
//Copy from artifacts to each package directory
224+
//If diff, artifact will only contain delta, so use the version control to checkout the entire reference
225+
if(sfpPackage.packageType==PackageType.Diff)
226+
{
227+
228+
await git.checkoutPath(sfpPackage.commitSHATo, sfpPackage.packageDirectory);
229+
}
230+
else
231+
{
232+
fs.copySync(
233+
path.join(sfpPackage.sourceDir, sfpPackage.packageDirectory),
234+
path.join(temporaryWorkingDirectory, sfpPackage.packageDirectory)
235+
);
236+
}
237+
227238
SFPLogger.log(
228239
COLOR_KEY_MESSAGE(
229240
`Succesfully copied from artifact ${sfpPackage.packageName} ${sfpPackage.package_version_number} to target directory`

0 commit comments

Comments
 (0)