diff --git a/README.md b/README.md index 5e48e75..30d7d02 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Link the plugin: sfdx plugins:link . * [`sfdx texei:data:plan:generate -d -o [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeidataplangenerate--d-string--o-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:org:contractfieldhistory:fix [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiorgcontractfieldhistoryfix--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:org:shape:extract [-d ] [-s ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiorgshapeextract--d-string--s-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) -* [`sfdx texei:package:dependencies:install [-k ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeipackagedependenciesinstall--k-string--b-string--p-string--s-string--n-string--w-number--r--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) +* [`sfdx texei:package:dependencies:install [-k ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-a ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeipackagedependenciesinstall--k-string--b-string--p-string--s-string--n-string--w-number--r--a-string--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:profile:clean [-k ] [-p ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiprofileclean--k-string--p-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:sharingcalc:suspend [-s ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeisharingcalcsuspend--s-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) * [`sfdx texei:skinnyprofile:retrieve [-t ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiskinnyprofileretrieve--t-string--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) @@ -67,7 +67,7 @@ EXAMPLE Data exported! ``` -_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/data/export.ts)_ +_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/data/export.ts)_ ## `sfdx texei:data:import -d [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -98,7 +98,7 @@ EXAMPLE Data imported! ``` -_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/data/import.ts)_ +_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/data/import.ts)_ ## `sfdx texei:data:plan:generate -d -o [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -125,7 +125,7 @@ EXAMPLE $ sfdx texei:data:plan:generate --objects Account,Contact,MyCustomObject__c --outputdir ./data ``` -_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/data/plan/generate.ts)_ +_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/data/plan/generate.ts)_ ## `sfdx texei:org:contractfieldhistory:fix [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -153,7 +153,7 @@ EXAMPLE History tracking fixed. ``` -_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/org/contractfieldhistory/fix.ts)_ +_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/org/contractfieldhistory/fix.ts)_ ## `sfdx texei:org:shape:extract [-d ] [-s ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -188,19 +188,24 @@ EXAMPLE $ sfdx texei:org:shape:extract -u bulma@capsulecorp.com" ``` -_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/org/shape/extract.ts)_ +_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/org/shape/extract.ts)_ -## `sfdx texei:package:dependencies:install [-k ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` +## `sfdx texei:package:dependencies:install [-k ] [-b ] [-p ] [-s ] [-n ] [-w ] [-r] [-a ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` install dependent Packages for a sfdx project ``` USAGE $ sfdx texei:package:dependencies:install [-k ] [-b ] [-p ] [-s ] [-n ] [-w - ] [-r] [-v ] [-u ] [--apiversion ] [--json] [--loglevel + ] [-r] [-a ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS + -a, --apexcompile=apexcompile compile all Apex in the org and + package, or only Apex in the package + (see force:package:install for + default value) + -b, --branch=branch the package version’s branch -k, --installationkeys=installationkeys installation key for key-protected @@ -246,7 +251,7 @@ EXAMPLE $ texei:package:dependencies:install -u MyScratchOrg -v MyDevHub -k "1:MyPackage1Key 2: 3:MyPackage3Key" -b "DEV" ``` -_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/package/dependencies/install.ts)_ +_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/package/dependencies/install.ts)_ ## `sfdx texei:profile:clean [-k ] [-p ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -280,7 +285,7 @@ EXAMPLES custom-sfdx-source-folder/main/profiles,source-folder-2/main/profiles/myAdmin.profile-meta.xml ``` -_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/profile/clean.ts)_ +_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/profile/clean.ts)_ ## `sfdx texei:sharingcalc:suspend [-s ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -311,7 +316,7 @@ EXAMPLE Sharing calculations suspended ``` -_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/sharingcalc/suspend.ts)_ +_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/sharingcalc/suspend.ts)_ ## `sfdx texei:skinnyprofile:retrieve [-t ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -344,7 +349,7 @@ EXAMPLE $ texei:skinnyprofile:retrieve -u MyScratchOrg ``` -_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/skinnyprofile/retrieve.ts)_ +_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/skinnyprofile/retrieve.ts)_ ## `sfdx texei:source:customlabel:replace -l -v [-p ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -368,7 +373,7 @@ EXAMPLE $ texei:source:customlabel:replace --label GreatSalesforceBlog --value https://blog.texei.com ``` -_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/source/customlabel/replace.ts)_ +_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/source/customlabel/replace.ts)_ ## `sfdx texei:source:layouts:cleanorg [-p ] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -401,7 +406,7 @@ EXAMPLES $ texei:source:layouts:cleanorg --targetusername myScratchOrg --targetdevhubusername myDevHub ``` -_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/source/layouts/cleanorg.ts)_ +_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/source/layouts/cleanorg.ts)_ ## `sfdx texei:user:update [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` @@ -433,5 +438,5 @@ EXAMPLES $ sfdx texei:user:update --values "UserPermissionsKnowledgeUser=true" --json ``` -_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.0/src/commands/texei/user/update.ts)_ +_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.5.1/src/commands/texei/user/update.ts)_ diff --git a/package.json b/package.json index 4cc346a..e84ece3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "texei-sfdx-plugin", "description": "Texeï's plugin for sfdx", - "version": "1.5.0", + "version": "1.5.1", "author": "Texeï", "bugs": "https://github.com/https://github.com/texei/texei-sfdx-plugin/issues", "dependencies": { diff --git a/src/commands/texei/package/dependencies/install.ts b/src/commands/texei/package/dependencies/install.ts index c3e3157..78fe72a 100644 --- a/src/commands/texei/package/dependencies/install.ts +++ b/src/commands/texei/package/dependencies/install.ts @@ -30,7 +30,8 @@ export default class Install extends SfdxCommand { securitytype: flags.string({ char: 's', required: false, description: "security access type for the installed package (see force:package:install for default value)" }), namespaces: flags.string({ char: 'n', required: false, description: 'filter package installation by namespace' }), wait: flags.number({ char: 'w', required: false, description: 'number of minutes to wait for installation status (also used for publishwait). Default is 10' }), - noprompt: flags.boolean({ char: 'r', required: false, description: 'allow Remote Site Settings and Content Security Policy websites to send or receive data without confirmation' }) + noprompt: flags.boolean({ char: 'r', required: false, description: 'allow Remote Site Settings and Content Security Policy websites to send or receive data without confirmation' }), + apexcompile: flags.string({ char: 'a', required: false, description: "compile all Apex in the org and package, or only Apex in the package (see force:package:install for default value)" }) }; // Comment this out if your command does not require an org username @@ -140,6 +141,12 @@ export default class Install extends SfdxCommand { if (packagesToInstall.length > 0) { // Installing Packages + // Checking previously installed packages + this.debug('DEBUG looking for already installed packages'); + const conn = this.org.getConnection(); + const installedPackagesQuery = 'Select SubscriberPackageVersionId from InstalledSubscriberPackage'; + const installedPackageIds = ((await conn.tooling.query(installedPackagesQuery)).records as any).map(x => x.SubscriberPackageVersionId); + // Getting Installation Key(s) let installationKeys = this.flags.installationkeys; if (installationKeys) { @@ -164,7 +171,8 @@ export default class Install extends SfdxCommand { let i = 0; for (let packageInfo of packagesToInstall) { packageInfo = packageInfo as JsonMap; - if (result.installedPackages.hasOwnProperty(packageInfo.packageVersionId)) { + if (result.installedPackages.hasOwnProperty(packageInfo.packageVersionId) + || installedPackageIds.includes(packageInfo.packageVersionId)) { this.ux.log(`PackageVersionId ${packageInfo.packageVersionId} already installed. Skipping...`); continue; } @@ -192,6 +200,12 @@ export default class Install extends SfdxCommand { args.push('--securitytype'); args.push(`${this.flags.securitytype}`); } + + // APEX COMPILE + if (this.flags.apexcompile) { + args.push('--apexcompile'); + args.push(`${this.flags.apexcompile}`); + } // WAIT const wait = this.flags.wait != null ? this.flags.wait : defaultWait; @@ -260,8 +274,8 @@ export default class Install extends SfdxCommand { query += ' ORDER BY BuildNumber DESC Limit 1'; // Query DevHub to get the expected Package2Version - const conn = this.hubOrg.getConnection(); - const resultPackageId = await conn.tooling.query(query) as any; + const connDevHub = this.hubOrg.getConnection(); + const resultPackageId = await connDevHub.tooling.query(query) as any; if (resultPackageId.size > 0) { packageId = resultPackageId.records[0].SubscriberPackageVersionId;