Skip to content

Commit 3ea50c4

Browse files
authored
Merge branch 'code-differently:main' into main
2 parents 9a10c4c + 0ed006e commit 3ea50c4

25 files changed

+6431
-21
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Check Lesson 02 Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
paths:
7+
- "lesson_02/quiz/**"
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
24+
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
25+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
28+
29+
- name: Use Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '20.x'
33+
34+
- name: Build Shared Lib with Node.js
35+
working-directory: ./lib/typescript/codedifferently-instructional
36+
run: npm ci
37+
38+
- name: Build Lesson 02 with Node.js
39+
working-directory: ./lesson_02/quiz
40+
run: |
41+
npm ci
42+
npm run test

.github/workflows/check_push.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [ "main" ]
66
paths:
77
- "lib/**"
8+
- "lesson_02/quiz/**"
89

910
jobs:
1011
build:
@@ -26,8 +27,19 @@ jobs:
2627
- name: Setup Gradle
2728
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
2829

30+
- name: Use Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20.x'
34+
2935
- name: Build Shared Lib with Gradle Wrapper
3036
working-directory: ./lib/java/codedifferently-instructional
3137
run: ./gradlew check
3238

39+
- name: Build Shared Lib with Node.js
40+
working-directory: ./lib/typescript/codedifferently-instructional
41+
run: |
42+
npm ci
43+
npm run test
44+
3345

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Code Differently 2024 Q4 Cohort
22

3-
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/code-differently/code-differently-24-q1)
4-
[![Check Push](https://github.com/code-differently/code-differently-24-q1/actions/workflows/check_push.yml/badge.svg)](https://github.com/code-differently/code-differently-24-q1/actions/workflows/check_push.yml)
3+
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/code-differently/code-differently-24-q4)
4+
[![Check Push](https://github.com/code-differently/code-differently-24-q4/actions/workflows/check_push.yml/badge.svg)](https://github.com/code-differently/code-differently-24-q4/actions/workflows/check_push.yml)
55

66
### Purpose
77
Main project repo for the Code Differently 2024 Q4 cohort. Read the [syllabus](/syllabus/) for more information about the class. Use the lesson folders to find and submit homework assignments.

lesson_02/README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,37 @@ Please review the following resources before lecture:
88

99
## Homework
1010

11-
TODO(anthonydmays): Add this
11+
- [ ] Complete [Lesson 02 quiz](#lesson-02-quiz-instructions)
12+
- [ ] Do pre-work for [lesson 03](/lesson_03/).
13+
14+
### Prerequisites
15+
16+
To complete this assignment, you must have **Docker** and **VS Code** with the [**Dev Containers**][dev-containers-link] extension installed.
17+
18+
### Lesson 02 Quiz Instructions
19+
20+
For this assignment, you will complete a quiz by modifying a TypeScript application. Within the quiz project, there are tests that you will need to make pass in order to submit your answers. Here are the instructions for completing the assignment:
21+
22+
1. Make sure to sync your fork to pull in the latest changes.
23+
2. Open the project in **VS Code** and make sure to select `Reopen in Container` when prompted.
24+
3. Navigate to the [quiz][lesson-2-quiz-dir] directory and install the required dependencies.
25+
```bash
26+
cd lesson_02/quiz
27+
npm install --prefix ../../lib/typescript/codedifferently-instructional
28+
npm install
29+
npm start
30+
```
31+
4. Open the [lesson2.ts][lesson-2-file] file located in the [quiz/src/][lesson-2-src-dir] directory.
32+
5. Update the code to provide the correct answers to the given questions.
33+
6. When ready to test, run the following command in the `quiz` sub-directory using the terminal:
34+
```bash
35+
npm run test
36+
```
37+
7. Once all tests pass, submit your work by creating a pull request (PR).
38+
39+
[dev-containers-link]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
40+
[lesson-2-quiz-dir]: quiz/
41+
[lesson-2-file]: quiz/src/lesson2.ts
42+
[lesson-2-src-dir]: quiz/src/
43+
[test-report]: quiz/lesson_02_quiz/build/reports/tests/test/index.html
44+
[spotless-link]: https://github.com/diffplug/spotless

lesson_02/quiz/.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
insert_final_newline = true

lesson_02/quiz/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

lesson_02/quiz/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore artifacts:
2+
build
3+
coverage

lesson_02/quiz/.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

lesson_02/quiz/eslint.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @ts-check
2+
3+
import eslint from "@eslint/js";
4+
import tseslint from "typescript-eslint";
5+
import eslintConfigPrettier from "eslint-config-prettier";
6+
7+
export default tseslint.config(
8+
eslint.configs.recommended,
9+
...tseslint.configs.strict,
10+
...tseslint.configs.stylistic,
11+
eslintConfigPrettier,
12+
{
13+
ignores: ["build"],
14+
},
15+
);

lesson_02/quiz/jest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} **/
2+
export default {
3+
testEnvironment: "node",
4+
transform: {
5+
"^.+.tsx?$": ["ts-jest", { useESM: true }],
6+
},
7+
moduleNameMapper: {
8+
"^(\\.\\.?\\/.+)\\.js$": "$1",
9+
},
10+
extensionsToTreatAsEsm: [".ts"],
11+
};

0 commit comments

Comments
 (0)