Transform config file to userscript metablock and append on
npm install rollup-plugin-userscript-metablockTransform json file to userscript metablock and append on.
Metakeys documents:
- Tampermonkey
- Greasemonkey
- Violentmonkey
- GreasyFork
``sh`
npm install --save-dev rollup-plugin-userscript-metablock
simplest
`js
import metablock from 'rollup-plugin-userscript-metablock';
export default {
input: 'main.js',
output: {
file: 'bundle.user.js',
format: 'esm'
},
plugins: [metablock()],
};
`
common
`js
import metablock from 'rollup-plugin-userscript-metablock';
const pkg = require('package.json');
export default {
input: 'main.js',
output: {
file: 'bundle.user.js',
format: 'esm'
},
plugins: [metablock({
file: './meta.json',
override: {
name: pkg.name,
version: pkg.version,
description: pkg.description,
homepage: pkg.homepage,
author: pkg.author,
license: pkg.license,
}
})],
};
`
You can find the options detail here, and meta details here.
1. If no grant, use @grant none explicitly@grant none
- Greasemonkey treat no set as . RefGM_info
- Tampermonkey treat no set as grant you use but some need declare explicitly. Ref
- Both can use info ( / GM.info`) without grant
- Idea: Maybe add a todo that inspect code to auto generate grant
MIT