Skip to content

Commit 6763484

Browse files
authored
Merge branch 'next' into chore-enable-verbatimModuleSyntax
2 parents 0659fe8 + 13dc420 commit 6763484

File tree

26 files changed

+3348
-1408
lines changed

26 files changed

+3348
-1408
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
name: 'Build & Unit Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
25+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
2626
with:
2727
# Required for docs/versions tests
2828
fetch-depth: 0
@@ -70,7 +70,7 @@ jobs:
7070
run: date
7171

7272
- name: Checkout
73-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
73+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
7474
with:
7575
# Required for docs/versions tests
7676
fetch-depth: 0
@@ -104,7 +104,7 @@ jobs:
104104
name: 'E2E Doc Test: node-20, ubuntu-latest'
105105
steps:
106106
- name: Checkout
107-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
107+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
108108

109109
- name: Install pnpm
110110
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
@@ -125,7 +125,7 @@ jobs:
125125
name: 'Lint: node-20, ubuntu-latest'
126126
steps:
127127
- name: Checkout
128-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
128+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
129129
with:
130130
fetch-depth: 0
131131

@@ -155,7 +155,7 @@ jobs:
155155
name: 'TS-Check: node-20, ubuntu-latest'
156156
steps:
157157
- name: Checkout
158-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
158+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
159159
with:
160160
fetch-depth: 0
161161

@@ -185,7 +185,7 @@ jobs:
185185
name: 'Codecov: node-20, ubuntu-latest'
186186
steps:
187187
- name: Checkout
188-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
188+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
189189
with:
190190
fetch-depth: 0
191191

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
pull-requests: write
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
18+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
1919
with:
2020
fetch-depth: 0
2121

.github/workflows/semantic-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: Semantic Pull Request
2121
steps:
2222
- name: Validate PR title
23-
uses: amannn/action-semantic-pull-request@e9fabac35e210fea40ca5b14c0da95a099eff26f # v5.4.0
23+
uses: amannn/action-semantic-pull-request@cfb60706e18bc85e8aec535e3c577abe8f70378e # v5.5.2
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626
with:

docs/.vitepress/config.ts

Lines changed: 51 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { apiPages } from './api-pages';
44
import {
55
algoliaIndex,
66
currentVersion,
7-
oldVersions,
87
versionBannerInfix,
8+
versionLinks,
99
} from './versions';
1010

1111
type SidebarItem = DefaultTheme.SidebarItem;
@@ -14,36 +14,71 @@ const description =
1414
'Generate massive amounts of fake (but reasonable) data for testing and development.';
1515
const image = 'https://fakerjs.dev/social-image.png';
1616

