Package Exports
- folder-monkey
- folder-monkey/template/build.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (folder-monkey) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
🐒 FolderMonkey
FolderMonkey is a Chrome extension for developers that lets you inject JavaScript into any website — like TamperMonkey, but with proper folder structure and ES module support. Scripts live in src/scripts/, are built via npm run build, and automatically sync into the extension.
Why FolderMonkey instead of TamperMonkey?
- 📁 Organize scripts in folders instead of single giant files
- 📦 Use ES module
import/exportacross multiple files - ⚡
npm run buildinstantly syncs your code into the extension
Installation
- Create a new empty folder for your workspace:
mkdir my-scripts-workspace cd my-scripts-workspace
- Initialize FolderMonkey (this will scaffold the required files):
npx folder-monkey init
- Install the required build tools:
npm install
- Build the extension or start hot-reloading development mode:
- For a single build:
npm run build - For automatic hot-reloading (recommended for development):
npm run watch
- For a single build:
- Open Chrome and go to
chrome://extensions/ - Enable Developer mode (top right corner)
- Click Load unpacked and select the
dist/folder
How to Create a New Script
Create a new folder inside
src/scripts/(e.g.,src/scripts/my-feature/)Add a
config.jsonto define on which sites the script runs:{ "matches": ["*://*.github.com/*", "https://stackoverflow.com/*"] }
Add an
index.jsas the entry point:import { doSomething } from "./helpers.js"; console.log("My feature is running!"); doSomething();
Add any helper files you want to import, e.g.
helpers.js:export function doSomething() { document.body.style.backgroundColor = "lightblue"; }
Run
npm run build(or havenpm run watchrunning) — done.If using
watchthe extension will build and reload itself automatically. The active tab remains untouched to prevent data loss – reload the page manually (F5) to see the new script output.
Using NPM Packages
You can use external NPM packages directly inside your script folders! FolderMonkey's bundler handles them automatically.
- Navigate to your script folder (e.g.,
cd src/scripts/my-feature/) - Initialize and install your package:
npm init -y npm install lodash
- Import it in your code as usual:
import _ from 'lodash'; console.log(_.kebabCase("Hello World"));
Using with AI Coding Agents
Want an AI agent to write your script? Copy the prompt from AGENT_PROMPT.md and send it to your agent before you start. It will know exactly how to structure the files.
Folder Structure
src/
├── scripts/ ← Your script folders go here
│ └── my-feature/
│ ├── config.json
│ ├── index.js
│ └── helpers.js
├── manifest-base.json
└── popup/ ← Extension popup UI
build.js ← Build script
dist/ ← Generated extension (do not edit)License
MIT