Perseus Exercise Renderer
Perseus is Khan Academy's exercise system. This repo contains the code needed to take a problem in the Perseus format and present it, allow interaction, and grade the result of a learner's work.
This repo is a constellation of sub-repos for showing exercise content. Please see individual projects in in the packages/
folder for more information about each sub-project.
To install Perseus, you need to run the following commands:
Installs project dependencies and tooling
The components and widgets of Perseus are developed using Storybook. After you clone the project and get dependencies installed, the next step is to start storybook by running yarn storybook
. This will start a server and give you a playground to use each component.
We use changesets to help manage our versioning/releases. Before pushing a new PR, add a changeset by running yarn changeset
. Commit and submit that with the PR.
If you want to use another library in Perseus, you will need up update the dependencies.
Use peerDependencies
and devDependencies
for dependencies that webapp is already using, such as
Wonder Blocks or React.
cd
into to the package in which you would like to update the dependency.
cd packages/[package-name]
// Example
cd packages/perseus-editor
- Run the following command to update the dev dependencies and the peer dependencies.
// All dependencies
yarn add --dev [dependency name]
// Include this too if webapp is using this dependency
yarn add --peer [dependency name]
// Example
yarn add --dev @khanacademy/wonder-blocks-button
yarn add --peer @khanacademy/wonder-blocks-button
The Perseus project is not accepting external contributions. We’re releasing the code for others to refer to and learn from, but we are not open to pull requests or issues at this time.
For a slightly more detailed overview, see the "Shipping a Change to Perseus" document in Confluence.
Perseus is a monorepo - a single repository that ships multiple npm packages. Generally you can treat Perseus as a single code base; things should generally just work as you expect them to during the development process. We use scripts and a tool called changesets to keep package inter-dependencies organized, release the one repo to multiple npm packages, and version changes appropriately.
-
git checkout main; git pull
-
git checkout -b [FEATURE_BRANCH_NAME]
-
☢️ We don’t use deploy branches in Perseus
-
Start a dev server
a.
yarn start
will start Storybook on localhost:6006b.
yarn dev
will start the custom Dev UI on localhost:5173 -
Do stuff
-
yarn test
will run Jest/RTL tests;yarn cypress
will run Cypress tests -
yarn changeset
will walk you through creating a changeset (we generally stick to semver) -
☢️ Empty changesets should be considered an exception to the rule and should generally be avoided
-
git add
andgit commit
-
git pull-request
will walk you through creating a pull request
- When you create/update a PR, we run a series of checks against your code
- Gerald requests reviewers (there’s a “perseus” user group that primary maintainers are in)
- Linting/Types/Tests; checks to make sure code is properly covered
- Check for a changeset
- 🍀 A snapshot release is made and can be used to check changes before merging/releasing
- Once checks pass and code is approved, land your changes into
main
usinggit land
- 🚨
main
should always be releasable! Don’t land code to main that you’re not ready to ship! - 🍀 Use stacked feature branches if you’re working on a big change that depends on multiple PRs
- Landing changes to
main
creates/updates a “Version Packages” PR - To cut a Perseus release, approve and land the “Version Packages” PR
(typically with
git land
) - ☢️ If the CI/CD checks aren’t running, you might need to close and reopen the PR
- After the release script runs, you should see the new releases on the release page
- We use
v8
to track Jest coverage. There's some old legacy code that we don't want coverage for, so we ignore that withc8 ignore
. It might look likec8
isn't be used, but it's used by thev8
coverageProvider
(defined in config/test/test.config.js).