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

Commit

Permalink
fix(patch): add support for diff packages
Browse files Browse the repository at this point in the history
Diff packages have to reset the entire folder with whats in version control, not just whats in artifactory
  • Loading branch information
azlam-abdulsalam committed Jun 18, 2023
1 parent 934bd16 commit bcb0da2
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions packages/sfpowerscripts-cli/src/commands/repo/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import FetchImpl from '../../impl/artifacts/FetchImpl';
import ReleaseDefinitionSchema from '../../impl/release/ReleaseDefinitionSchema';
import path = require('path');
import ArtifactFetcher, { Artifact } from '@dxatscale/sfpowerscripts.core/lib/artifacts/ArtifactFetcher';
import SfpPackage from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackage';
import SfpPackage, { PackageType } from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackage';
import SfpPackageBuilder from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackageBuilder';
import SFPLogger, { ConsoleLogger, Logger, LoggerLevel } from '@dxatscale/sfp-logger';
import SfpPackageInquirer from '@dxatscale/sfpowerscripts.core/lib/package/SfpPackageInquirer';
Expand Down Expand Up @@ -219,11 +219,22 @@ export default class Patch extends SfpowerscriptsCommand {
//Create new path as mentioned in artifact
fs.mkdirpSync(path.join(temporaryWorkingDirectory, sfpPackage.packageDirectory));

//Copy from artifacts to each package directory
fs.copySync(
path.join(sfpPackage.sourceDir, sfpPackage.packageDirectory),
path.join(temporaryWorkingDirectory, sfpPackage.packageDirectory)
);

//Copy from artifacts to each package directory
//If diff, artifact will only contain delta, so use the version control to checkout the entire reference
if(sfpPackage.packageType==PackageType.Diff)
{

await git.checkoutPath(sfpPackage.commitSHATo, sfpPackage.packageDirectory);
}
else
{
fs.copySync(
path.join(sfpPackage.sourceDir, sfpPackage.packageDirectory),
path.join(temporaryWorkingDirectory, sfpPackage.packageDirectory)
);
}

SFPLogger.log(
COLOR_KEY_MESSAGE(
`Succesfully copied from artifact ${sfpPackage.packageName} ${sfpPackage.package_version_number} to target directory`
Expand Down

0 comments on commit bcb0da2

Please sign in to comment.