@salesforce/packaging 0.1.2 → 0.1.3

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.
@@ -227,6 +227,7 @@ export declare type PackageVersionCreateOptions = {
227
227
  installationkey: string;
228
228
  installationkeybypass: boolean;
229
229
  packageId: string;
230
+ path: string;
230
231
  postinstallscript: string;
231
232
  postinstallurl: string;
232
233
  preserve: boolean;
@@ -7,7 +7,6 @@ export declare class PackageVersionCreate {
7
7
  private packageObject;
8
8
  private packageType;
9
9
  private packageId;
10
- private packageAlias;
11
10
  private readonly logger;
12
11
  constructor(options: PackageVersionCreateOptions);
13
12
  createPackageVersion(): Promise<Partial<PackageVersionCreateRequestResult>>;
@@ -419,13 +419,29 @@ class PackageVersionCreate {
419
419
  if (this.project.getPackageDirectories()?.length === 0) {
420
420
  throw messages.createError('errorEmptyPackageDirs');
421
421
  }
422
- // from the packageDirectories in sfdx-project.json, find the correct package entry either by finding a matching package (name) or path
423
- this.packageAlias = (0, utils_2.getPackageAliasesFromId)(this.options.packageId, this.options.project).join();
424
- this.packageId = this.options.packageId;
425
- // set on the class, so we can access them in other methods without redoing this logic
426
- this.packageObject = this.project
427
- .getPackageDirectories()
428
- .find((pkg) => pkg.package === this.packageAlias || pkg['id'] === this.options.packageId);
422
+ // either options.packageId or options.path is required
423
+ if (!this.options.packageId && !this.options.path) {
424
+ throw messages.createError('errorMissingPackageIdOrPath');
425
+ }
426
+ // establish the package Id (0ho) and load the package directory
427
+ let packageName;
428
+ if (this.options.packageId) {
429
+ const pkg = this.options.packageId;
430
+ packageName = pkg.startsWith('0Ho')
431
+ ? this.project.getAliasesFromPackageId(pkg).find((alias) => alias)
432
+ : this.project.getPackageIdFromAlias(pkg);
433
+ if (!packageName)
434
+ throw messages.createError('errorMissingPackage', [this.options.packageId]);
435
+ this.packageObject = this.project.findPackage((pkg) => pkg.package === packageName || pkg.name === packageName);
436
+ }
437
+ else {
438
+ // due to flag validation, we'll either have a package or path flag
439
+ this.packageObject = this.project.getPackageFromPath(this.options.path);
440
+ packageName = this.packageObject?.package;
441
+ if (!packageName)
442
+ throw messages.createError('errorCouldNotFindPackageUsingPath', [this.options.path]);
443
+ }
444
+ this.packageId = this.project.getPackageIdFromAlias(packageName) || packageName;
429
445
  this.options.profileApi = await this.resolveUserLicenses(this.packageObject.includeProfileUserLicenses);
430
446
  // At this point, the packageIdFromAlias should have been resolved to an Id. Now, we
431
447
  // need to validate that the Id is correct.
@@ -106,3 +106,15 @@ No subscriber package was found for seed id: %s
106
106
 
107
107
  Only one package in a Dev Hub is allowed per converted from first-generation package, but the following were found:
108
108
  %s
109
+
110
+ # errorMissingPackageIdOrPath
111
+
112
+ You must specify either a package ID or a package path to create a new package version.
113
+
114
+ # errorMissingPackage
115
+
116
+ The package "%s" isn’t defined in the sfdx-project.json file. Add it to the packageDirectories section and add the alias to packageAliases with its 0Ho ID.
117
+
118
+ # errorCouldNotFindPackageUsingPath
119
+
120
+ Could not find a package in sfdx-project.json file using "path" %s. Add it to the packageDirectories section and add the alias to packageAliases with its 0Ho ID.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "packing libraries to Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -20,7 +20,7 @@
20
20
  "prepare": "sf-install",
21
21
  "pretest": "sf-compile-test",
22
22
  "test": "sf-test",
23
- "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel"
23
+ "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 1800000 --parallel"
24
24
  },
25
25
  "keywords": [
26
26
  "force",
@@ -36,10 +36,10 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@oclif/core": "^1.18.0",
39
- "@salesforce/core": "^3.31.10",
39
+ "@salesforce/core": "^3.31.11",
40
40
  "@salesforce/kit": "^1.7.0",
41
41
  "@salesforce/schemas": "^1.1.3",
42
- "@salesforce/source-deploy-retrieve": "^6.9.1",
42
+ "@salesforce/source-deploy-retrieve": "^6.10.0",
43
43
  "@salesforce/ts-types": "^1.5.21",
44
44
  "@xmldom/xmldom": "^0.8.3",
45
45
  "debug": "^4.3.4",
@@ -48,7 +48,7 @@
48
48
  "graphology-traversal": "^0.3.1",
49
49
  "graphology-types": "^0.24.4",
50
50
  "js2xmlparser": "^4.0.2",
51
- "jsforce": "beta",
51
+ "jsforce": "2.0.0-beta.19",
52
52
  "jszip": "^3.10.1",
53
53
  "mkdirp": "1.0.4",
54
54
  "ts-retry-promise": "^0.7.0",