Skip to content

Commit fca8a69

Browse files
committed
Update documentation further
1 parent 6ddcd6a commit fca8a69

File tree

7 files changed

+51
-4
lines changed

7 files changed

+51
-4
lines changed

docs/src/repotools/docserver/1-overview.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,11 @@ this
9191
```
9292

9393
are generated via their own markdown plugin, the details of which can be found [here](./2-dirtree).
94+
95+
## Production Build and Dead Links
96+
97+
The preview version of the docs rendered by Vitepress when the `vitepress dev` command is executed is not the final version that is intended to be displayed.
98+
For this, Vitepress provides the `vitepress build` command, which converts the documentation source into its final, minified HTML form.
99+
100+
As part of this process, Vitepress will highlight any "dead" links (i.e links that don't point to anything) and will fail if it finds any. If you're editing
101+
the documentation, you should run the build command to check for the dead links before pushing to the repository.

docs/src/repotools/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ Below is a list of other tools:
99
- [ESLint](./linting)
1010
- [Github Workflows](./workflows/index)
1111
- [VSCode](./vscode)
12+
- [Vitest Reporters](./reporters)
1213
- [Yarn](./yarn)
14+
15+
You may also want to refer to the Source Academy wide developer conventions which can be found [here](https://github.com/source-academy/general/wiki/Conventions-and-practices).

docs/src/repotools/reporters.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Vitest Reporters
2+
3+
The `@sourceacademy/vitest-reporter` package contains 2 reporters designed to work with Vitest. One is a reporter
4+
for the test results as produced by Vitest.
5+
6+
The other is a test coverage reporter. Vitest internally uses the Istanbul reporter interface, which as of the time of writing
7+
seems to only be available in CommonJS format. Thus, this reporter has to be written and built for the CJS format.
8+
9+
Both reporters write their output to the Github Actions summary, which is as simple as opening the file specified by the
10+
`GITHUB_STEP_SUMMARY` environment available in **append** mode and then writing to it.
11+
12+
If the reporters aren't running in the Github Actions environment, `GITHUB_STEP_SUMMARY` won't be defined and neither
13+
reporter will produce any output.
14+
15+
Unlike the other packages in this repository, the transpiled version of both reporters is committed to Github and the
16+
reporters are referenced using their local paths by Vitest configurations.
17+
Otherwise, every other package in this repository will have to add the `@sourceacademy/vitest-reporter` as a (dev) dependency.

docs/src/repotools/workflows/3-workflows.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ These Git Hooks are powered by [`husky`](https://github.com/typicode/husky).
1717
## Deployment to Github Pages
1818

1919
Upon any successful merge into `master`, this action runs to deploy the modules site onto Github pages to automatically serve the default modules and their documentation.
20-
21-
Its configuration is shown below:

docs/src/repotools/yarn.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ For example, the root package specifies `react@^18.3.1` as a depdendency, so all
3232

3333
This validation is not carried out across child workspaces, however. Two different bundles could use two different versions of the same package. This should not cause an issue **unless** the bundles are somehow dependendent on each other.
3434

35+
Furthermore, if you are depending on a package from within the modules repository, you should be using the `workspace:^` version specification as the packages within this repository
36+
are not intended to be published to NPM so a regular version specification would be invalid.
37+
38+
### 3. `js-slang` has no resolution override
39+
40+
Yarn allows users to override the resolution of packages via the [`resolutions`](https://yarnpkg.com/configuration/manifest#resolutions) field. There are several reasons to do this,
41+
but the most common reason a resolution would be used in this repository would be to point Yarn to a local copy of `js-slang`.
42+
43+
Of course, the final production versions of your code shouldn't be relying on a local copy of `js-slang` (that wouldn't exist anyway), so the constraint is enforced here to
44+
make sure that `js-slang` isn't incorrectly resolved.
45+
46+
### 4. `repotools` doesn't have another local dependency
47+
48+
The `repotools` package is designed to be the 'root' for all the tooling in the repository. If it were to depend on another package within this repository, we would create
49+
a dependency loop that Yarn would not be able to resolve. So we enforce the constraint that the `@sourceacademy/modules-repotools` package is not allowed to depend on any
50+
other package within this repository.
51+
3552
## Parallel Execution of Scripts
3653

3754
Using the various options of the `yarn workspaces foreach` command, you can execute multiple tasks in parallel, which is how many of the commands in the root repository have been set up.

lib/vitest-reporter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sourceacademy/vitest-reporter",
3-
"description": "A Vitest coverage reporter designed to work with Github Actions",
3+
"description": "Vitest test and coverage reporters designed to work with Github Actions",
44
"version": "1.0.0",
55
"type": "module",
66
"dependencies": {

yarn.config.cjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ module.exports = defineConfig({
3131
for (const dep of Yarn.dependencies()) {
3232
// Dependencies that are from this repository should use
3333
// the correct version
34-
if (dep.ident.startsWith('@sourceacademy')) {
34+
if (
35+
dep.ident.startsWith('@sourceacademy/modules') ||
36+
dep.ident.startsWith('@sourceacademy/bundle') ||
37+
dep.ident.startsWith('@sourceacademy/tab')
38+
) {
3539
dep.update('workspace:^');
3640
}
3741
}

0 commit comments

Comments
 (0)