Skip to content

Commit 93ef1d7

Browse files
authored
Merge pull request #13 from Hdoc1509/root/vite7
Root/vite7
2 parents 829d270 + c0320c4 commit 93ef1d7

File tree

53 files changed

+1575
-1018
lines changed

Some content is hidden

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

53 files changed

+1575
-1018
lines changed

.github/workflows/ci-root.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI Root
33
on:
44
push:
55
branches:
6-
- 'root/*'
6+
- "root/*"
77

88
jobs:
99
changed-files:
@@ -41,7 +41,7 @@ jobs:
4141
pnpm install --frozen-lockfile
4242
pnpm run lint
4343
44-
typecheck:
44+
build:
4545
needs: changed-files
4646
runs-on: ubuntu-22.04
4747
if: needs.changed-files.outputs.files != 'true'
@@ -54,4 +54,4 @@ jobs:
5454
cache: pnpm
5555
- run: |
5656
pnpm install --frozen-lockfile
57-
pnpm run --recursive typecheck
57+
pnpm run build

.github/workflows/ci-vanilla.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI Vanilla
33
on:
44
push:
55
branches:
6-
- "*/*"
6+
- "!root/*"
77
paths:
88
- "vanilla/**"
99
- ".github/workflows/ci-vanilla.yml"
@@ -63,7 +63,7 @@ jobs:
6363
pnpm install --frozen-lockfile --filter "@hdoc/dev-challenges" --filter "$app_name"...
6464
pnpm run lint:vanilla vanilla/"$app_name"
6565
66-
typecheck:
66+
build:
6767
needs: changed-files
6868
runs-on: ubuntu-22.04
6969
if: needs.changed-files.outputs.files != 'true'
@@ -77,7 +77,7 @@ jobs:
7777
- run: |
7878
app_name='${{ needs.changed-files.outputs.app_name }}'
7979
pnpm install --frozen-lockfile --filter "@hdoc/dev-challenges" --filter "$app_name"...
80-
pnpm --filter "$app_name" typecheck
80+
pnpm --filter "$app_name" build
8181
8282
test-unit:
8383
needs: changed-files

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
run: pnpm install --frozen-lockfile
5454

5555
- name: Build challenges
56-
run: pnpm run build
56+
run: pnpm run build --deploy
5757

5858
- name: Upload artifact
5959
uses: actions/upload-pages-artifact@v3

TODO.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
# TODO
22

3-
## Vite
3+
## All apps
44

5-
### Update to `v7`
5+
- try to remove `typescript` from `devDependencies`. ensure all projects are
6+
using the same version of `typescript`. See [Running scripts in workspaces](https://pnpm.io/9.x/cli/run#details)
67

7-
- Ensure `github-jobs`, `quote-generator` and `weather-app` uses version from
8-
`catalog:`
8+
## Vanilla
99

10-
### Use `build.rollupOptions.output.manualChunks` instead of `splitVendorChunkPlugin()`
10+
- ensure all apps are type-checked before building
1111

12-
Create custom `vite-config` package that exports this option. By default, it
13-
will split into `index-<hash>.(js|css)` and `vendor-<hash>.(js|css)`. i.e.:
12+
## Legacy
1413

15-
```js
16-
{
17-
build: {
18-
rollupOptions: {
19-
output: {
20-
manualChunks(id) {}
21-
}
22-
}
23-
}
24-
}
25-
```
14+
- remove `engines` field from `package.json` files. affected apps:
2615

27-
Affected files:
16+
- `button-component`
17+
- `input-component`
18+
- `country-quiz`
19+
- `todo-app`
20+
- `windbnb`
2821

29-
- `legacy/country-quiz/vite.config.ts`
30-
- `legacy/windbnb/vite.config.ts`
31-
- `_templates/app/react/vite.config.ts.hygen`
22+
`pnpm` version is set in `packageManager` of root `package.json` and
23+
`node` version is set in root `.nvmrc`.
24+
25+
- update `tsconfig.*.json` files to match [create-vite@8.2.0][create-vite@8.2.0]
26+
- update `eslint` to `v9` and config files to match [create-vite@8.2.0][create-vite@8.2.0]
27+
- migrate content-only apps to `astro`. pre-render content to static HTML.
28+
- update projects using `astro` to use `astro@v5`
29+
- `@astrojs/upgrade` requires an explicit version in `package.json` instead
30+
of `catalog:` protocol
31+
32+
[create-vite@8.2.0]: https://github.com/vitejs/vite/tree/create-vite%408.2.0/packages/create-vite/template-react-ts

_templates/app/react/package.json.hygen

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ to: apps/<%= name %>/package.json
2828
"react-dom": "catalog:"
2929
},
3030
"devDependencies": {
31-
"@vitejs/plugin-react": "catalog:",
32-
"sass": "catalog:",
33-
"typescript": "catalog:",
34-
"vite": "catalog:"
31+
"@vitejs/plugin-react": "catalog:vite7",
32+
"sass": "catalog:vite7",
33+
"typescript": "catalog:vite7",
34+
"vite": "catalog:vite7"
3535
}
3636
}

