Skip to content

Commit 1ebe352

Browse files
committed
yippee
1 parent 8947dd7 commit 1ebe352

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

.github/workflows/pull-request.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ jobs:
8383
if: needs.paths-filter.outputs.libraries == 'true'
8484
run: yarn workspaces foreach -ptW --from "./lib/*" run tsc
8585

86+
- name: Run build for libraries
87+
run: yarn workspaces foreach -ptW --from "./lib/*" run build
88+
8689
- name: Run test for libraries
8790
if: needs.paths-filter.outputs.libraries == 'true'
8891
run: yarn test:libs

docs/src/buildtools/3-structure.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# General Design of the Build Tools
22

33
## Path Resolution
4-
The build tools are designed to be written in Typescript, then compiled and bundled by `esbuild` into a single minified Javascript file `bin/index.js`. This means relative paths used during runtime need to be written in such a way that they account for the path of the executable file.
4+
The build tools are designed to be written in Typescript, then compiled and bundled by `esbuild` into a single minified Javascript file `dist/index.js`. This means relative paths used during runtime need to be written in such a way that they account for the path of the executable file.
55

6-
For example, the template script needs to copy the templates from the `bin/templates` folder. So the call to `fs.cp` is written relative to `import.meta.dirname` instead of
6+
For example, the template script needs to copy the templates from the `dist/templates` folder. So the call to `fs.cp` is written relative to `import.meta.dirname` instead of
77
hardcoding a relative path:
88

99
```ts
1010
// lib/buildtools/src/templates/bundle.ts
1111
await fs.cp(`${import.meta.dirname}/templates/bundle`, bundleDestination, { recursive: true });
1212
```
1313

14-
When `bin/index.js` is executed, `import.meta.dirname` refers to `lib/buildtools/bin`, so the above path becomes `lib/buildtools/bin/templates/bundle`, which is the actual location of where the template files are located.
14+
When `dist/index.js` is executed, `import.meta.dirname` refers to `lib/buildtools/dist`, so the above path becomes `lib/buildtools/dist/templates/bundle`, which is the actual location of where the template files are located.
1515

1616
On the other hand, relative module imports that are bundled during the compilation process don't need to be changed. The template script imports the root package json to
1717
determine the versions of dependencies to use:
@@ -25,7 +25,7 @@ const { dependencies: { typescript: typescriptVersion } } = _package
2525
```
2626

2727
Although the resolved module path refers to a path outside of the buildtools folder, during compilation, `esbuild` actually
28-
embeds the entire JSON file into `bin/index.js`, thus removing the import altogether:
28+
embeds the entire JSON file into `dist/index.js`, thus removing the import altogether:
2929

3030
```ts
3131
// ../../package.json
@@ -68,14 +68,6 @@ function rawGetGitRoot() {
6868
```
6969
This is guaranteed to work, since the user should have Git present on their system (otherwise how did they get this git repo?)
7070

71-
Since the path of the git repository shouldn't be changing during execution of the buildtools, we use `lodash`'s [`memoize`](https://lodash.com/docs/4.17.15#memoize) to eliminate unnecessary calls to Git:
72-
```ts
73-
/**
74-
* Get the path to the root of the git repository
75-
*/
76-
export const getGitRoot = memoize(rawGetGitRoot);
77-
```
78-
7971
By abstracting this functionality into a separate module, it is simple to change the paths at which everything is defined (such as where the directory containing bundles is found). In particular,
8072
by mocking this module, we can run the buildtools on mock bundles and tabs with ease.
8173

docs/src/repotools/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Repository Development Tools
22

3+
The `@sourceacademy/modules-repotools` package itself has a bunch of utilities for working with the repository.
4+
5+
Below is a list of other tools:
36
- [Development Server](./devserver/devserver)
47
- [Docs Server](./docserver/1-overview)
58
- [ESLint](./linting)

0 commit comments

Comments
 (0)