Build and Preview
This page starts from a Makoo project that already runs, produces an installable userscript, and checks the build result on a real target page.
Build Script
pnpm buildThe project script should run makoo build. TypeScript projects generated by the scaffold run a type check first (vue-tsc -b or tsc -b), and no script is produced when there are type errors.
The scaffold configures Vue or React as an external dependency by default: the build output loads the framework from a CDN through @require, while development uses the locally installed version; see External Dependencies and Permissions.
The output directory is controlled by Vite's build.outDir, usually dist when not configured; the script file name defaults to ${app.name}.user.js and can be set with monkey.build.fileName.
For example, app.name: 'my-script' corresponds to dist/my-script.user.js. A .meta.js is produced alongside only when generating a metadata file is configured.
Check the Metadata
Open the userscript metadata at the top of the output and confirm that:
@nameand@versionare as expected.@matchcovers the pages actually used.@grant,@connect,@require, and@resourcematch the capabilities used.
For what the configuration means, see Project Configuration. Treat the actual output as the source of truth for inferred permissions: the development script declares @grant *, so GM APIs that work during development may be missing their corresponding @grant in the output.
Preview and Install
pnpm previewmakoo preview starts a preview server for the build directory, using the output produced in the previous step. Open the printed address: when there is only one .user.js, the page redirects straight to it and the script manager shows the install prompt; when there are several, the page lists all scripts to choose from. After installing, visit a matching page to verify the feature.
When testing the release script, first disable the development script with the same features in the manager, so the two scripts don't mount twice. The release output doesn't depend on the local dev server.
Custom Directories and Debug Builds
pnpm exec makoo build --outDir release
pnpm exec makoo preview --outDir releasebuild and preview should use the same output directory. If you only changed source code without rebuilding, preview still shows the previous output.
The output's JS is not minified by default, so you can read it directly when investigating problems that only appear after building. Source maps are always disabled by vite-plugin-monkey and --sourcemap has no effect; when you need smaller output, enable minification with --minify:
pnpm exec makoo build --minifyFor all arguments, see CLI Commands.
Distribution
Provide the built .user.js to users for installation. When distributing through a website, users can open the .user.js link and install it in their script manager.