You'll need Git and Node.js before you can get started, so install them if you don't have them already.
To get the code, use Git to clone the SmilesDrawer repository from GitHub. If you're planning to contribute code to the official repo, fork the repo on GitHub and clone your fork instead.
Then go into the directory that was just created and install all the development dependencies with NPM (which comes as part of Node.js):
npm installYou'll need to run this command again if the dependencies get updated (these are
listed in package.json).
SmilesDrawer "compiles" to a JavaScript bundle, which can be found in the dist
folder.
When doing development work on SmilesDrawer, you'll use a special bundle called
dist/smiles-drawer.dev.js. This file isn't checked into Git, but it is used by
all the HTML files in the test directory. To (re)create it, run:
npm run buildTo have the build system watch for changes in the background and rebuild the dev
bundle whenever you save a file, run watch instead:
npm run watchTo use your custom version of SmilesDrawer, copy dist/smiles-drawer.dev.js out
to wherever you need it. Alternatively, you can use npm run minify to build a
minified version at dist/smiles-drawer.dev.min.js.
There are some visual tests in the test/visual folder. These aren't automated
at the moment, but you can open them in your browser and inspect them visually.
Each test should have a description of the expected behaviour, and an indication
of whether or not it has been passing historically.
There are also automated tests. To run these, run:
npm run testIf you contribute a new feature, please add tests for it as well!
The best way to contribute to SmilesDrawer is to make a pull request to the repo on GitHub. If you're making a big change or adding a feature, it's a good idea to open a GitHub issue first to ask for feedback.
Note: Code cleanup is still in progress, so expect to see some errors for now!
Your code should pass all automated quality checks before it can be merged. You can run these locally via NPM:
npm run typecheck
npm run lintThe code should have no type errors and no lint errors. Lint warnings are okay, though fewer is obviously better. Some warnings will be upgraded to errors as we make progress on cleaning up the code.
Regular contributors should not do this! This is for the maintainers to do when they decide it's time to release a new version of SmilesDrawer.
- Make a new branch to contain your version update.
- Update the version number in
package.jsonandapp.js. It may also appear inREADME.mdor other documentation. Usegrepwith the-r(recursive) flag to make sure you've found them all. - Rebuild the official bundles by running
npm run release. - Commit your changes and push them to GitHub. Make a pull request.
- Once the pull request is merged, create a "release" on GitHub. Tag the latest
commit (the one that was created by the merge) as
vX.Y.Z, whereX,Y, andZare the major, minor, and patch version numbers (e.g.v1.2.3). - Publish the package to NPM. This is currently blocked, but should be handled automatically once GitHub Actions is set up correctly.