@salesforce/packaging 1.0.4 → 1.0.6

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/README.md CHANGED
@@ -1,5 +1,24 @@
1
- # Packaging Library for use with Salesforce Packaging Platform
1
+ # Salesforce Packaging
2
2
 
3
3
  > :warning: **This module is under heavy development, please do not use in production.**
4
4
 
5
- [![NPM](https://img.shields.io/npm/v/@salesforce/packaging.svg?label=@salesforce/packaging)](https://www.npmjs.com/package/@salesforce/packaging) [![CircleCI](https://circleci.com/gh/forcedotcom/packaging/tree/main.svg?style=shield)](https://circleci.com/gh/forcedotcom/packaging/tree/main) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/packaging.svg)](https://npmjs.org/package/@salesforce/packaging) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/forcedotcom/packaging/main/LICENSE.txt)
5
+ [![NPM](https://img.shields.io/npm/v/@salesforce/packaging.svg?label=@salesforce/packaging)](https://www.npmjs.com/package/@salesforce/packaging) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/packaging.svg)](https://npmjs.org/package/@salesforce/packaging) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/forcedotcom/packaging/main/LICENSE.txt)
6
+
7
+ ## Description
8
+
9
+ A TypeScript library for packaging metadata in your Salesforce project. This library supports both First-Generation packaging (1GP) and Second-Generation packaging (2GP).
10
+
11
+ ## Usage
12
+
13
+ There are 4 main classes to use from this library:
14
+
15
+ 1. `Package1Version` - Work with 1st generation package versions.
16
+ 1. `Package` - Work with 2nd generation packages.
17
+ 1. `PackageVersion` - Work with 2nd generation package versions.
18
+ 1. `SubscriberPackageVersion` - Work with 2nd generation subscriber package versions.
19
+
20
+ Please see the [API Documentation](https://forcedotcom.github.io/packaging/) for details.
21
+
22
+ ## Contributing
23
+
24
+ If you are interested in contributing, please take a look at the [CONTRIBUTING](CONTRIBUTING.md) guide.
@@ -221,6 +221,7 @@ export declare type ConvertPackageOptions = {
221
221
  installationKeyBypass: boolean;
222
222
  wait: Duration;
223
223
  buildInstance: string;
224
+ frequency?: Duration;
224
225
  };
225
226
  export declare type PackageVersionCreateOptions = {
226
227
  connection: Connection;
@@ -81,7 +81,7 @@ async function convertPackage(pkg, connection, options, project) {
81
81
  }
82
82
  let results;
83
83
  if (options.wait) {
84
- results = await pollForStatusWithInterval(createResult.id, maxRetries, packageId, branch, project, connection, new kit_1.Duration(pkgUtils.POLL_INTERVAL_SECONDS, kit_1.Duration.Unit.SECONDS));
84
+ results = await pollForStatusWithInterval(createResult.id, maxRetries, packageId, branch, project, connection, options.frequency ?? kit_1.Duration.seconds(pkgUtils.POLL_INTERVAL_SECONDS));
85
85
  }
86
86
  else {
87
87
  results = await (0, packageVersionCreateRequest_1.byId)(packageId, connection);
@@ -10,6 +10,15 @@ export declare class PackageVersionCreate {
10
10
  private readonly logger;
11
11
  constructor(options: PackageVersionCreateOptions);
12
12
  createPackageVersion(): Promise<Partial<PackageVersionCreateRequestResult>>;
13
+ /**
14
+ * Extracted into a method for UT purposes
15
+ *
16
+ * @param componentSet CS to convert
17
+ * @param outputDirectory where to place the converted MD
18
+ * @param packageName the packagename related to the CS
19
+ * @private
20
+ */
21
+ private convertMetadata;
13
22
  private generateMDFolderForArtifact;
14
23
  private validateDependencyValues;
15
24
  /**
@@ -40,6 +40,24 @@ class PackageVersionCreate {
40
40
  throw pkgUtils.applyErrorAction(pkgUtils.massageErrorMessage(err));
41
41
  }
42
42
  }
43
+ /**
44
+ * Extracted into a method for UT purposes
45
+ *
46
+ * @param componentSet CS to convert
47
+ * @param outputDirectory where to place the converted MD
48
+ * @param packageName the packagename related to the CS
49
+ * @private
50
+ */
51
+ // eslint-disable-next-line class-methods-use-this
52
+ async convertMetadata(componentSet, outputDirectory, packageName) {
53
+ const converter = new source_deploy_retrieve_1.MetadataConverter();
54
+ return converter.convert(componentSet, 'metadata', {
55
+ type: 'directory',
56
+ outputDirectory,
57
+ packageName,
58
+ genUniqueDir: false,
59
+ });
60
+ }
43
61
  // convert source to mdapi format and copy to tmp dir packaging up
44
62
  async generateMDFolderForArtifact(options) {
45
63
  const sourcepath = options.sourcePaths ?? [options.sourceDir];
@@ -49,13 +67,7 @@ class PackageVersionCreate {
49
67
  });
50
68
  const packageName = options.packageName;
51
69
  const outputDirectory = path.resolve(options.deploydir);
52
- const converter = new source_deploy_retrieve_1.MetadataConverter();
53
- const convertResult = await converter.convert(componentSet, 'metadata', {
54
- type: 'directory',
55
- outputDirectory,
56
- packageName,
57
- genUniqueDir: false,
58
- });
70
+ const convertResult = await this.convertMetadata(componentSet, outputDirectory, packageName);
59
71
  if (packageName) {
60
72
  // SDR will build an output path like /output/directory/packageName/package.xml
61
73
  // this was breaking from toolbelt, so to revert it we copy the directory up a level and delete the original
@@ -250,10 +262,10 @@ class PackageVersionCreate {
250
262
  const clientSideInfo = new Map();
251
263
  await fs.promises.mkdir(packageVersBlobDirectory, { recursive: true });
252
264
  const settingsGenerator = new scratchOrgSettingsGenerator_1.default({ asDirectory: true });
265
+ const packageDescriptorJson = (0, kit_1.cloneJson)(this.packageObject);
253
266
  // Copy all the metadata from the workspace to a tmp folder
254
267
  const componentSet = await this.generateMDFolderForArtifact(mdOptions);
255
268
  this.verifyHasSource(componentSet);
256
- const packageDescriptorJson = (0, kit_1.cloneJson)(this.packageObject);
257
269
  if (packageDescriptorJson.package) {
258
270
  delete packageDescriptorJson.package;
259
271
  packageDescriptorJson.id = this.packageId;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "1.0.4",
4
- "description": "packing libraries to Salesforce packaging platform",
3
+ "version": "1.0.6",
4
+ "description": "Packaging library for the Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
7
7
  "license": "BSD-3-Clause",
8
+ "repository": "forcedotcom/packaging",
8
9
  "scripts": {
9
10
  "build": "sf-build",
10
11
  "ci-docs": "yarn sf-ci-docs",
@@ -15,7 +16,7 @@
15
16
  "format": "sf-format",
16
17
  "lint": "sf-lint",
17
18
  "lint-fix": "yarn sf-lint --fix",
18
- "postcompile": "tsc -p test && tsc -p typedocExamples",
19
+ "postcompile": "tsc -p test",
19
20
  "prepack": "sf-prepack",
20
21
  "prepare": "sf-install",
21
22
  "pretest": "sf-compile-test",
@@ -26,7 +27,8 @@
26
27
  "force",
27
28
  "salesforce",
28
29
  "sfdx",
29
- "salesforcedx"
30
+ "salesforcedx",
31
+ "packaging"
30
32
  ],
31
33
  "files": [
32
34
  "docs",
@@ -86,7 +88,6 @@
86
88
  "ts-node": "^10.9.1",
87
89
  "typescript": "4.8.4"
88
90
  },
89
- "repository": "forcedotcom/packaging",
90
91
  "publishConfig": {
91
92
  "access": "public"
92
93
  }