npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@appirio/sfdx-scripts

v0.1.7

Published

Define named scripts to run at various times in the lifecycle of your sfdx project.

Downloads

48

Readme

sfdx-scripts

Define named scripts to run at various times in the lifecycle of your project.

About

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.

Installation & Usage

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

Listing Defined Scripts

To list what scripts are defined in the project use run:list.

$ sfdx run:list
=== Scripts
start
install
stop
publish

Executing a Script

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

Defining Scripts

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"
    }
  }
  ...
}

Headings

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... ✔︎

Subscripts

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" : [...]
    }
  }
  ...
}

Environment Variables

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 }"
      ]
    }
  }
  ...
}