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: README.md
+40-16Lines changed: 40 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,7 @@ This repository contains solutions and a local development environment for the [
41
41
-[Usage](#-usage)
42
42
-[Alternate Usage](#-alternate-usage)
43
43
-[Available Scripts](#-available-scripts)
44
+
-[Docker Scripts](#-docker-scripts)
44
45
45
46
</details>
46
47
@@ -129,33 +130,33 @@ Using Node
129
130
130
131
Using Docker
131
132
132
-
- Build the image
133
+
-**Build the image**
133
134
```
134
135
docker compose -f docker-compose.dev.yml build
135
136
```
136
137
137
-
- Transpile the TypeScript files to JavaScript (PowerShell)
138
+
-**Transpile the TypeScript files to JavaScript** (PowerShell)
138
139
```
139
140
docker run -it -v ${pwd}:/opt/app -v /opt/app/node_modules --rm weaponsforge/adventofcode:dev npm run transpile
140
141
```
141
142
142
-
- Run tests (PowerShell)
143
+
-**Run tests** (PowerShell)
143
144
```
144
145
docker run -it -v ${pwd}:/opt/app -v /opt/app/node_modules --rm weaponsforge/adventofcode:dev npm test
145
146
```
146
147
147
-
- Watch TS file updates: Use available scripts - `npm run watch`, `npm run watch:docker:win`
148
+
-**Watch TS file updates: Use available scripts** - e.g., `npm run watch`, `npm run docker:watch:win`
148
149
```
149
150
docker run -it -v ${pwd}:/opt/app -v /opt/app/node_modules --rm weaponsforge/adventofcode:dev <AVAILABLE_SCRIPT>
150
151
```
151
152
152
-
- Run a script and debug it with the VSCode Debugger.
153
+
-**Run a script and debug it with the VSCode Debugger**
153
154
- Prepare a function for debugging with VSCode in Docker. Wrap it in the `AOCRunScript()` function.
154
-
- Assign the path to a TypeScript file from the previous step to the package.json file's `"dev:debug:docker"` script, replacing `src/sample/sample.ts`.
docker run -it -v ${pwd}:/opt/app -v /opt/app/node_modules --rm weaponsforge/adventofcode:dev npm run dev:debug:docker
159
+
docker run -it -v ${pwd}:/opt/app -v /opt/app/node_modules -p 9229:9229 --rm weaponsforge/adventofcode:dev npm run docker:debug
159
160
```
160
161
> **INFO:** This process requires attaching a debugger with the VSCode launch config defined in Issue [#53](https://github.com/weaponsforge/adventofcode/issues/53)
161
162
@@ -185,6 +186,8 @@ Using Docker
185
186
186
187
## 📜 Available Scripts
187
188
189
+
These scripts, compatible with running in Node and Docker, run various TypeScript scripts and tests.
190
+
188
191
<details>
189
192
<summary>Click to expand the list of available scripts</summary>
190
193
@@ -196,33 +199,54 @@ Runs `vitest` in watch mode, watching file changes and errors to files linked wi
196
199
197
200
Watches file changes in `.ts` files using the `tsc --watch` option.
198
201
199
-
### `npm run watch:docker:win`
200
-
201
-
Watches file changes in `.ts` files using the `tsc --watch` option with `dynamicPriorityPolling` in Docker containers running in Windows WSL2.
202
-
203
202
### `npm run dev:debug`
204
203
205
204
Runs the sample TS script.
206
205
207
206
### `npm run transpile`
208
207
209
-
Builds the JavaScriptfilesfrom the TypeScript files.
208
+
Builds JavaScript, `.d.ts` declaration files, and map files from the TypeScript source files.
210
209
211
210
### `npm run transpile:noemit`
212
211
213
-
Runs type-checking without generating the JavaScript or declatation files from the TypeScript files.
212
+
Runs type-checking without generating the JavaScript or declaration files from the TypeScript files.
214
213
215
214
### `npm run lint`
216
215
217
216
Lints TypeScript source codes.
218
217
219
218
### `npm run lint:fix`
220
219
221
-
Fixes TypeScript lint errors.
220
+
Fixes lint errors in TypeScript files.
222
221
223
222
### `npm test`
224
223
225
-
Runs tests defined in `*.test.ts` files.
224
+
Runs test scripts defined in `*.test.ts` files.
225
+
226
+
</details>
227
+
228
+
## 📦 Docker Scripts
229
+
230
+
These scripts allow optional Docker-related processes, such as enabling file watching in Docker containers running in Windows WSL2 and others.
231
+
232
+
<details>
233
+
<summary>Click to expand the list of available scripts</summary>
234
+
235
+
### `npm run docker:debug`
236
+
237
+
- Runs the `"/src/sample/sample.ts"` script in containers with debugging enabled in VSCode.
238
+
- Replace the `"/src/sample/sample.ts"` file path in the package.json file's `"docker:debug"` script with a target TypeScript file for debugging.
239
+
- Map port **9229** to enable debugging VSCode while running in Docker.<br>
Watches file changes in `.ts` files using the `tsc --watch` option with `dynamicPriorityPolling` in Docker containers running in Windows WSL2.
245
+
246
+
### `npm run docker:dev:win`
247
+
248
+
- Sets and exports the environment variables: `CHOKIDAR_USEPOLLING=1` and `CHOKIDAR_INTERVAL=1000`
249
+
- Runs `vitest` in watch mode inside Docker containers running in Windows WSL2, watching file changes and errors to files linked with `*.test.ts` files.
0 commit comments