-
Notifications
You must be signed in to change notification settings - Fork 125
feat: support split CustomLabels on deploy and retrieve #278
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
Conversation
c29849e
to
c64aaee
Compare
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.
Nice!
src/convert/metadataConverter.ts
Outdated
@@ -52,6 +52,7 @@ export class MetadataConverter { | |||
try { | |||
// it's possible the components came from a component set, so this may be redundant in some cases... | |||
const manifestContents = new ComponentSet(components, this.registry).getPackageXml(); | |||
console.log(manifestContents); |
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.
Worth converting to Logger.debug()
?
if (this.content && !this.parent && this.type.children) { | ||
return this.getDecomposedChildren(this.content); | ||
} else if (!this.parent && this.type.children) { | ||
return this.getNonDecomposedChildren(); | ||
} else { | ||
return []; | ||
} |
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.
if (this.content && !this.parent && this.type.children) { | |
return this.getDecomposedChildren(this.content); | |
} else if (!this.parent && this.type.children) { | |
return this.getNonDecomposedChildren(); | |
} else { | |
return []; | |
} | |
if (!this.parent && this.type.children) { | |
if (this.content) { | |
return this.getDecomposedChildren(this.content); | |
} | |
return this.getNonDecomposedChildren(); | |
} | |
return []; |
const contents = fs.readFileSync(this.xml); | ||
return this.parse<T>(contents.toString()); |
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.
Normally I try to use the tree
to do IO, in this case this.tree.readFile
. There isn't a "sync" method on the tree interface yet but you could add one - should be pretty simple. Especially if modifying getChildren to be async is too destructive with the resolver and everything
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.
@brpowell I originally tried adding a readSync
to the treeContainer
classes but I got stumped by ZipTreeContainer
which cannot be implemented synchronously because of the zip library we're using.
I wasn't sure if the ZipTreeContainer
was ever used in this code path, so I decided the safest thing was to just use fs
instead
const xmlPathToChildren = `${this.type.name}.${this.type.directoryName}`; | ||
// WARNING: for NonDecomposed children we expect the first child type to be the only child type, | ||
// which might not be a valid assumption long term | ||
const [childTypeId] = Object.keys(this.type.children.types); |
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.
What if instead we iterate through Object.values(this.type.children.types)
and concat the components for each type?
src/convert/metadataConverter.ts
Outdated
@@ -52,6 +52,7 @@ export class MetadataConverter { | |||
try { | |||
// it's possible the components came from a component set, so this may be redundant in some cases... | |||
const manifestContents = new ComponentSet(components, this.registry).getPackageXml(); | |||
console.log(manifestContents); |
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.
console.log(manifestContents); |
94cfd40
to
9e58fe0
Compare
c78ca35
to
8cbe41f
Compare
@mdonnalley Looking good on the tests 👍 . Few more places to increase coverage on:
|
e723338
to
14c112a
Compare
src/registry/types.ts
Outdated
* The xml attribute used as the unique identifier when parsing the xml | ||
*/ | ||
uniqueIdAttribute?: string; |
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.
This is a nit, but is it the XML attribute or element?
1752ce1
to
a771804
Compare
ba4cc8c
to
f4dc49d
Compare
f4dc49d
to
992830b
Compare
* feat: support split CustomLabels on deploy and retrieve * chore: rename uniqueIdAttribute to uniqueIdElement * fix: allow unprocessed component to be the default component * chore: bump shelljs
* feat: support split CustomLabels on deploy and retrieve * chore: rename uniqueIdAttribute to uniqueIdElement * fix: allow unprocessed component to be the default component * chore: bump shelljs
* feat: support split CustomLabels on deploy and retrieve * chore: rename uniqueIdAttribute to uniqueIdElement * fix: allow unprocessed component to be the default component * chore: bump shelljs
What does this PR do?
Support deploying and retrieving CustomLabels that are split across multiple package directories
The following configuration options are added to the metadata registry:
ignoreParentName
: indicates whether or not the parent name should be included when building out the component's fullNameuniqueIdAttribute
: indicates which xml attribute has the type's unique name. Required in order to matchup incoming children with existing childrenstrategies.recomposition
: Used to change the behavior ofRecompositionFinalizer.recompose
. Only option isstartEmpty
which indicates whether or not the parent object should be read viaparseXml
or instantiated as an empty objectWhat issues does this PR fix or reference?
@W-9016030@
Functionality Before
All labels were retrieved into default package directory
Functionality After
Labels are retrieved into the directory to which they belong. New labels are added to the default directory