@makoojs/cli
v0.5.1
Published
CLI and Vite integration for the Makoo userscript development framework
Readme
@makoojs/cli
The toolchain package for Makoo. It provides two Vite plugins, makoo() and makooDev(), the makoo dev / build / preview commands, and @makoojs/cli/monkey for calling GM APIs from your script. Userscript metadata, the dev server, and builds are handled by vite-plugin-monkey.
Installation
pnpm add -D @makoojs/cli vite[!TIP] Projects created with
pnpm dlx @makoojs/create-makooalready have it configured; no separate installation is needed.
Usage
Configure Vite
// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { makoo, makooDev } from '@makoojs/cli';
export default defineConfig({
plugins: [
vue(),
makoo({
entry: './src/main.ts',
app: { name: 'my-script', version: '0.0.1' },
monkey: { userscript: { match: ['https://example.com/*'] } }
}),
// optional: view injection status in the dev terminal
makooDev()
]
});Develop and Build
makoo dev # start the dev server; install the dev script from the printed address
makoo build # build the .user.js
makoo preview # preview the build outputCall GM APIs
Import by capability in browser code, and the build only generates @grant for the APIs you use:
import { gmStorage } from '@makoojs/cli/monkey';
const runs = gmStorage.get<number>('runs', 0) + 1;
gmStorage.set('runs', runs);Documentation
- Vite Plugins: all
makoo()options, defaults, andmakooDev(). - CLI Commands: options for each command.
- Userscript API: the GM APIs exported by
@makoojs/cli/monkey. - Project Configuration: configuring match URLs, permissions, and external dependencies.
