In this section you can provide some details about the Amplenote plugin that this repo will implement.
- Clone this repo.
git clone [email protected]:alloy-org/plugin-template.git
- Copy its contents to a directory with the name of your plugin.
cp -r plugin-template my-cool-plugin
cd my-cool-plugin
- Install node and npm with your package manager of choice.
brew install node
orapt install nodejs
- Run
npm install
to install the packages (jest, fetch (for Jest)). - Set up your repo as the remote origin.
git remote set-url origin [email protected]:my-org/my-cool-plugin.git
- Push your repo to GitHub.
git push
- 🎉 Optional
- If you are going to use any secret keys, put them in
.env.example
, then copy that to.env
and fill in whatever environment variables you need
Run NODE_OPTIONS=--experimental-vm-modules npm test
to run the tests.
If it complains about jsdom being absent, run npm install -D jest-environment-jsdom
and try again.
If you are using a JetBrains IDE (Webstorm, Rubymine, anything that speaks Javascript), you can get an excellent debugging environment to run your tests.
Read how to set up tests with this environment in JetBrains IDEs.
NODE_OPTIONS=--experimental-vm-modules npm run test -- --watch
- https://esbuild.github.io/getting-started/#your-first-bundle
- https://jestjs.io/
- https://www.gitclear.com
Once your plugin is ready to test within Amplenote, you can build and test it within Amplenote by following these steps:
- Create a note for your plugin, if you haven't already. It needs to have at least a) settings table and b) code block. More details on a valid plugin note are in the Guide to Building Plugins
- Install the Github Developers Plugin.
- Compile your plugin using
npm run build
ornode esbuild.js
from the root folder for your project - Commit the resulting file (default location:
build/compiled.js
) to your git repo (e.g.,git add build/compiled.js && git commit -m "Compiled plugin"
) - Push your changes to GitHub (
git push
) - Choose "Github Plugin Builder: Refresh" from the note options menu in your plugin note