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
Copy file name to clipboardExpand all lines: docs/src/buildtools/6-prebuild.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,11 @@ errors always cause a non-zero exit code.
18
18
ESLint provides several [formatters](https://eslint.org/docs/latest/use/formatters/) for processing the results objects it returns. To produce the human readable output that is printed to the command line, the `stylish` formatter
19
19
is loaded and used.
20
20
21
+
::: details Inspecting the Linting Config
22
+
The entire repository's linting configuration is located at the root of the repository within `eslint.config.js`. If you want to view the view what rules are being applied to which files you can
23
+
use the config inspector, which can be started using `yarn lint:inspect`
24
+
:::
25
+
21
26
## Calling Typescript from Node
22
27
23
28
Most of the code for running Typescript functionality from Node was taken from [this](https://github.com/Microsoft/TypeScript/issues/6387) Github issue.
@@ -39,7 +44,7 @@ The first three steps in the process involve reading the raw text from the `tsco
39
44
in use, as well as the file paths to the files that are to be processed.
40
45
41
46
### Type Checking
42
-
The first time`ts.createProgram` is called, it is called with every single file as returned from `ts.parseJsonConfigFileContent`. However, it is called with `noEmit: true`. This prevents any Javascript and Typescript declaration files from being written.
47
+
At step 4,`ts.createProgram` is called for the first time. It is called with every single file as returned from `ts.parseJsonConfigFileContent`. However, it is called with `noEmit: true`. This prevents any Javascript and Typescript declaration files from being written.
43
48
This is important because we want test files to be type checked, but we don't want them to be compiled into Javascript and exported with the rest of the code. If they were included and the `tsconfig` was configured to produce outputs, the test files would end
44
49
up being written to the `outDir`. `typecheckProgram.emit` is called to perform the type checking.
@@ -80,6 +140,12 @@ These commands should only be run from the root of the Git repository.
80
140
Yarn considers scripts with a ":" in their name to be a [global script](https://yarnpkg.com/features/workspaces#global-scripts) that can be run from anywhere,
81
141
including child workspaces. In other words, these commands are available throughout the repository, not just at the root level.
82
142
143
+
In general, global scripts for this repository follow the same format.
144
+
-`:all` will be run for all code in the respository
145
+
-`:devserver` will only be run for the devserver.
146
+
-`:libs` will be run for all code under the `lib` folder (common modules libraries)
147
+
-`:modules` will be run for all bundle and tab code
148
+
83
149
<table>
84
150
<thead>
85
151
<tr>
@@ -88,17 +154,9 @@ including child workspaces. In other words, these commands are available through
Copy file name to clipboardExpand all lines: docs/src/modules/2-bundle/1-overview/1-overview.md
+20-10Lines changed: 20 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,14 +8,16 @@ For example, the `binary_tree` module may want to provide an abstraction for Sou
8
8
9
9
The typical bundle structure for a bundle is shown below. Each section will have its own explanation.
10
10
```txt
11
-
bundle_name // Name of the root folder is the name of the bundle
11
+
bundle_name // Name of the root folder is the name of the bundle
12
12
├── src
13
-
│ ├── index.ts // Entry Point
14
-
│ ├── functions.ts // Example file
15
-
│ └── .... // Other files your bundle may use
16
-
├── package.json // Package Manifest
17
-
├── manifest.json // Bundle Manifest
18
-
└── tsconfig.json // Typescript Configuration
13
+
│ ├── __tests__ // Folder containing unit tests
14
+
│ │ └── index.ts // File containing unit tests
15
+
│ ├── index.ts // Entry Point
16
+
│ ├── functions.ts // Example file
17
+
│ └── .... // Other files your bundle may use
18
+
├── package.json // Package Manifest
19
+
├── manifest.json // Bundle Manifest
20
+
└── tsconfig.json // Typescript Configuration
19
21
```
20
22
21
23
> [!NOTE]
@@ -95,8 +97,16 @@ The `package.json` file follows the same format as your typical `package.json` u
95
97
```
96
98
You can find more information about each of the fields and what they mean [here](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#devdependencies).
97
99
98
-
> [!WARNING]
99
-
> The `name` field must follow the format `@sourceacademy/bundle-[your bundle name]`.
100
+
> [!WARNING] Bundle vs Package Name
101
+
> The `name` field in `package.json` is the package name and must follow the format `@sourceacademy/bundle-[your bundle name]`.
102
+
> The bundle name is what users will actually use to import your bundle from within Source code:
103
+
> ```ts
104
+
>import { whatever } from'bundle_name';
105
+
>```
106
+
> However, if people consuming your bundle from regular Javascript and Typescript need to use the full (scoped) package name:
0 commit comments