Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicolaspadari/macbar
Put your npm scripts in the Macbook touchbar
https://github.com/nicolaspadari/macbar
macbook touchbar vscode-extension
Last synced: about 2 months ago
JSON representation
Put your npm scripts in the Macbook touchbar
- Host: GitHub
- URL: https://github.com/nicolaspadari/macbar
- Owner: NicolaSpadari
- License: mit
- Created: 2024-07-13T12:12:04.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-11-12T13:41:23.000Z (2 months ago)
- Last Synced: 2024-12-09T03:48:58.405Z (about 2 months ago)
- Topics: macbook, touchbar, vscode-extension
- Language: TypeScript
- Homepage:
- Size: 136 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
MacBar
Put your npm scripts in the Macbook touchbar
## About
VSCode has support for the Macbook touchbar, but doens't actually do anything useful with it.
With this extension, it will add available scripts from the `package.json` to it when you open a projects that has a package file.
The only catch is that commands have to be predefined in the manifest of the extension, so it cannot be as dynamic as I wish. The solution is list a possible set of scripts and if your package has them, conditionally show the button that runs the script.
Package manager in commands (`nr`) is handled by [@antfu/ni](https://github.com/antfu/ni)## Build your own:
Clone to local:
```sh
$ npx degit NicolaSpadari/macbar my-macbar
```Install dependencies:
```sh
$ pnpm install
```Edit the list of scripts:
```json
// package.json// ...
"contributes": {
"commands": [
{
"command": "macbar.lint",
"title": "Lint",
"shortTitle": "nr lint"
},
{
"command": "macbar.dev",
"title": "Dev",
"shortTitle": "nr dev"
},
// ...
],
"menus": {
"touchBar": [
{
"command": "macbar.lint",
"group": "scripts",
"when": "macbar.lintExists"
},
{
"command": "macbar.dev",
"group": "scripts",
"when": "macbar.devExists"
},
// ...
]
}
},
// ...
```Notes:
- `shortTitle` here is used as a field for the command itself
- `macbar.` **must** match the script name (eg: "dev")Build the extension:
```sh
$ pnpm run generate
```Install the generated `.vsix` file that will appear in the root of your project