Foam is open to contributions of any kind, including but not limited to code, documentation, ideas, and feedback. This guide aims to help guide new and seasoned contributors getting around the Foam codebase. For a comprehensive guide about contributing to open-source projects in general, see here.
Before you start contributing we recommend that you read the following links:
We understand that diving in an unfamiliar codebase may seem scary, to make it easier for new contributors we provide some resources:
You can also see existing issues and help out! Finally, the easiest way to help, is to use it and provide feedback by submitting issues or participating in the Foam Community Discord!
If you’re interested in contributing, this short guide will help you get things set up locally (assuming node.js >= v16 and yarn are already installed on your system).
Clone your newly forked repo locally:
git clone https://github.com/your_username/foam.git
Install the necessary dependencies by running this command from the root of the cloned repository:
yarn install
From the repository root, run the command:
yarn build
You should now be ready to start working!
Foam code and documentation live in the monorepo at foambubble/foam.
Exceptions to the monorepo are:
This project uses Yarn workspaces.
Originally Foam had:
To improve DX we have moved the foam-core
module into packages/foam-vscode/src/core
, but from a development point of view it’s useful to think of the foam-vscode/src/core
“submodule” as something that might be extracted in the future.
For all intents and purposes this means two things:
foam-vscode/src/core
should depend on files outside of this directoryfoam-vscode/src/core
should NOT depend on vscode
libraryWe have kept the yarn workspace for the time being as we might use it to pull out foam-core
in the future, or we might need it for other packages that the VS Code plugin could depend upon (e.g. currently the graph visualization is inside the module, but it might be pulled out if its complexity increases).
Code needs to come with tests. We use the following convention in Foam:
*.test.ts
are unit tests*.spec.ts
are integration testsTests live alongside the code in src
.
This guide assumes you read the previous instructions and you’re set up to work on Foam.
Now we’ll use the launch configuration defined at .vscode/launch.json
to start a new extension host of VS Code. Open the “Run and Debug” Activity (the icon with the bug on the far left) and select “Run VSCode Extension” in the pop-up menu. Now hit F5 or click the green arrow “play” button to fire up a new copy of VS Code with your extension installed.
In the new extension host of VS Code that launched, open a Foam workspace (e.g. your personal one, or a test-specific one created from foam-template). This is strictly not necessary, but the extension won’t auto-run unless it’s in a workspace with a .vscode/foam.json
file.
Test a command to make sure it’s working as expected. Open the Command Palette (Ctrl/Cmd + Shift + P) and select “Foam: Update Markdown Reference List”. If you see no errors, it’s good to go!
After you have made your changes to your copy of the project, it is time to try and merge those changes into the public community project.
Feel free to modify and submit a PR if this guide is out-of-date or contains errors!