Skip to content

Commit 9f56c4d

Browse files
chore: move logic to stl usage
1 parent 8fe26e4 commit 9f56c4d

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

src/utils/deploy.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export async function resolveApi(existingConfigAggregator?: ConfigAggregator): P
7474

7575
export async function buildComponentSet(opts: Partial<DeployOptions>, stl?: SourceTracking): Promise<ComponentSet> {
7676
// if you specify nothing, you'll get the changes, like sfdx push, as long as there's an stl
77-
if (!opts['source-dir'] && !opts.manifest && !opts.metadata && stl) {
77+
if (!opts['source-dir'] && !opts.manifest && !opts.metadata && !opts['dry-run'] && stl) {
7878
/** localChangesAsComponentSet returned an array to support multiple sequential deploys.
7979
* `sf` chooses not to support this so we force one ComponentSet
8080
*/
@@ -141,21 +141,16 @@ export async function executeDeploy(
141141
await deploy.start();
142142
}
143143
} else {
144-
let stl: SourceTracking | undefined;
145-
if (!opts['dry-run']) {
146-
// if not dry-run, or with source-tracking enabling flags
147-
// instantiate source tracking
148-
// stl will decide, based on the org's properties, what needs to be done
149-
stl = await SourceTracking.create({
150-
org,
151-
// mdapi format deploys don't require a project, but at this point we need one
152-
project: project ?? (await SfProject.resolve()),
153-
subscribeSDREvents: true,
154-
ignoreConflicts: opts['ignore-conflicts'],
155-
});
156-
registry = stl.registry;
157-
}
158-
144+
// instantiate source tracking
145+
// stl will decide, based on the org's properties, what needs to be done
146+
const stl = await SourceTracking.create({
147+
org,
148+
// mdapi format deploys don't require a project, but at this point we need one
149+
project: project ?? (await SfProject.resolve()),
150+
subscribeSDREvents: true,
151+
ignoreConflicts: opts['ignore-conflicts'],
152+
});
153+
registry = stl.registry;
159154
componentSet = await buildComponentSet(opts, stl);
160155
if (componentSet.size === 0) {
161156
if (opts['source-dir'] ?? opts.manifest ?? opts.metadata ?? throwOnEmpty) {

test/commands/deploy/metadata/quick.nut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe('deploy metadata quick NUTs', () => {
125125
});
126126

127127
it('should fail to deploy previously deployed deployment', async () => {
128-
const first = await testkit.execute<DeployResultJson>('deploy:metadata', {
128+
const first = await testkit.execute<DeployResultJson>('project:deploy:start', {
129129
args: '--source-dir force-app',
130130
json: true,
131131
exitCode: 0,

0 commit comments

Comments
 (0)