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

@salesforce/dev-scripts

v9.0.0

Published

Standardize package.json scripts and config files for Salesforce projects.

Downloads

103,462

Readme

Common scripts and hooks for Salesforce typescript projects

What is this?

A collection of commonly needed scripts and hooks used by Salesforce typescript projects. This helps to enforce consistency across and reduces the amount of time it takes to setup new projects. This also reduces the amount of needed configuration required for each project by using common configuration from @salesforce/dev-config by default.

When dev-scripts is added as a dev dependency, it will enforce the package.json has the right scripts, hooks, and dependencies. Use the .sfdevrc.json to configure what is generated and controlled.

To automatically have dev-scripts enabled after install, edit package.json:

// package.json
{
  "scripts": {
    "prepare": "sf-install"
  }
}

The common scripts that are added to each project include:

  • clean: cleans lib/, coverage/, and a host of other files that shouldn't be included in the repository; include all to also clean node_modules e.g. yarn clean or yarn clean-all
  • compile: compiles src/ to /lib using tsc e.g. yarn compile
  • lint: lints src/ using tslint e.g. yarn lint
  • test: runs tests using nyc and mocha e.g. yarn test
  • build: runs the clean, compile, lint, and test targets e.g. yarn build
  • docs: generates docs/ using typedoc e.g. yarn docs

The common hooks that are added to each project include:

  • commit-msg: verifies the commit message conforms to angular guidelines using commitlint.
  • pre-commit: runs prettier on staged files and yarn docs.
  • pre-push: runs yarn build.

Configuration

To configure what this generates and controls, create a .sfdevrc file. Look at the schema to see what options are available.

Config File Notes

By default, devScripts will try to keep your package.json aligned with its standards.

For example, devScripts will remove dependencies that it provides. If you want to keep yours, you'd add it in to the sfdevrc. Imagine you need to be on a higher or lower version of mocha that devScripts provides:

{
  "devDepOverrides": ["mocha", "@types/mocha"]
}

And it maintains the scripts and wireit properties. Imagine you want a different lint step in wireit, and a different test step:

{
  "scripts": {
    "test": "yarn test:nuts"
  },
  "wireit": {
    "lint": {
      "command": "eslint src test --color",
      "files": ["src/**/*.ts", "test/**/*.ts", "messages/**", "**/.eslint*", "**/tsconfig.json"],
      "output": []
    }
  }
}

tsconfig

The include section has to live in the repository's tsconfig file until there is a way to specify a base. We plan to remove this section when https://github.com/Microsoft/TypeScript/issues/25430 is fixed

Release

DevScripts has an action you can run which will run the devScripts action in lots of repos (they check for an update, and then bump the version, do an install, etc.)

This runs automatically after devScripts releases.

You need to maintain the list of repos here: https://github.com/forcedotcom/dev-scripts/blob/361bc49a6694fdd9c772031ac583e8a80f139a83/.github/workflows/cross-repo-bump.yml#L17

You can see the in-progress PRs using https://github.com/pulls?q=is%3Aopen+is%3Apr+archived%3Afalse+%22refactor%3A+devScripts+update%22