Skip to content

Commit

Permalink
Merge pull request #94 from emeraldwalk/93-update-dependencies
Browse files Browse the repository at this point in the history
chore: 93 update dependencies
  • Loading branch information
bmingles authored Sep 28, 2024
2 parents 4e0f0f5 + a2e5959 commit 3908772
Show file tree
Hide file tree
Showing 12 changed files with 3,899 additions and 2,256 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.8.0
5 changes: 5 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
singleQuote: true
semi: true
tabWidth: 2
trailingComma: 'all'
bracketSameLine: true
41 changes: 27 additions & 14 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,39 @@
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process

// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",

"version": "2.0.0",
// we want to run npm
"command": "npm",

// the command is a shell script
"isShellCommand": true,

// show the output window only if unrecognized errors occur.
"showOutput": "silent",

// we run the custom script "compile" as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"],

"args": [
"run",
"compile",
"--loglevel",
"silent"
],
// The tsc compiler is started in watching mode
"isWatching": true,

// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
"problemMatcher": "$tsc-watch",
"tasks": [
{
"label": "npm",
"type": "shell",
"command": "npm",
"args": [
"run",
"compile",
"--loglevel",
"silent"
],
"isBackground": true,
"problemMatcher": "$tsc-watch",
"group": {
"_id": "build",
"isDefault": false
}
}
]
}
20 changes: 11 additions & 9 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.vscode/**
typings/**
out/test/**
test/**
src/**
**/*.map
.gitignore
tsconfig.json
vsc-extension-quickstart.md
### Ignore everything ####
**/*

#### Explicitly add things back ####

!LICENSE
!package.json
!README.md
!images/**
!out/src/extension.js

62 changes: 37 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# Run On Save for Visual Studio Code

This extension allows configuring commands that get run whenever a file is saved in vscode.

NOTE: Commands only get run when saving an existing file. Creating new files, and Save as... don't trigger the commands.

## Features
* Configure multiple commands that run when a file is saved
* Regex pattern matching for files that trigger commands running
* Sync and async support

- Configure multiple commands that run when a file is saved
- Regex pattern matching for files that trigger commands running
- Sync and async support

## Configuration

Add "emeraldwalk.runonsave" configuration to user or workspace settings.
* "shell" - (optional) shell path to be used with child_process.exec options that runs commands.
* "autoClearConsole" - (optional) clear VSCode output console every time commands run. Defaults to false.
* "commands" - array of commands that will be run whenever a file is saved.
* "match" - a regex for matching which files to run commands on
> NOTE Since this is a Regex, and also in a JSON string backslashes have to be double escaped such as when targetting folders. e.g. "match": "some\\\\\\\\folder\\\\\\\\.*"
* "cmd" - command to run. Can include parameters that will be replaced at runtime (see Placeholder Tokens section below).
* "isAsync" (optional) - defaults to false. If true, next command will be run before this one finishes.

- "shell" - (optional) shell path to be used with child_process.exec options that runs commands.
- "autoClearConsole" - (optional) clear VSCode output console every time commands run. Defaults to false.
- "commands" - array of commands that will be run whenever a file is saved.
- "match" - a regex for matching which files to run commands on
> NOTE Since this is a Regex, and also in a JSON string backslashes have to be double escaped such as when targetting folders. e.g. "match": "some\\\\\\\\folder\\\\\\\\.\*"
- "cmd" - command to run. Can include parameters that will be replaced at runtime (see Placeholder Tokens section below).
- "isAsync" (optional) - defaults to false. If true, next command will be run before this one finishes.

### Sample Config

This sample configuration will run echo statements including the saved file path.
In this sample, the first command is async, so the second command will get executed immediately even if first hasn't completed.
Since the second isn't async, the third command won't execute until the second is complete.
```

```json
{
"emeraldwalk.runonsave": {
"commands": [
Expand All @@ -49,33 +55,39 @@ Since the second isn't async, the third command won't execute until the second i
```

## Output of the commands

Please see the output in Output window and then switch the right side drop down to "Run On Save" to see the ouput of the commands stdout

## Commands

The following commands are exposed in the command palette:
* On Save: Enable
* On Save: Disable

- On Save: Enable
- On Save: Disable

## Placeholder Tokens

Commands support placeholders similar to tasks.json.

* ${workspaceRoot}: DEPRECATED use ${workspaceFolder} instead
* ${workspaceFolder}: the path of the workspace folder of the saved file
* ${file}: 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
* ${relativeFile} - the current opened file relative to ${workspaceFolder}
* ${cwd}: current working directory (this is the working directory that vscode is running in not the project directory)
- ~~`${workspaceRoot}`~~: DEPRECATED use `${workspaceFolder}` instead
- `${workspaceFolder}`: the path of the workspace folder of the saved file
- `${file}`: 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
- `${relativeFile}` - the current opened file relative to `${workspaceFolder}`
- `${cwd}`: current working directory (this is the working directory that vscode is running in not the project directory)

### Environment Variable Tokens

* ${env.Name}
- `${env.Name}`

## Links
* [Marketplace](https://marketplace.visualstudio.com/items/emeraldwalk.RunOnSave)
* [Source Code](https://github.com/emeraldwalk/vscode-runonsave)

- [Marketplace](https://marketplace.visualstudio.com/items/emeraldwalk.RunOnSave)
- [Source Code](https://github.com/emeraldwalk/vscode-runonsave)

## License

[Apache](https://github.com/emeraldwalk/vscode-runonsave/blob/master/LICENSE)
34 changes: 34 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';

export default [
{
files: ['**/*.ts'],
},
{
plugins: {
'@typescript-eslint': typescriptEslint,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2022,
sourceType: 'module',
},

rules: {
'@typescript-eslint/naming-convention': [
'warn',
{
selector: 'import',
format: ['camelCase', 'PascalCase'],
},
],

curly: 'warn',
eqeqeq: 'warn',
'no-throw-literal': 'warn',
semi: 'warn',
},
},
];
Loading

0 comments on commit 3908772

Please sign in to comment.