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

run-it-on

v1.0.0

Published

Run terminal or VSCode commands on save or watched files changed

Downloads

1

Readme

Run It On!

Run terminal or VS Code commands on save or watched files changed

Fork from vscode-save-and-run-ext

UPDATE The original version seems not updated and no longer works as it should. This fork is the updated one and also adds new feature named watchers, that will allow it to just watch file (s) change then once the matched files changed, it will run the command.

Features

  • Configure multiple commands (terminal or command from VSCode/extension) that run when a file is saved.
  • Regex pattern matching for files that trigger commands running.
  • NEW watch files' changes then run a command.

Note

  • Commands only get run when saving an existing file. Creating new files, and Save as... don't trigger the commands.
  • Property match on watchers config uses globPattern NOT regex.

Configuration

Add runItOn configuration to user or workspace settings.

  • commands - array of commands that will be run whenever a file is saved.
    • match - a regex for matching which files to run commands on. Default .*.
    • cmd - command to execute on save. Can include parameters that will be replaced at runtime (see Placeholder Tokens section below). Default echo ${file}.
    • isAsync - run command asynchronously. Default false.
    • isShellCommand - run command in terminal. Default true.
    • useShortcut - only execute when press shortcut keys Ctrl/Command + Shift + R. Default false.
    • silent - suppress terminal when command is executing.
  • watchers - array of commands that will be run whenever matching files changed.
    • match - a globPattern for matching which files to run commands on. Default **/*.*.
    • cmd - command to execute when matching files have changed. Can include parameters that will be replaced at runtime (see Placeholder Tokens section below). Default echo ${file}.
    • isAsync - run command asynchronously. Default false.
    • isShellCommand - run command in terminal. Default true.
    • silent - command to execute when matching files have changed.

Sample Config

"runItOn": {
	"commands": [
		{
			"match": ".*",
			"isShellCommand" : false,
			"cmd": "myExtension.amazingCommand"
		},
		{
			"match": "\\.txt$",
			"cmd": "echo 'Executed in the terminal: I am a .txt file ${file}.'"
		}
	],
	"watchers": [
		{
			"match": "**/*.js",
			"cmd": "echo 'Changes detected on js files.'"
		}
	]
}

Commands

The following commands are exposed in the command palette

  • Run It On! : Enable to enable Run It On!
  • Run It On! : Disable to disable Run It On!
  • Run It On! : Execute to force executing save then run on matching files. This has no effect to watchers.

Placeholder Tokens

Commands support placeholders similar to tasks.json.

  • ${workspaceRoot}: workspace root folder
  • ${workspaceFolder}: the path of the folder opened in VS Code
  • ${file}: path of saved file
  • ${relativeFile}: relative path of saved file
  • ${fileBasename}: saved file's basename
  • ${fileDirname}: directory name of saved file
  • ${fileExtname}: extension (including .) of saved file
  • ${fileBasenameNoExt}: saved file's basename without extension
  • ${cwd}: current working directory

Environment Variable Tokens

  • ${env.Name}

Todo

  • [ ] Update the preview image

License

Apache