@salesforce/packaging 0.0.22 → 0.0.23

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.23](https://github.com/forcedotcom/packaging/compare/v0.0.22...v0.0.23) (2022-08-22)
6
+
7
+ ### Bug Fixes
8
+
9
+ - increase pvc ut timeout to 10 secs ([08e667f](https://github.com/forcedotcom/packaging/commit/08e667f574abf5a3de0686c5dcfd654d9fa4c0fa))
10
+ - remove ref to dev dep ([a51323a](https://github.com/forcedotcom/packaging/commit/a51323aaf699eb82fc515722681c6f1b56edb5f4))
11
+
5
12
  ### [0.0.22](https://github.com/forcedotcom/packaging/compare/v0.0.21...v0.0.22) (2022-08-22)
6
13
 
7
14
  ### Bug Fixes
@@ -13,7 +13,7 @@ const os = require("os");
13
13
  const fs = require("fs");
14
14
  const core_1 = require("@salesforce/core");
15
15
  const kit_1 = require("@salesforce/kit");
16
- const testSetup_1 = require("@salesforce/core/lib/testSetup");
16
+ const uniqid_1 = require("../utils/uniqid");
17
17
  const pkgUtils = require("../utils/packageUtils");
18
18
  const constants_1 = require("../constants");
19
19
  const srcDevUtil = require("../utils/srcDevUtils");
@@ -55,7 +55,7 @@ exports.convertPackage = convertPackage;
55
55
  * @private
56
56
  */
57
57
  async function createPackageVersionCreateRequest(context, packageId) {
58
- const uniqueId = (0, testSetup_1.uniqid)({ template: `${packageId}-%s` });
58
+ const uniqueId = (0, uniqid_1.uniqid)({ template: `${packageId}-%s` });
59
59
  const packageVersTmpRoot = path.join(os.tmpdir(), uniqueId);
60
60
  const packageVersBlobDirectory = path.join(packageVersTmpRoot, 'package-version-info');
61
61
  const packageVersBlobZipFile = path.join(packageVersTmpRoot, constants_1.consts.PACKAGE_VERSION_INFO_FILE_ZIP);
@@ -12,10 +12,10 @@ const os = require("os");
12
12
  const fs = require("fs");
13
13
  const core_1 = require("@salesforce/core");
14
14
  const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
15
- const testSetup_1 = require("@salesforce/core/lib/testSetup");
16
15
  const scratchOrgSettingsGenerator_1 = require("@salesforce/core/lib/org/scratchOrgSettingsGenerator");
17
16
  const xml2js = require("xml2js");
18
17
  const scratchOrgInfoGenerator_1 = require("@salesforce/core/lib/org/scratchOrgInfoGenerator");
18
+ const uniqid_1 = require("../utils/uniqid");
19
19
  const pkgUtils = require("../utils/packageUtils");
20
20
  const versionNumber_1 = require("../utils/versionNumber");
21
21
  const utils_1 = require("../utils");
@@ -221,7 +221,7 @@ class PackageVersionCreate {
221
221
  */
222
222
  async createPackageVersionCreateRequestFromOptions() {
223
223
  const preserveFiles = !!(this.options.preserve || process.env.SFDX_PACKAGE2_VERSION_CREATE_PRESERVE);
224
- const uniqueHash = (0, testSetup_1.uniqid)({ template: `${this.packageId}-%s` });
224
+ const uniqueHash = (0, uniqid_1.uniqid)({ template: `${this.packageId}-%s` });
225
225
  const packageVersTmpRoot = path.join(os.tmpdir(), `${uniqueHash}`);
226
226
  const packageVersMetadataFolder = path.join(packageVersTmpRoot, 'md-files');
227
227
  const unpackagedMetadataFolder = path.join(packageVersTmpRoot, 'unpackaged-md-files');
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A function to generate a unique id and return it in the context of a template, if supplied.
3
+ *
4
+ * A template is a string that can contain `${%s}` to be replaced with a unique id.
5
+ * If the template contains the "%s" placeholder, it will be replaced with the unique id otherwise the id will be appended to the template.
6
+ *
7
+ * @param options an object with the following properties:
8
+ * - template: a template string.
9
+ * - length: the length of the unique id as presented in hexadecimal.
10
+ */
11
+ export declare function uniqid(options?: {
12
+ template?: string;
13
+ length?: number;
14
+ }): string;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uniqid = void 0;
4
+ /*
5
+ * Copyright (c) 2022, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const crypto_1 = require("crypto");
11
+ const util = require("util");
12
+ /**
13
+ * A function to generate a unique id and return it in the context of a template, if supplied.
14
+ *
15
+ * A template is a string that can contain `${%s}` to be replaced with a unique id.
16
+ * If the template contains the "%s" placeholder, it will be replaced with the unique id otherwise the id will be appended to the template.
17
+ *
18
+ * @param options an object with the following properties:
19
+ * - template: a template string.
20
+ * - length: the length of the unique id as presented in hexadecimal.
21
+ */
22
+ function uniqid(options) {
23
+ const uniqueString = (0, crypto_1.randomBytes)(Math.ceil((options?.length ?? 32) / 2.0))
24
+ .toString('hex')
25
+ .slice(0, options?.length ?? 32);
26
+ if (!options?.template) {
27
+ return uniqueString;
28
+ }
29
+ return options.template.includes('%s')
30
+ ? util.format(options.template, uniqueString)
31
+ : `${options.template}${uniqueString}`;
32
+ }
33
+ exports.uniqid = uniqid;
34
+ //# sourceMappingURL=uniqid.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "packing libraries to Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",