Skip to content

Commit bf60af8

Browse files
✨ feat: verify project structures and fix tsconfigs (#122)
* ✨ feat: verify project structures and fix tsconfigs * Fix jest-haste-map issues * Progress: chapter file verification * Start verifying project categories * Progress: verifying package.json in projects * Finished standardizing contents * Remove added tsconfig.json files Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
1 parent e94d041 commit bf60af8

74 files changed

Lines changed: 572 additions & 147 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: "16"
17+
cache: "npm"
18+
- run: npm ci
19+
- name: Run unit tests on the repo
20+
run: npm run test

jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
transform: {
3+
"^.+\\.(t|j)sx?$": ["@swc/jest"],
4+
},
5+
};

package-lock.json

Lines changed: 110 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"@commitlint/cli": "^17.0.2",
44
"@swc/core": "^1.2.197",
55
"@swc/jest": "^0.2.21",
6+
"capital-case": "^1.0.4",
67
"commitlint-config-gitmoji": "^2.2.5",
78
"cross-env": "7.0.3",
89
"husky": "^8.0.0",
@@ -11,6 +12,7 @@
1112
"prettier": "^2.6.2",
1213
"prettier-plugin-sh": "^0.11.0",
1314
"pretty-quick": "^3.1.3",
15+
"title-case": "^3.0.3",
1416
"ts-jest": "28.0.4",
1517
"tsd": "0.20.0",
1618
"typescript": "4.6.2"
@@ -27,7 +29,8 @@
2729
"name": "learning-typescript-projects",
2830
"scripts": {
2931
"format": "prettier --write \"**/*\" --ignore-unknown",
30-
"prepare": "husky install"
32+
"prepare": "husky install",
33+
"test": "jest test/"
3134
},
3235
"version": "0.0.1"
3336
}

projects/arrays/analyzing-dna/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ We'll walk you through each of the functions you need to write.
1313

1414
## Setup
1515

16-
In one terminal, start the TypeScript compiler in watch mode:
16+
In one terminal, run the TypeScript compiler via the `tsc` script within whichever step you're working on.
17+
For example, to start the TypeScript compiler on the first step in watch mode:
1718

1819
```shell
19-
tsc --watch
20+
npm run tsc -- --project 01-shallow-equality --watch
2021
```
2122

22-
In another terminal, run Jest on whichever step you're working on.
23-
For example, to run tests for the first step in watch mode:
23+
In another terminal, run Jest via the `test` script on whichever step you're working on.
24+
For example, to start tests for the first step in watch mode:
2425

2526
```shell
26-
npm test -- 1 --watch
27+
npm run test -- 1 --watch
2728
```
2829

2930
## Steps

projects/arrays/analyzing-dna/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "analyzing-dna",
33
"scripts": {
44
"test": "jest",
5-
"test:solutions": "cross-env TEST_SOLUTIONS=1 jest"
5+
"test:solutions": "cross-env TEST_SOLUTIONS=1 jest",
6+
"tsc": "tsc"
67
}
78
}

projects/arrays/text-processor/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ Can you type this text processor up for me, fellow typography practitioner?
2020

2121
## Setup
2222

23-
In one terminal, start the TypeScript compiler in watch mode:
23+
In one terminal, run the TypeScript compiler via the `tsc` script.
24+
For example, to start the TypeScript compiler in watch mode:
2425

2526
```shell
26-
tsc --watch
27+
npm run tsc -- --watch
2728
```
2829

2930
In another terminal, run Jest via the `test` script.
30-
For example, to run tests in watch mode:
31+
For example, to start tests in watch mode:
3132

3233
```shell
33-
npm test -- --watch
34+
npm run test -- --watch
3435
```
3536

3637
## Specification

projects/arrays/text-processor/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "text-processor",
33
"scripts": {
44
"test": "jest",
5-
"test:solutions": "cross-env TEST_SOLUTIONS=1 jest"
5+
"test:solutions": "cross-env TEST_SOLUTIONS=1 jest",
6+
"tsc": "tsc"
67
}
78
}

projects/classes/classifying-creatures/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ Can you please help us classify our creatures?
1313

1414
## Setup
1515

16-
In one terminal, start the TypeScript compiler in watch mode:
16+
In one terminal, run the TypeScript compiler via the `tsc` script within whichever step you're working on.
17+
For example, to start the TypeScript compiler on the first step in watch mode:
1718

1819
```shell
19-
tsc --watch
20+
npm run tsc -- --project 01-polly-parrots-properties --watch
2021
```
2122

22-
In another terminal, run Jest on whichever step you're working on.
23-
For example, to run tests for the first step in watch mode:
23+
In another terminal, run Jest via the `test` script on whichever step you're working on.
24+
For example, to start tests for the first step in watch mode:
2425

2526
```shell
26-
npm test -- 1 --watch
27+
npm run test -- 1 --watch
2728
```
2829

2930
## Steps
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"name": "analyzing-dna",
2+
"name": "classifying-creatures",
33
"scripts": {
44
"test": "jest",
5-
"test:solutions": "cross-env TEST_SOLUTIONS=1 jest"
5+
"test:solutions": "cross-env TEST_SOLUTIONS=1 jest",
6+
"tsc": "tsc"
67
}
78
}

0 commit comments

Comments
 (0)