@salesforce/packaging 2.4.18 → 2.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/interfaces/packagingSObjects.js +1 -1
- package/lib/package/packageAncestry.js +2 -2
- package/lib/package/packageConvert.js +3 -3
- package/lib/package/packageProfileApi.js +3 -3
- package/lib/package/packageUninstall.js +1 -1
- package/lib/package/packageVersionCreate.d.ts +0 -1
- package/lib/package/packageVersionCreate.js +33 -15
- package/lib/package/packageVersionCreateRequest.js +1 -1
- package/lib/package/packageVersionReport.js +1 -1
- package/lib/package/packageVersionRetrieve.js +2 -2
- package/lib/package/versionNumber.js +1 -1
- package/lib/package1/package1Version.js +1 -1
- package/lib/utils/packageUtils.js +13 -13
- package/package.json +8 -8
|
@@ -15,5 +15,5 @@ var PackagingSObjects;
|
|
|
15
15
|
Package2VersionStatus["verifyingMetadata"] = "VerifyingMetadata";
|
|
16
16
|
Package2VersionStatus["finalizingPackageVersion"] = "FinalizingPackageVersion";
|
|
17
17
|
})(Package2VersionStatus = PackagingSObjects.Package2VersionStatus || (PackagingSObjects.Package2VersionStatus = {}));
|
|
18
|
-
})(PackagingSObjects
|
|
18
|
+
})(PackagingSObjects || (exports.PackagingSObjects = PackagingSObjects = {}));
|
|
19
19
|
//# sourceMappingURL=packagingSObjects.js.map
|
|
@@ -7,7 +7,7 @@ exports.PackageAncestryNode = exports.AncestryDotProducer = exports.AncestryJson
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const node_os_1 = require("node:os");
|
|
11
11
|
const core_1 = require("@salesforce/core");
|
|
12
12
|
const graphology_1 = require("graphology");
|
|
13
13
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -433,7 +433,7 @@ class AncestryDotProducer {
|
|
|
433
433
|
producers.push(...producer.children);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
return `strict graph G {${
|
|
436
|
+
return `strict graph G {${node_os_1.EOL}${dotLines.join(node_os_1.EOL)}${node_os_1.EOL}}`;
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
exports.AncestryDotProducer = AncestryDotProducer;
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.createPackageVersionCreateRequest = exports.convertPackage = exports.findOrCreatePackage2 = void 0;
|
|
10
|
-
const path = require("path");
|
|
11
|
-
const os = require("os");
|
|
12
|
-
const fs = require("fs");
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
const os = require("node:os");
|
|
12
|
+
const fs = require("node:fs");
|
|
13
13
|
const core_1 = require("@salesforce/core");
|
|
14
14
|
const kit_1 = require("@salesforce/kit");
|
|
15
15
|
const scratchOrgSettingsGenerator_1 = require("@salesforce/core/lib/org/scratchOrgSettingsGenerator");
|
|
@@ -7,8 +7,8 @@ exports.PackageProfileApi = void 0;
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const path = require("path");
|
|
11
|
-
const fs = require("fs");
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
const fs = require("node:fs");
|
|
12
12
|
const glob = require("glob");
|
|
13
13
|
const core_1 = require("@salesforce/core");
|
|
14
14
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -57,7 +57,7 @@ class PackageProfileApi extends kit_1.AsyncCreatable {
|
|
|
57
57
|
// side effect: modify profiles in place
|
|
58
58
|
.filter(({ hasContent, profileName, removedSettings, profilePath, xmlFileLocation, adjustedProfile }) => {
|
|
59
59
|
if (!hasContent) {
|
|
60
|
-
logger.warn(`Profile ${profileName} has no content after filtering. It will still be part of the package but you can remove if it
|
|
60
|
+
logger.warn(`Profile ${profileName} has no content after filtering. It will still be part of the package but you can remove it if it's not needed.`);
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
@@ -7,7 +7,7 @@ exports.uninstallPackage = exports.pollUninstall = exports.getUninstallErrors =
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const os = require("os");
|
|
10
|
+
const os = require("node:os");
|
|
11
11
|
const core_1 = require("@salesforce/core");
|
|
12
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
13
|
const interfaces_1 = require("../interfaces");
|
|
@@ -37,7 +37,6 @@ export declare class PackageVersionCreate {
|
|
|
37
37
|
private packageVersionCreate;
|
|
38
38
|
private getPackageDirFromId;
|
|
39
39
|
private getPackageType;
|
|
40
|
-
private resolveUserLicenses;
|
|
41
40
|
private validateOptionsForPackageType;
|
|
42
41
|
/**
|
|
43
42
|
* Cleans invalid attribute(s) from the packageDescriptorJSON
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.packageXmlJsonToXmlString = exports.packageXmlStringToPackageXmlJson = exports.MetadataResolver = exports.PackageVersionCreate = void 0;
|
|
10
|
-
const path = require("path");
|
|
11
|
-
const os = require("os");
|
|
12
|
-
const fs = require("fs");
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
const os = require("node:os");
|
|
12
|
+
const fs = require("node:fs");
|
|
13
13
|
const core_1 = require("@salesforce/core");
|
|
14
14
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
15
15
|
const scratchOrgSettingsGenerator_1 = require("@salesforce/core/lib/org/scratchOrgSettingsGenerator");
|
|
@@ -346,11 +346,31 @@ class PackageVersionCreate {
|
|
|
346
346
|
if (this.options.codecoverage) {
|
|
347
347
|
hasUnpackagedMetadata = await this.metadataResolver.resolveMetadata(unpackagedMetadataPath, unpackagedMetadataFolder, 'unpackagedMDDirectoryDoesNotExist', sourceApiVersion);
|
|
348
348
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
.
|
|
352
|
-
|
|
353
|
-
|
|
349
|
+
let profileExcludeDirs = [];
|
|
350
|
+
if (this.packageObject.scopeProfiles) {
|
|
351
|
+
this.logger.debug(`packageDirectory: ${this.packageObject.name} has 'scopeProfiles' set, so only including profiles from within this directory`);
|
|
352
|
+
// exclude all package dirs except the one being packaged
|
|
353
|
+
profileExcludeDirs = this.project
|
|
354
|
+
.getPackageDirectories()
|
|
355
|
+
.map((packageDir) => {
|
|
356
|
+
if (packageDir.path !== this.packageObject.path) {
|
|
357
|
+
return packageDir.path;
|
|
358
|
+
}
|
|
359
|
+
})
|
|
360
|
+
.filter((packageDirPath) => packageDirPath);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
// don't package the profiles from any un-packagedMetadata dir in the project
|
|
364
|
+
profileExcludeDirs = this.project
|
|
365
|
+
.getPackageDirectories()
|
|
366
|
+
.map((packageDir) => packageDir.unpackagedMetadata?.path)
|
|
367
|
+
.filter((packageDirPath) => packageDirPath);
|
|
368
|
+
let debugMsg = 'Searching for profiles to include from all packageDirectories';
|
|
369
|
+
if (profileExcludeDirs?.length) {
|
|
370
|
+
debugMsg += ` excluding these unpackagedMetadata dirs: ${profileExcludeDirs.toString()}`;
|
|
371
|
+
}
|
|
372
|
+
this.logger.debug(debugMsg);
|
|
373
|
+
}
|
|
354
374
|
const typesArr = this.options?.profileApi?.filterAndGenerateProfilesForManifest(packageXmlAsJson.types, profileExcludeDirs) ??
|
|
355
375
|
packageXmlAsJson.types;
|
|
356
376
|
// Next generate profiles and retrieve any profiles that were excluded because they had no matching nodes.
|
|
@@ -452,7 +472,10 @@ class PackageVersionCreate {
|
|
|
452
472
|
this.packageObject = packageObject;
|
|
453
473
|
}
|
|
454
474
|
this.packageId = this.project.getPackageIdFromAlias(packageName) ?? packageName;
|
|
455
|
-
this.options.profileApi = await
|
|
475
|
+
this.options.profileApi = await packageProfileApi_1.PackageProfileApi.create({
|
|
476
|
+
project: this.project,
|
|
477
|
+
includeUserLicenses: !!this.packageObject.includeProfileUserLicenses,
|
|
478
|
+
});
|
|
456
479
|
// At this point, the packageIdFromAlias should have been resolved to an Id. Now, we
|
|
457
480
|
// need to validate that the Id is correct.
|
|
458
481
|
pkgUtils.validateId(pkgUtils.BY_LABEL.PACKAGE_ID, this.packageId);
|
|
@@ -505,12 +528,6 @@ class PackageVersionCreate {
|
|
|
505
528
|
}
|
|
506
529
|
return this.pkg.getType();
|
|
507
530
|
}
|
|
508
|
-
async resolveUserLicenses(includeUserLicenses) {
|
|
509
|
-
return packageProfileApi_1.PackageProfileApi.create({
|
|
510
|
-
project: this.project,
|
|
511
|
-
includeUserLicenses,
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
531
|
async validateOptionsForPackageType() {
|
|
515
532
|
if ((await this.getPackageType()) === 'Unlocked') {
|
|
516
533
|
// Don't allow scripts in unlocked packages
|
|
@@ -535,6 +552,7 @@ class PackageVersionCreate {
|
|
|
535
552
|
delete packageDescriptorJson.branch; // for client-side use only, not needed
|
|
536
553
|
delete packageDescriptorJson.fullPath; // for client-side use only, not needed
|
|
537
554
|
delete packageDescriptorJson.name; // for client-side use only, not needed
|
|
555
|
+
delete packageDescriptorJson.scopeProfiles; // for client-side use only, not needed
|
|
538
556
|
return packageDescriptorJson;
|
|
539
557
|
}
|
|
540
558
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.byId = exports.list = void 0;
|
|
10
|
-
const util = require("util");
|
|
10
|
+
const util = require("node:util");
|
|
11
11
|
const core_1 = require("@salesforce/core");
|
|
12
12
|
const packageUtils_1 = require("../utils/packageUtils");
|
|
13
13
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getPackageVersionReport = void 0;
|
|
10
10
|
// Node
|
|
11
|
-
const util = require("util");
|
|
11
|
+
const util = require("node:util");
|
|
12
12
|
// Local
|
|
13
13
|
const core_1 = require("@salesforce/core");
|
|
14
14
|
const pkgUtils = require("../utils/packageUtils");
|
|
@@ -7,8 +7,8 @@ exports.retrievePackageVersionMetadata = void 0;
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const path = require("path");
|
|
11
|
-
const fs = require("fs");
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
const fs = require("node:fs");
|
|
12
12
|
const core_1 = require("@salesforce/core");
|
|
13
13
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
14
14
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -17,7 +17,7 @@ var BuildNumberToken;
|
|
|
17
17
|
BuildNumberToken["RELEASED_BUILD_NUMBER_TOKEN"] = "RELEASED";
|
|
18
18
|
BuildNumberToken["HIGHEST_VERSION_NUMBER_TOKEN"] = "HIGHEST";
|
|
19
19
|
BuildNumberToken["NONE_VERSION_NUMBER_TOKEN"] = "NONE";
|
|
20
|
-
})(BuildNumberToken
|
|
20
|
+
})(BuildNumberToken || (exports.BuildNumberToken = BuildNumberToken = {}));
|
|
21
21
|
class VersionNumber {
|
|
22
22
|
constructor(major, minor, patch, build) {
|
|
23
23
|
this.major = major;
|
|
@@ -7,7 +7,7 @@ exports.Package1Version = void 0;
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const os = require("os");
|
|
10
|
+
const os = require("node:os");
|
|
11
11
|
const core_1 = require("@salesforce/core");
|
|
12
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
13
|
const interfaces_1 = require("../interfaces");
|
|
@@ -7,13 +7,13 @@ exports.isPackageDirectoryEffectivelyEmpty = exports.replaceIfEmpty = exports.co
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const os = require("os");
|
|
11
|
-
const fs = require("fs");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const util = require("util");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
10
|
+
const os = require("node:os");
|
|
11
|
+
const fs = require("node:fs");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const node_stream_1 = require("node:stream");
|
|
14
|
+
const util = require("node:util");
|
|
15
|
+
const node_util_1 = require("node:util");
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
17
|
const core_1 = require("@salesforce/core");
|
|
18
18
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
19
19
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -64,7 +64,7 @@ exports.BY_LABEL = (() => Object.fromEntries(ID_REGISTRY.map((id) => [id.label.r
|
|
|
64
64
|
* - length: the length of the unique id as presented in hexadecimal.
|
|
65
65
|
*/
|
|
66
66
|
function uniqid(options) {
|
|
67
|
-
const uniqueString = (0,
|
|
67
|
+
const uniqueString = (0, node_crypto_1.randomBytes)(Math.ceil((options?.length ?? 32) / 2.0))
|
|
68
68
|
.toString('hex')
|
|
69
69
|
.slice(0, options?.length ?? 32);
|
|
70
70
|
if (!options?.template) {
|
|
@@ -351,7 +351,7 @@ function numberToDuration(duration, unit = kit_1.Duration.Unit.MILLISECONDS) {
|
|
|
351
351
|
return (0, ts_types_1.isNumber)(duration) ? new kit_1.Duration(duration, unit) : duration;
|
|
352
352
|
}
|
|
353
353
|
exports.numberToDuration = numberToDuration;
|
|
354
|
-
const pipeline = (0,
|
|
354
|
+
const pipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
|
|
355
355
|
/**
|
|
356
356
|
* Zips directory to given zipfile.
|
|
357
357
|
*
|
|
@@ -367,7 +367,7 @@ async function zipDir(dir, zipfile) {
|
|
|
367
367
|
const zip = new JSZIP();
|
|
368
368
|
// add files tp zip
|
|
369
369
|
for (const file of globbyResult) {
|
|
370
|
-
zip.file(file, fs.readFileSync((0,
|
|
370
|
+
zip.file(file, fs.readFileSync((0, node_path_1.join)(dir, file)));
|
|
371
371
|
}
|
|
372
372
|
// write zip to file
|
|
373
373
|
const zipStream = zip.generateNodeStream({
|
|
@@ -392,8 +392,8 @@ function copyDir(src, dest) {
|
|
|
392
392
|
fs.mkdirSync(dest, { recursive: true });
|
|
393
393
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
394
394
|
entries.map((entry) => {
|
|
395
|
-
const srcPath = (0,
|
|
396
|
-
const destPath = (0,
|
|
395
|
+
const srcPath = (0, node_path_1.join)(src, entry.name);
|
|
396
|
+
const destPath = (0, node_path_1.join)(dest, entry.name);
|
|
397
397
|
return entry.isDirectory() ? copyDir(srcPath, destPath) : fs.copyFileSync(srcPath, destPath);
|
|
398
398
|
});
|
|
399
399
|
}
|
|
@@ -423,7 +423,7 @@ function isPackageDirectoryEffectivelyEmpty(directory) {
|
|
|
423
423
|
}
|
|
424
424
|
const entries = fs.readdirSync(directory, { withFileTypes: true });
|
|
425
425
|
return entries.every((entry) => entry.isDirectory()
|
|
426
|
-
? isPackageDirectoryEffectivelyEmpty((0,
|
|
426
|
+
? isPackageDirectoryEffectivelyEmpty((0, node_path_1.join)(directory, entry.name))
|
|
427
427
|
: entry.name === '.eslintrc.json');
|
|
428
428
|
}
|
|
429
429
|
exports.isPackageDirectoryEffectivelyEmpty = isPackageDirectoryEffectivelyEmpty;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/packaging",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.19",
|
|
4
4
|
"description": "Packaging library for the Salesforce packaging platform",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@oclif/core": "^2.15.0",
|
|
45
|
-
"@salesforce/core": "^5.3.
|
|
45
|
+
"@salesforce/core": "^5.3.14",
|
|
46
46
|
"@salesforce/kit": "^3.0.15",
|
|
47
|
-
"@salesforce/schemas": "^1.6.
|
|
47
|
+
"@salesforce/schemas": "^1.6.1",
|
|
48
48
|
"@salesforce/source-deploy-retrieve": "^9.7.28",
|
|
49
49
|
"@salesforce/ts-types": "^2.0.9",
|
|
50
50
|
"fast-xml-parser": "^4.3.1",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@salesforce/cli-plugins-testkit": "^4.4.8",
|
|
60
60
|
"@salesforce/dev-config": "^4.1.0",
|
|
61
|
-
"@salesforce/dev-scripts": "^5.
|
|
61
|
+
"@salesforce/dev-scripts": "^5.12.2",
|
|
62
62
|
"@salesforce/prettier-config": "^0.0.3",
|
|
63
|
-
"@salesforce/ts-sinon": "^1.4.
|
|
63
|
+
"@salesforce/ts-sinon": "^1.4.19",
|
|
64
64
|
"@types/globby": "^9.1.0",
|
|
65
65
|
"@types/jszip": "^3.4.1",
|
|
66
66
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"eslint-config-prettier": "^8.10.0",
|
|
71
71
|
"eslint-config-salesforce": "^2.0.2",
|
|
72
72
|
"eslint-config-salesforce-license": "^0.2.0",
|
|
73
|
-
"eslint-config-salesforce-typescript": "^
|
|
73
|
+
"eslint-config-salesforce-typescript": "^2.0.0",
|
|
74
74
|
"eslint-plugin-header": "3.1.1",
|
|
75
75
|
"eslint-plugin-import": "^2.28.1",
|
|
76
|
-
"eslint-plugin-jsdoc": "^
|
|
76
|
+
"eslint-plugin-jsdoc": "^46.8.2",
|
|
77
77
|
"eslint-plugin-sf-plugin": "^1.16.9",
|
|
78
78
|
"husky": "^8.0.3",
|
|
79
79
|
"mocha": "^10.2.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"shelljs": "0.8.5",
|
|
84
84
|
"sinon": "14.0.2",
|
|
85
85
|
"ts-node": "^10.9.1",
|
|
86
|
-
"typescript": "
|
|
86
|
+
"typescript": "^5.2.2",
|
|
87
87
|
"wireit": "^0.14.1"
|
|
88
88
|
},
|
|
89
89
|
"publishConfig": {
|