@dxatscale/sfpowerscripts.core
Advanced tools
Comparing version 0.4.4 to 1.0.0
@@ -7,5 +7,11 @@ export default class InstallUnlockedPackageImpl { | ||
private publish_wait_time; | ||
constructor(package_version_id: string, targetusername: string, options: any, wait_time: string, publish_wait_time: string); | ||
exec(): Promise<void>; | ||
buildExecCommand(): Promise<string>; | ||
private skip_if_package_installed; | ||
constructor(package_version_id: string, targetusername: string, options: any, wait_time: string, publish_wait_time: string, skip_if_package_installed: boolean); | ||
exec(): Promise<PackageInstallationResult>; | ||
private buildPackageInstallCommand; | ||
private checkWhetherPackageIsIntalledInOrg; | ||
} | ||
export declare enum PackageInstallationResult { | ||
Skipped = 0, | ||
Succeeded = 1 | ||
} |
@@ -16,3 +16,3 @@ "use strict"; | ||
class InstallUnlockedPackageImpl { | ||
constructor(package_version_id, targetusername, options, wait_time, publish_wait_time) { | ||
constructor(package_version_id, targetusername, options, wait_time, publish_wait_time, skip_if_package_installed) { | ||
this.package_version_id = package_version_id; | ||
@@ -23,30 +23,70 @@ this.targetusername = targetusername; | ||
this.publish_wait_time = publish_wait_time; | ||
this.skip_if_package_installed = skip_if_package_installed; | ||
} | ||
exec() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let command = yield this.buildExecCommand(); | ||
let child = child_process.exec(command, (error, stdout, stderr) => { | ||
if (error) | ||
throw error; | ||
}); | ||
child.stdout.on("data", data => { console.log(data.toString()); }); | ||
yield OnExit_1.onExit(child); | ||
let isPackageInstalled = false; | ||
if (this.skip_if_package_installed) { | ||
isPackageInstalled = this.checkWhetherPackageIsIntalledInOrg(); | ||
} | ||
if (!isPackageInstalled) { | ||
let command = this.buildPackageInstallCommand(); | ||
let child = child_process.exec(command, (error, stdout, stderr) => { | ||
if (error) { | ||
throw error; | ||
} | ||
}); | ||
child.stdout.on("data", (data) => { | ||
console.log(data.toString()); | ||
}); | ||
yield OnExit_1.onExit(child); | ||
return PackageInstallationResult.Succeeded; | ||
} | ||
else { | ||
console.log("Skipping Package Installation"); | ||
return PackageInstallationResult.Skipped; | ||
} | ||
}); | ||
} | ||
buildExecCommand() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let command = `npx sfdx force:package:install --package ${this.package_version_id} -u ${this.targetusername} --noprompt`; | ||
command += ` --publishwait=${this.publish_wait_time}`; | ||
command += ` --wait=${this.wait_time}`; | ||
command += ` --securitytype=${this.options['securitytype']}`; | ||
command += ` --upgradetype=${this.options['upgradetype']}`; | ||
command += ` --apexcompile=${this.options['apexcompile']}`; | ||
if (!util_1.isNullOrUndefined(this.options['installationkey'])) | ||
command += ` --installationkey=${this.options['installationkey']}`; | ||
console.log(`Generated Command ${command}`); | ||
return command; | ||
}); | ||
buildPackageInstallCommand() { | ||
let command = `sfdx force:package:install --package ${this.package_version_id} -u ${this.targetusername} --noprompt`; | ||
command += ` --publishwait=${this.publish_wait_time}`; | ||
command += ` --wait=${this.wait_time}`; | ||
command += ` --securitytype=${this.options["securitytype"]}`; | ||
command += ` --upgradetype=${this.options["upgradetype"]}`; | ||
command += ` --apexcompile=${this.options["apexcompile"]}`; | ||
if (!util_1.isNullOrUndefined(this.options["installationkey"])) | ||
command += ` --installationkey=${this.options["installationkey"]}`; | ||
console.log(`Generated Command ${command}`); | ||
return command; | ||
} | ||
checkWhetherPackageIsIntalledInOrg() { | ||
try { | ||
console.log(`Checking Whether Package with ID ${this.package_version_id} is installed in ${this.targetusername}`); | ||
let command = `sfdx sfpowerkit:package:version:info -u ${this.targetusername} --json`; | ||
let result = JSON.parse(child_process.execSync(command).toString()); | ||
if (result.status == 0) { | ||
let packageInfos = result.result; | ||
let packageFound = packageInfos.find((packageInfo) => { | ||
if (packageInfo.packageVersionId == this.package_version_id) | ||
return true; | ||
}); | ||
if (packageFound) { | ||
console.log("Package To be installed was found in the target org", packageFound); | ||
return true; | ||
} | ||
} | ||
} | ||
catch (error) { | ||
console.log("Unable to check whether this package is installed in the target org"); | ||
return false; | ||
} | ||
} | ||
} | ||
exports.default = InstallUnlockedPackageImpl; | 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LENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUUvRCxNQUFNLGVBQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUVwQixDQUFDO0tBQUE7SUFFWSxnQkFBZ0I7O1lBRTNCLElBQUksT0FBTyxHQUFHLDRDQUE0QyxJQUFJLENBQUMsa0JBQWtCLE9BQU8sSUFBSSxDQUFDLGNBQWMsYUFBYSxDQUFBO1lBRXhILE9BQU8sSUFBRSxrQkFBa0IsSUFBSSxDQUFDLGlCQUFpQixFQUFFLENBQUM7WUFDcEQsT0FBTyxJQUFFLFdBQVcsSUFBSSxDQUFDLFNBQVMsRUFBRSxDQUFDO1lBQ3JDLE9BQU8sSUFBRSxtQkFBbUIsSUFBSSxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUMsRUFBRSxDQUFDO1lBQzNELE9BQU8sSUFBRSxrQkFBa0IsSUFBSSxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsRUFBRSxDQUFDO1lBQ3pELE9BQU8sSUFBRSxrQkFBa0IsSUFBSSxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsRUFBRSxDQUFDO1lBRXpELElBQUcsQ0FBQyx3QkFBaUIsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLGlCQUFpQixDQUFDLENBQUM7Z0JBQ3RELE9BQU8sSUFBRSxzQkFBc0IsSUFBSSxDQUFDLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxFQUFFLENBQUM7WUFFbEUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxxQkFBcUIsT0FBTyxFQUFFLENBQUMsQ0FBQTtZQUUzQyxPQUFPLE9BQU8sQ0FBQztRQUVoQixDQUFDO0tBQUE7Q0FDRjtBQTFDRCw2Q0EwQ0MifQ== | ||
var PackageInstallationResult; | ||
(function (PackageInstallationResult) { | ||
PackageInstallationResult[PackageInstallationResult["Skipped"] = 0] = "Skipped"; | ||
PackageInstallationResult[PackageInstallationResult["Succeeded"] = 1] = "Succeeded"; | ||
})(PackageInstallationResult = exports.PackageInstallationResult || (exports.PackageInstallationResult = {})); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW5zdGFsbFVubG9ja2VkUGFja2FnZUltcGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2ZkeHdyYXBwZXJzL0luc3RhbGxVbmxvY2tlZFBhY2thZ2VJbXBsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQUEsK0NBQWdEO0FBQ2hELCtCQUF5QztBQUN6QyxzQ0FBbUM7QUFFbkMsTUFBcUIsMEJBQTBCO0lBQzdDLFlBQ1Usa0JBQTBCLEVBQzFCLGNBQXNCLEVBQ3RCLE9BQVksRUFDWixTQUFpQixFQUNqQixpQkFBeUIsRUFDekIseUJBQWtDO1FBTGxDLHVCQUFrQixHQUFsQixrQkFBa0IsQ0FBUTtRQUMxQixtQkFBYyxHQUFkLGNBQWMsQ0FBUTtRQUN0QixZQUFPLEdBQVAsT0FBTyxDQUFLO1FBQ1osY0FBUyxHQUFULFNBQVMsQ0FBUTtRQUNqQixzQkFBaUIsR0FBakIsaUJBQWlCLENBQVE7UUFDekIsOEJBQXlCLEdBQXpCLHlCQUF5QixDQUFTO0lBQ3pDLENBQUM7SUFFUyxJQUFJOztZQUlmLElBQUksa0JBQWtCLEdBQUcsS0FBSyxDQUFDO1lBQy9CLElBQUksSUFBSSxDQUFDLHlCQUF5QixFQUFFO2dCQUNsQyxrQkFBa0IsR0FBRyxJQUFJLENBQUMsa0NBQWtDLEVBQUUsQ0FBQzthQUNoRTtZQUVELElBQUksQ0FBQyxrQkFBa0IsRUFBRTtnQkFDdkIsSUFBSSxPQUFPLEdBQUcsSUFBSSxDQUFDLDBCQUEwQixFQUFFLENBQUM7Z0JBQ2hELElBQUksS0FBSyxHQUFHLGFBQWEsQ0FBQyxJQUFJL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0JBQ2hCLE9BQU8sQ0FBQyxHQUFHLENBQ1QscURBQXFELEVBQ3JELFlBQVksQ0FDYixDQUFDO29CQUNGLE9BQU8sSUFBSSxDQUFDO2lCQUNiO2FBQ0Y7U0FDRjtRQUFDLE9BQU8sS0FBSyxFQUFFO1lBQ2QsT0FBTyxDQUFDLEdBQUcsQ0FDVCxxRUFBcUUsQ0FDdEUsQ0FBQztZQUNGLE9BQU8sS0FBSyxDQUFDO1NBQ2Q7SUFDSCxDQUFDO0NBQ0Y7QUFqRkQsNkNBaUZDO0FBRUQsSUFBWSx5QkFHWDtBQUhELFdBQVkseUJBQXlCO0lBQ25DLCtFQUFPLENBQUE7SUFDUCxtRkFBUyxDQUFBO0FBQ1gsQ0FBQyxFQUhXLHlCQUF5QixHQUF6QixpQ0FBeUIsS0FBekIsaUNBQXlCLFFBR3BDIn0= |
{ | ||
"name": "@dxatscale/sfpowerscripts.core", | ||
"version": "0.4.4", | ||
"version": "1.0.0", | ||
"description": "Core Module used by sfpowerscripts", | ||
@@ -38,3 +38,3 @@ "main": "lib/index", | ||
"homepage": "https://github.com/Accenture/sfpowerscripts#readme", | ||
"gitHead": "12190475fc2f8dcdf59d1e219998cbcaf9567fb9" | ||
"gitHead": "1dd22a4bb3c52819a8d1075c3719236fff798589" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
130670
1571
0