![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@appirio/sfdx-scripts
Advanced tools
Define named scripts to run at various times in the lifecycle of your sfdx project.
Define named scripts to run at various times in the lifecycle of your project.
I found myself keeping npm
in my sfdx projects just so that I could use the npm run
command to manage lifecycle scripts. That seemed rather silly, so I created this (very) simple sfdx plugin to replace npm run
.
Install sfdx-scripts
the same way you would any other sfdx plugin. The plugin provides two commands: run
and run:list
.
$ sfdx plugins:install @appirio/sfdx-scripts
To list what scripts are defined in the project use run:list
.
$ sfdx run:list
=== Scripts
start
install
stop
publish
Use the run
command to execute a script.
$ sfdx run standup
Errors will always be printed to the console, but if you want to see the complete output of all commands use the --verbose
flag. The script will cease execution at the first error.
$ sfdx run standup --verbose
Scripts are defined in the plugins
section of sfdx-project.json
. Each command is expected to be an sfdx
command, so you can skip writing sfdx
at the start of every line. Your commands can be a single line or a list.
{
...
"plugins" : {
"scripts" : {
"standup" : [
"force:org:create -f config/project-scratch-def.json -s -a myProject",
"force:source:push"
],
"teardown" : "force:org:delete --noprompt -a myProject"
}
}
...
}
For friendlier output while a script is running, you can define heading steps in your script. Any script step that starts with a hash (#
) is a heading step. Everything after the hash will be written to the console as heading.
{
...
"plugins" : {
"scripts" : {
"standup" : [
"# Create org",
"force:org:create -f config/project-scratch-def.json -s -a myProject",
"force:source:push"
]
}
}
...
}
$ sfdx run standup
=== Create Org
force:org:create -f config/project-scratch-def.json -s -a myProject... ✔︎
force:source:push... ✔︎
Remember, run
is a command just like any other for sfdx
. You can use it call scripts from other scripts. I figure that is a pretty common thing, so you can also use .
in place of run
in your scripts.
{
...
"plugins" : {
"scripts" : {
"standup" : [
"force:org:create -f config/project-scratch-def.json -s -a myProject",
". installDependencies",
"force:source:push",
". addUsers",
". installDemoData"
],
"installDependencies" : [...],
"addUsers" : [...],
"installDemoData" : [...]
}
}
...
}
Script commands can include environment variables in either dollar or dollar-brace syntax. They will be automatically replaced when run. This is useful when you need to include secrets in your setup and do not want to commit them to version control.
{
...
"plugins" : {
"scripts" : {
"standup" : [
"force:org:create -f config/project-scratch-def.json -s -a myProject",
"force:package:install -p MyPackage -k $installKeyStoredAsEnvVar",
"force:package:install -p OtherPackage -k ${ dollarBraceFormat }"
]
}
}
...
}
FAQs
Define named scripts to run at various times in the lifecycle of your sfdx project.
We found that @appirio/sfdx-scripts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.