17-
function extendSideNav(current: SidebarItem): SidebarItem[] {
17+
function getSideBarWithExpandedEntry(entryToExpand: string): SidebarItem[] {
1818
const links: SidebarItem[] = [
1919
{
2020
text: 'Guide',
2121
items: [
2222
{
23-
text: 'Usage Guide',
23+
text: 'Getting Started',
2424
link: '/guide/',
2525
},
26+
{
27+
text: 'Usage',
28+
link: '/guide/usage',
29+
},
30+
{
31+
text: 'Localization',
32+
link: '/guide/localization',
33+
},
34+
{
35+
text: 'Frameworks',
36+
link: '/guide/frameworks',
37+
},
38+
{
39+
text: 'Randomizer',
40+
link: '/guide/randomizer',
41+
},
42+
{
43+
text: 'Unique Values',
44+
link: '/guide/unique',
45+
},
46+
{
47+
text: 'Upgrading to v9',
48+
link: '/guide/upgrading',
49+
},
2650
],
2751
},
2852
{
2953
text: 'API',
30-
items: [
31-
{
32-
text: 'API Reference',
33-
link: '/api/',
34-
},
35-
],
54+
items: apiPages,
3655
},
3756
{
3857
text: 'About',
3958
items: [
4059
{
4160
text: 'Announcements',
4261
link: '/about/announcements',
62+
items: [
63+
{ text: '2022-09-08', link: '/about/announcements/2022-09-08' },
64+
{ text: '2022-01-14', link: '/about/announcements/2022-01-14' },
65+
],
4366
},
4467
{
4568
text: 'Roadmap',
4669
link: '/about/roadmap/',
70+
items: [
71+
{
72+
text: 'v9 - Tree-Shakeable Module-Functions',
73+
link: '/about/roadmap/v9',
74+
},
75+
{ text: 'v8 - Make Faker Handier', link: '/about/roadmap/v8' },
76+
{
77+
text: 'v7 - Cleanup & Improvements',
78+
link: '/about/roadmap/v7',
79+
},
80+
{ text: 'v6 - Continue Faker', link: '/about/roadmap/v6' },
81+
],
4782
},
4883
{
4984
text: 'Team',
@@ -56,7 +91,9 @@ function extendSideNav(current: SidebarItem): SidebarItem[] {
5691
],
5792
},
5893
];
59-
links[links.findIndex((group) => group.text === current.text)] = current;
94+
for (const entry of links) {
95+
entry.collapsed = entry.text !== entryToExpand;
96+
}
6097
return links;
6198
}
6299

@@ -188,7 +225,7 @@ const config: UserConfig<DefaultTheme.Config> = {
188225
text: 'Release Notes',
189226
link: 'https://github.com/faker-js/faker/releases',
190227
},
191-
...oldVersions.map(({ version, link }) => ({
228+
...versionLinks.map(({ version, link }) => ({
192229
text: version,
193230
link,
194231
})),
@@ -197,81 +234,9 @@ const config: UserConfig<DefaultTheme.Config> = {
197234
],
198235

199236
sidebar: {
200-
'/guide/': extendSideNav({
201-
text: 'Guide',
202-
items: [
203-
{
204-
text: 'Getting Started',
205-
link: '/guide/',
206-
},
207-
{
208-
text: 'Usage',
209-
link: '/guide/usage',
210-
},
211-
{
212-
text: 'Localization',
213-
link: '/guide/localization',
214-
},
215-
{
216-
text: 'Frameworks',
217-
link: '/guide/frameworks',
218-
},
219-
{
220-
text: 'Randomizer',
221-
link: '/guide/randomizer',
222-
},
223-
{
224-
text: 'Unique Values',
225-
link: '/guide/unique',
226-
},
227-
{
228-
text: 'Upgrading to v9',
229-
link: '/guide/upgrading',
230-
},
231-
],
232-
}),
233-
'/api/': extendSideNav({
234-
text: 'API',
235-
items: apiPages,
236-
}),
237-
238-
'/about/': extendSideNav({
239-
text: 'About',
240-
items: [
241-
{
242-
text: 'Announcements',
243-
link: '/about/announcements',
244-
items: [
245-
{ text: '2022-09-08', link: '/about/announcements/2022-09-08' },
246-
{ text: '2022-01-14', link: '/about/announcements/2022-01-14' },
247-
],
248-
},
249-
{
250-
text: 'Roadmap',
251-
link: '/about/roadmap/',
252-
items: [
253-
{
254-
text: 'v9 - Tree-Shakeable Module-Functions',
255-
link: '/about/roadmap/v9',
256-
},
257-
{ text: 'v8 - Make Faker Handier', link: '/about/roadmap/v8' },
258-
{
259-
text: 'v7 - Cleanup & Improvements',
260-
link: '/about/roadmap/v7',
261-
},
262-
{ text: 'v6 - Continue Faker', link: '/about/roadmap/v6' },
263-
],
264-
},
265-
{
266-
text: 'Team',
267-
link: '/about/team',
268-
},
269-
{
270-
text: 'Contributing',
271-
link: '/about/contributing',
272-
},
273-
],
274-
}),
237+
'/guide/': getSideBarWithExpandedEntry('Guide'),
238+
'/api/': getSideBarWithExpandedEntry('API'),
239+
'/about/': getSideBarWithExpandedEntry('About'),
275240
},
276241
},
277242

docs/.vitepress/versions.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@ function readBranchName(): string {
99
}
1010

1111
function readOtherLatestReleaseTagNames(): string[] {
12-
const currentMajorVersion = semver.major(version);
1312
const latestReleaseTagNames = execSync('git tag -l')
1413
.toString('utf8')
1514
.split('\n')
1615
.filter((tag) => semver.valid(tag))
17-
.filter((tag) => {
18-
// Only consider tags for our deployed website versions,
19-
// excluding the current major version.
20-
const majorVersion = semver.major(tag);
21-
return majorVersion >= 6 && majorVersion !== currentMajorVersion;
22-
})
16+
// Only consider tags for our deployed website versions
17+
.filter((tag) => semver.major(tag) >= 6)
18+
// Find the latest tag for each major version
2319
.reduce<Record<number, string>>((latestTagByMajor, tag) => {
2420
const majorVersion = semver.major(tag);
2521

@@ -39,10 +35,6 @@ const {
3935
BRANCH: branchName = readBranchName(),
4036
} = process.env;
4137

42-
const hiddenLink =
43-
deployContext === 'production'
44-
? 'https://fakerjs.dev/'
45-
: `https://${branchName}.fakerjs.dev/`;
4638
const otherVersions = readOtherLatestReleaseTagNames();
4739
const isReleaseBranch = /^v\d+$/.test(branchName);
4840

@@ -60,11 +52,7 @@ export const versionBannerInfix: string | null = (() => {
6052
})();
6153

6254
export const currentVersion = isReleaseBranch ? `v${version}` : branchName;
63-
export const oldVersions = [
64-
{
65-
version: 'latest',
66-
link: 'https://fakerjs.dev/',
67-
},
55+
export const versionLinks = [
6856
{
6957
version: 'next',
7058
link: 'https://next.fakerjs.dev/',
@@ -73,7 +61,9 @@ export const oldVersions = [
7361
version,
7462
link: `https://v${semver.major(version)}.fakerjs.dev/`,
7563
})),
76-
].filter(({ link }) => link !== hiddenLink);
64+
]
65+
// Don't link to the current branch's version.
66+
.filter(({ link }) => link !== `https://${branchName}.fakerjs.dev/`);
7767

7868
export const algoliaIndex = isReleaseBranch
7969
? `fakerjs-v${semver.major(version)}`

docs/api/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
layout: page
33
title: API Reference
4-
sidebar: false
54
footer: false
65
---
76

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# Alias for the next page
2626
[[redirects]]
27-
from = "https://v9.fakerjs.dev"
27+
from = "https://v10.fakerjs.dev"
2828
to = "https://next.fakerjs.dev"
2929
status = 302
3030
force = true

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
"@types/validator": "13.11.9",
104104
"@typescript-eslint/eslint-plugin": "7.7.0",
105105
"@typescript-eslint/parser": "7.7.0",
106-
"@vitest/coverage-v8": "1.5.0",
107-
"@vitest/ui": "1.5.0",
106+
"@vitest/coverage-v8": "1.5.2",
107+
"@vitest/ui": "1.5.2",
108108
"@vueuse/core": "10.9.0",
109109
"conventional-changelog-cli": "4.1.0",
110110
"cypress": "13.8.1",
@@ -131,11 +131,11 @@
131131
"typescript": "5.4.5",
132132
"validator": "13.11.0",
133133
"vite": "5.2.10",
134-
"vitepress": "1.1.3",
135-
"vitest": "1.5.0",
134+
"vitepress": "1.1.4",
135+
"vitest": "1.5.2",
136136
"vue": "3.4.25"
137137
},
138-
"packageManager": "[email protected].5",
138+
"packageManager": "[email protected].6",
139139
"engines": {
140140
"node": ">=18.0.0",
141141
"npm": ">=9.0.0"

0 commit comments

Comments
 (0)