_templates/app/react/vite.config.ts.hygen

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22
to: apps/<%= name %>/vite.config.ts
33
---
44

5-
import { defineConfig, splitVendorChunkPlugin } from 'vite'
5+
import { defineConfig } from 'vite'
66
import react from '@vitejs/plugin-react'
77

88
// https://vitejs.dev/config/
99
export default defineConfig({
10-
plugins: [react(), splitVendorChunkPlugin()],
10+
plugins: [react()],
11+
// TODO: choose a sub-path for `react` apps
12+
// base: '/dev-challenges/PATH/<%= name %>',
13+
build: {
14+
rollupOptions: {
15+
output: {
16+
manualChunks(id) {
17+
if (id.includes("node_modules")) return "vendor";
18+
},
19+
},
20+
},
21+
},
22+
// TODO: add `resolve.alias` option
1123
})

_templates/app/vanilla/package.json.hygen

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ to: vanilla/<%= name %>/package.json
1616
"@lib/dom": "workspace:"
1717
},
1818
"devDependencies": {
19-
"vite": "catalog:",
19+
"vite": "catalog:vite7",
2020
"vite-plugin-html-minifier": "workspace:"
2121
}
2222
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@import "button.scss";
2-
@import "button-outline.scss";
3-
@import "button-text.scss";
1+
@use "button.scss";
2+
@use "button-outline.scss";
3+
@use "button-text.scss";
44

5-
@import "sizes.scss";
6-
@import "colors.scss";
5+
@use "sizes.scss";
6+
@use "colors.scss";

legacy/button-component/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
},
2828
"devDependencies": {
2929
"@hrc/type-utils": "catalog:",
30-
"@vitejs/plugin-react": "catalog:",
31-
"sass": "catalog:",
32-
"typescript": "catalog:",
33-
"vite": "catalog:"
30+
"@vitejs/plugin-react": "catalog:vite7",
31+
"sass": "catalog:vite7",
32+
"typescript": "catalog:vite7",
33+
"vite": "catalog:vite7"
3434
},
3535
"engines": {
3636
"node": ">=18",

legacy/country-quiz/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
"zustand": "catalog:"
2929
},
3030
"devDependencies": {
31-
"@vitejs/plugin-react": "catalog:",
32-
"sass": "catalog:",
33-
"typescript": "catalog:",
34-
"vite": "catalog:",
35-
"vitest": "catalog:",
31+
"@vitejs/plugin-react": "catalog:vite7",
32+
"sass": "catalog:vite7",
33+
"typescript": "catalog:vite7",
34+
"vite": "catalog:vite7",
35+
"vitest": "catalog:vite7",
3636
"vite-plugin-hrc-import": "catalog:"
3737
},
3838
"engines": {

0 commit comments

Comments
 (0)