Skip to content

Instantly share code, notes, and snippets.

@JitendraZaa
Last active October 20, 2023 16:25
Show Gist options
  • Save JitendraZaa/16103df1546f1e23616aca9e48a0c63a to your computer and use it in GitHub Desktop.
Save JitendraZaa/16103df1546f1e23616aca9e48a0c63a to your computer and use it in GitHub Desktop.
Blog post from Jitendra Zaa on using Task.json with Salesforce
{
"version": "2.0.0",
"tasks": [
{
"label" : "Set Default DevHub Org - sf config set",
"type" : "shell",
"command" : "sf",
"args":[
"config",
"set",
"target-dev-hub=${input:devHub}"
]
},
{
"label" : "Build new version of Awesome Package",
"type" : "shell",
"command" : "sfdx",
"args":[
"force:package:version:create",
"-p",
"Awesome app by JZ",
"-d",
"force-app",
"-k",
"${input:packagePwd}",
"-w",
"80",
"-v",
"${input:devHub}",
"-f",
"config/project-scratch-def.json",
"--releasenotesurl",
"https://github.com/Jitendra-Zaa/repo/blob/master/README.md",
"--codecoverage",
"-e",
"${input:desc}"
]
},
{
"label": "Change default org",
"type": "shell",
"command": "sfdx",
"args": [
"force:config:set",
"defaultusername=${input:scratchOrgAlias}"
]
},
{
"label" : "Create Scatch Org",
"type" : "shell",
"command" : "sfdx",
"args":[
"force:org:create",
"--setdefaultusername",
"-f",
"config/project-scratch-def.json",
"--setalias",
"${input:scratchOrgAlias}",
"-d",
"7",
"-v",
"${input:devHub}"
]
},
{
"label" : "Promote awesome package for release",
"type" : "shell",
"command" : "sfdx",
"args":[
"force:package:version:promote",
"--package",
"${input:packageId}" ,
"-v",
"${input:devHub}"
]
},
{
"label" : "Code Coverage of Aawesome package",
"type" : "shell",
"command" : "sfdx",
"args":[
"force:package:version:report",
"-p",
"${input:packageId}" ,
"--verbose",
"-v",
"${input:devHub}"
]
},
{
"label" : "Assign permission set",
"type" : "shell",
"command" : "sfdx",
"args":[
"force:user:permset:assign",
"--permsetname",
"admin_permset",
"--targetusername",
"${input:scratchOrgAlias}"
]
},
{
"label" : "Install Awesome Package",
"type" : "shell",
"command" : "sfdx",
"args":[
"force:package:install",
"-p",
"${input:packageId}" ,
"-w",
"80",
"-u",
"${input:scratchOrgAlias}",
"-k",
"${input:packagePwd}",
"-r",
"-t",
"DeprecateOnly",
"-a",
"package",
"-s",
"AllUsers"
]
} ,
{
"label" : "Input For Scratch Org & Package",
"type" : "shell",
"command" : "echo - Scratch Org ALias : ${input:scratchOrgAlias}, PackageId: ${input:packageId} , DevHubName : ${input:devHub} , Password - ${input:packagePwd}"
},
{
"label" : "Create Scratch Org & Install Package",
"dependsOrder": "sequence",
"dependsOn": [
"Input For Scratch Org & Package",
"Create Scatch Org",
"Install Awesome Package"
]
}
],
"inputs":[
{
"id": "desc",
"type":"promptString",
"description" : "Descriptoin of Package",
"default":"Version 1.0 of Package"
},
{
"id": "devHub",
"type":"promptString",
"description" : "DevHub Name",
"default":"jit29"
},
{
"id": "packagePwd",
"type":"promptString",
"description" : "Password of Awesome Package",
"default":"packagepwd"
} ,
{
"id": "scratchOrgAlias",
"type":"promptString",
"description" : "Where to install package, same alias would be used if scratch org needed",
"default":"scratch1"
},
{
"id": "packageId",
"type":"promptString",
"description" : "Package Id of some cool app",
"default":"04t5Y00xxxxxxx"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment