Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate site to Vite and Vike for SSG #160

Merged
merged 32 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2fffeb6
site works in dev mode and build
mrm007 Jan 29, 2024
38c8b67
upgrade to React v17, Chakra v1, Emotion v11
mrm007 Jan 29, 2024
8692dac
upgrade to React v18, Chakra v2, TypeScript v5.3
mrm007 Jan 29, 2024
8336e90
remove traces of Gatsby from scripts
mrm007 Jan 29, 2024
58e1e02
use Vike for SSG
mrm007 Jan 30, 2024
ec33a0f
fix urls for preview site deployments
mrm007 Jan 30, 2024
5068ed1
upgrade react-syntax-highlighter and use light build
mrm007 Jan 30, 2024
d27ff58
dedupe lockfile
mrm007 Jan 31, 2024
b633ddd
fix deployment to GitHub Pages
mrm007 Jan 31, 2024
e8aee99
we do a little gold plating
mrm007 Jan 31, 2024
5bf202e
remove TODOs
mrm007 Jan 31, 2024
fbc87b8
a bit of cleanup
mrm007 Jan 31, 2024
9e67cf7
use the async light build of react-syntax-highlighter
mrm007 Jan 31, 2024
f02879e
optimize images with vite-imagetools
mrm007 Jan 31, 2024
8910a93
upgrade downshift
mrm007 Jan 31, 2024
055253a
fix SSR issues with hydration and syntax highlighting
mrm007 Jan 31, 2024
575680b
use pixels where needed
mrm007 Jan 31, 2024
b74031c
upgrade more dev deps, run Prettier
mrm007 Jan 31, 2024
7a44a41
clean up site scripts
mrm007 Jan 31, 2024
736c62e
test corepack
mrm007 Jan 31, 2024
f78b434
rename vite config to .mts so we can load ES Modules
mrm007 Feb 1, 2024
7dec002
small tweaks
mrm007 Feb 1, 2024
f644076
update vite-plugin-node-polyfills to latest
mrm007 Feb 1, 2024
ede4b99
fix a decent typo
mrm007 Feb 1, 2024
6ed80c3
site: Fix some styling bugs
michaeltaranto Feb 1, 2024
9ba1521
site: More styling fixes
michaeltaranto Feb 1, 2024
a0357ca
go full ESM
mrm007 Feb 1, 2024
3e70df5
set html attributes directly
mrm007 Feb 1, 2024
6ff710d
site: Fix suggestions list
michaeltaranto Feb 1, 2024
4c8289f
convert site scripts to ESM
mrm007 Feb 1, 2024
8acd9f6
await promise
mrm007 Feb 1, 2024
397f0eb
clean up site scripts
mrm007 Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ jobs:
run: pnpm i

- name: Deploy site & create release PR or publish to npm
uses: changesets/action@c2918239208f2162b9d27a87f491375c51592434
uses: changesets/action@v1
with:
version: pnpm run version
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }}
IS_GITHUB_PAGES: true
8 changes: 8 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
prefer-workspace-packages=true

# Make sure the default patterns are still included (https://pnpm.io/npmrc#public-hoist-pattern)
public-hoist-pattern[]="*eslint*"
public-hoist-pattern[]="*prettier*"

# Polyfills are only used in the site, but with `preconstruct dev` they are imported by our own code
public-hoist-pattern[]="vite-plugin-node-polyfills"
50 changes: 24 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,34 @@
"homepage": "https://github.com/seek-oss/capsize#readme",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.19.6",
"@babel/preset-env": "^7.19.4",
"@babel/preset-typescript": "^7.18.6",
"@changesets/changelog-github": "^0.4.7",
"@changesets/cli": "^2.25.0",
"@manypkg/cli": "^0.21.0",
"@preconstruct/cli": "^2.2.2",
"@storybook/addon-viewport": "^6.5.13",
"@storybook/builder-webpack5": "^6.5.13",
"@storybook/cli": "^6.5.13",
"@storybook/html": "^6.5.13",
"@storybook/manager-webpack5": "^6.5.13",
"@types/jest": "^29.2.0",
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@manypkg/cli": "^0.21.2",
"@preconstruct/cli": "^2.8.3",
"@storybook/addon-viewport": "^6.5.16",
"@storybook/builder-webpack5": "^6.5.16",
"@storybook/cli": "^6.5.16",
"@storybook/html": "^6.5.16",
"@storybook/manager-webpack5": "^6.5.16",
"@types/jest": "^29.5.11",
"@types/node": "^20.11.13",
"@vanilla-extract/babel-plugin": "^1.2.0",
"@vanilla-extract/webpack-plugin": "^2.2.0",
"@vanilla-extract/webpack-plugin": "^2.3.4",
"chromatic": "^5.9.2",
"husky": "^8.0.1",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"jest": "^29.2.2",
"prettier": "^2.7.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"typescript": "^4.8.4",
"webpack": "^5.75.0"
"jest": "^29.7.0",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.3",
"webpack": "^5.90.0"
},
"resolutions": {
"remark-mdx": "^1.6.22"
},
"packageManager": "[email protected]",
"packageManager": "[email protected]",
"volta": {
"node": "16.18.0"
"node": "20.11.0"
}
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"csstype": "^3.1.1"
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@emotion/css": "^11.1.3"
"@babel/core": "^7.23.9",
"@emotion/css": "^11.11.2"
}
}
8 changes: 3 additions & 5 deletions packages/metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,14 @@
"devDependencies": {
"@capsizecss/unpack": "^1.0.0",
"@types/cli-progress": "^3.9.2",
"@types/dedent": "^0.7.0",
"@types/node": "^16.18.2",
"@types/node-fetch": "^2.6.2",
"cli-progress": "^3.9.1",
"dedent": "^0.7.0",
"dedent": "^1.5.1",
"del": "^6.0.0",
"node-fetch": "^2.6.2",
"p-queue": "^6.6.2",
"sort-keys": "^5.0.0",
"tsx": "^4.1.2",
"typescript": "^4.8.4"
"tsx": "^4.7.0",
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion packages/metrics/scripts/analyse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import googleFontsMetrics from './googleFonts.json';

type FontMetrics = typeof googleFontsMetrics[number];
type FontMetrics = (typeof googleFontsMetrics)[number];
interface Report {
name: string;
run: (fontMetrics: FontMetrics) => boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/metrics/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const buildFiles = async ({

await queue.addAll(systemMetrics.map((m) => async () => await buildFiles(m)));
await queue.addAll(
googleFonts.items.map((font: typeof googleFonts.items[number]) => {
googleFonts.items.map((font: (typeof googleFonts.items)[number]) => {
const fontUrl =
'regular' in font.files && font.files.regular
? font.files.regular
Expand Down
3 changes: 2 additions & 1 deletion packages/unpack/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'cross-fetch/polyfill';

import blobToBuffer from 'blob-to-buffer';
import fontkit, { Font as FontKitFont } from 'fontkit';
import * as fontkit from 'fontkit';
import type { Font as FontKitFont } from 'fontkit';
Comment on lines -4 to +5
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't change the behaviour of the compiled code, so a changeset is not warranted IMO.


// Ref: https://en.wikipedia.org/wiki/Letter_frequency#Relative_frequencies_of_letters_in_other_languages
const weightings = {
Expand Down
Loading
Loading