Skip to content

Commit

Permalink
fixup! Merge pull request #21 from amtrack/feat/read-new-cmps
Browse files Browse the repository at this point in the history
  • Loading branch information
amtrack committed Jun 16, 2022
1 parent 43dbcce commit daa30a4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/commands/force/source/read.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { flags, SfdxCommand } from "@salesforce/command";
import { ComponentSetBuilder } from "@salesforce/source-deploy-retrieve";
import {
ComponentSetBuilder,
SourceComponent,
} from "@salesforce/source-deploy-retrieve";
import { filePathsFromMetadataComponent } from "@salesforce/source-deploy-retrieve/lib/src/utils/filePathGenerator";
import { mkdir, writeFile } from "fs/promises";
import { dirname, join } from "path";
Expand Down Expand Up @@ -57,8 +60,10 @@ export default class SourceReadCommand extends SfdxCommand {
const mdJson = await conn.metadata.read(component.type.name, [
component.fullName
]);
let filePath = component.xml;
if (!filePath) {
let filePath;
if (component instanceof SourceComponent) {
filePath = component.xml;
} else {
filePath = filePathsFromMetadataComponent(
component,
join(defaultPackageDirectory, "main", "default")
Expand Down

0 comments on commit daa30a4

Please sign in to comment.