Skip to content
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

Bug/1390 metadata always deletes folder of retrieved types before recreating it #1394

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion @types/lib/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,10 @@ class Mcdev {
// Clear output folder structure for selected type
retrieveTypesArr.push(type);
}
if (!keys) {
const areKeySet = Array.isArray(selectedTypesArr)
? keys
: Object.values(selectedTypesArr).filter(Boolean).length;
if (!areKeySet) {
// dont delete directories if we are just re-retrieving a single file
await File.remove(File.normalizePath(removePathArr));
// clean up old folders after types were renamed
Expand All @@ -420,7 +423,7 @@ class Mcdev {
if (!retrieveTypesArr.length) {
// assume no type was given and config settings are used instead:
// Clear output folder structure
File.removeSync(File.normalizePath([properties.directories.retrieve, cred, bu]));
await File.remove(File.normalizePath([properties.directories.retrieve, cred, bu]));
// removes subtypes and removes duplicates
retrieveTypesArr.push(
...new Set(properties.metaDataTypes.retrieve.map((type) => type.split('-')[0]))
Expand Down
Loading