Skip to content

Commit

Permalink
Merge pull request #12 from forcedotcom/sm/xmldom-replace
Browse files Browse the repository at this point in the history
fix: use regular xmlDom package
  • Loading branch information
shetzel authored Aug 5, 2022
2 parents 135d420 + 57262c5 commit 62aff2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
"@salesforce/schemas": "^1.2.0",
"@salesforce/source-deploy-retrieve": "^6.2.0",
"@salesforce/ts-types": "^1.5.20",
"@xmldom/xmldom": "^0.8.2",
"debug": "^4.3.4",
"globby": "^11",
"js2xmlparser": "^4.0.2",
"jsforce": "beta",
"jszip": "^3.10.0",
"mkdirp": "1.0.4",
"ts-retry-promise": "^0.6.1",
"jszip": "^3.10.0",
"xml2js": "^0.4.23",
"xmldom-sfdx-encoding": "^0.1.30"
"xml2js": "^0.4.23"
},
"devDependencies": {
"@salesforce/cli-plugins-testkit": "^2.3.4",
Expand Down
8 changes: 4 additions & 4 deletions src/package/packageProfileApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as path from 'path';
import * as fs from 'fs';
import * as glob from 'glob';
import { DOMParser, XMLSerializer } from 'xmldom-sfdx-encoding';
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
import { ConfigAggregator, Messages, SfProject } from '@salesforce/core';
import { AsyncCreatable } from '@salesforce/kit';
import { ProfileApiOptions } from '../interfaces';
Expand Down Expand Up @@ -178,7 +178,7 @@ export class PackageProfileApi extends AsyncCreatable<ProfileApiOptions> {
const userLicenses = profileDom.getElementsByTagName('userLicense');
if (userLicenses) {
hasNodes = true;
for (const userLicense of userLicenses) {
for (const userLicense of Array.from(userLicenses)) {
profileNode.appendChild(userLicense.cloneNode(true));
}
}
Expand All @@ -190,7 +190,7 @@ export class PackageProfileApi extends AsyncCreatable<ProfileApiOptions> {
if (hasNodes) {
const serializer = new XMLSerializer();
serializer.serializeToString(newDom);
fs.writeFileSync(destFilePath, serializer.serializeToString(newDom) as string, 'utf-8');
fs.writeFileSync(destFilePath, serializer.serializeToString(newDom), 'utf-8');
} else {
// remove from manifest
// eslint-disable-next-line @typescript-eslint/no-shadow
Expand All @@ -206,7 +206,7 @@ export class PackageProfileApi extends AsyncCreatable<ProfileApiOptions> {
try {
fs.unlinkSync(destFilePath);
} catch (err) {
// It is normal for the file to not exist if the profile is in the worskpace but not in the directory being packaged.
// It is normal for the file to not exist if the profile is in the workspace but not in the directory being packaged.
if (err.code !== 'ENOENT') {
throw err;
}
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,11 @@
resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44"
integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==

"@xmldom/xmldom@^0.8.2":
version "0.8.2"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.2.tgz#b695ff674e8216efa632a3d36ad51ae9843380c0"
integrity sha512-+R0juSseERyoPvnBQ/cZih6bpF7IpCXlWbHRoCRzYzqpz6gWHOgf8o4MOEf6KBVuOyqU+gCNLkCWVIJAro8XyQ==

JSONStream@^1.0.4:
version "1.3.5"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0"
Expand Down Expand Up @@ -6524,7 +6529,7 @@ xmlcreate@^2.0.4:
resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.4.tgz#0c5ab0f99cdd02a81065fa9cd8f8ae87624889be"
integrity sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==

xmldom-sfdx-encoding@^0.1.29, xmldom-sfdx-encoding@^0.1.30:
xmldom-sfdx-encoding@^0.1.29:
version "0.1.30"
resolved "https://registry.yarnpkg.com/xmldom-sfdx-encoding/-/xmldom-sfdx-encoding-0.1.30.tgz#bc075757788573b8988facd6f7e7f073440b20b9"
integrity sha512-NOZCfMfwvCMBlSMBr971cnjmToNswV68A1CA3pnM0WGauo1BhWpTgSsj6Lbq8HNAI2OOdWktCSMLtaZU5wVBHA==
Expand Down

0 comments on commit 62aff2c

Please sign in to comment.