You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiling the build tools is as simple as running `yarn build`. This by default produces a minified Javascript file, which is not very conducive to debugging. If necessary
18
18
you can run `yarn build --dev` instead to produce a non-minified build.
19
19
20
-
For the projects that are supposed to be bundled into a single file using `esbuild`, the package `@sourceacademy/lib-compiler` wraps `esbuild` and `commander` to create a
21
-
easy to use compiler.
20
+
For the projects that are supposed to be bundled into a single file using `esbuild`, the package `@sourceacademy/modules-repotools` exports a function that
21
+
wraps `esbuild` and `commander` to create a easy to use compiler.
Copy file name to clipboardExpand all lines: docs/src/modules/1-getting-started/2-start.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,17 @@ This may prompt you to download the version of Yarn that this repository uses.
25
25
>
26
26
> `corepack enable` should automatically install the version of Yarn used by the repository, but if you face issues using `corepack`, you can still use `npm` to install Yarn. You will however, need to run
27
27
> `yarn set version` to change to the correct version of Yarn before working with the repository.
28
+
>
29
+
> If that is the case, you must take care **not** to commit the `yarnPath` changes that will be made to the `.yarnrc.yml` file.
30
+
31
+
## 4. Install the root package's dependencies
32
+
33
+
Run the following command to ensure that dependencies like `eslint` get installed correctly:
34
+
```sh
35
+
yarn workspaces focus @sourceacademy/modules
36
+
```
28
37
29
-
At this point it is not necessary to run `yarn install` yet to install dependencies. Depending on what you are doing, there are different methods for installing dependencies.
38
+
At this point it is not necessary to run `yarn install` yet to install any other dependencies. Depending on what you are doing, there are different methods for installing dependencies.
Copy file name to clipboardExpand all lines: docs/src/modules/1-getting-started/6-troubleshooting.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,11 @@ You will need to delete the `node_modules` folder and rerun your installation co
17
17
Especially if you've worked with other Javascript/Typescript projects before, you might find that `corepack enable` is a command that
18
18
does not seem to work (or work permanently) for you.
19
19
20
+
For example, you might find that `corepack enable` has no effect and the version of Yarn being used is an incorrect version when you run commands.
21
+
20
22
Things to check for:
21
23
22
24
- Remove any errant `package.json` or `.yarnrc.yml` files in places like your home directory or elsewhere.
23
-
- Run `npm uninstall -g yarn` if you previously installed Yarn using installed `npm`.
24
-
- For people running Windows, `corepack enable` is a command that needs to be run using administrator privileges. If this is not possible for you, there are [workarounds](https://github.com/nodejs/corepack?tab=readme-ov-file#corepack-enable--name).
25
+
- Run `npm uninstall -g yarn` if you previously installed Yarn globally using installed `npm`.
26
+
- For people running Windows, `corepack enable` is a command that needs to be run using administrator privileges.
27
+
If this is not possible for you, there are [workarounds](https://github.com/nodejs/corepack?tab=readme-ov-file#corepack-enable--name).
Copy file name to clipboardExpand all lines: docs/src/modules/3-tabs/3-editing.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,17 @@ This adds the dependency to `devDependencies` instead.
47
47
> yarn add @sourceacademy/modules-lib@workspace:^
48
48
>```
49
49
50
+
You can also add the dependency directly by modifying your `package.json`:
51
+
```jsonc {4}
52
+
{
53
+
"name": "@sourceacademy/bundle-bundle0",
54
+
"dependencies": {
55
+
"lodash": "^4.0.0"
56
+
}
57
+
}
58
+
```
59
+
If you do so, remember to run your installation command (same as the one above) to update the lockfile.
60
+
50
61
## React/UI Components
51
62
52
63
Tabs are written using the React (JSX) syntax. In React, each UI element is referred to as a "component". Documentation on how to create UIs and use React can be found [here](https://react.dev). Where possible,
It is possible to run `js-slang` directly from the desktop using the `js-slang` command line. However, this is only really useful for bundles, as `js-slang` from
4
+
the command line cannot display tabs.
5
+
6
+
You will need to change which module backend is in use using the `--modulesBackend` parameter.
7
+
8
+
If your package already depends on `js-slang`, then you can already run `js-slang` from the command line using `yarn js-slang`.
9
+
10
+
If not, you can either add `js-slang` to your dev dependencies, or you can install the root repository package.
11
+
12
+
## The Modules Server
13
+
14
+
All modules related files are served from a single HTTP server. For `js-slang` to be able to access your local modules copies, you will have to run a local version
15
+
of this server and then point `js-slang` to it.
16
+
17
+
The `yarn buildtools serve` command will start a HTTP server and serve the `build` directory, which is where your bundle/tab should've been output to after compilation.
18
+
19
+
If need be, you can use the `--port` option or the `PORT` environment variable to change what port the server listens on, the default being 8022.
20
+
21
+
Similarly, `--bind` can be used to change which interface the server listens on.
22
+
23
+
> [!WARNING] On Focused Installs
24
+
> The HTTP server is provided by the buildtools and thus is only available within packages that have installed the buildtools. If you used
25
+
> a focused Yarn install, then the `serve` command is only available within your bundle's/tab's package.
26
+
>
27
+
> Using a focused install also means that other bundles and tabs are not available for use during your testing, as they will not be compiled.
28
+
>
29
+
> If the `serve` command is unavailable for whatever reason, you can install it with the root repository using
30
+
> `yarn workspaces focus @sourceacademy/modules` and then run `yarn serve` from the root repository.
0 commit comments