Skip to content

Commit

Permalink
Merge pull request #235 from storybookjs/fix-redirects
Browse files Browse the repository at this point in the history
Fix redirect error
  • Loading branch information
kylegach authored Oct 21, 2024
2 parents 82a420b + 8d69da5 commit 18ef210
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
44 changes: 22 additions & 22 deletions apps/frontpage/lib/generateRedirects/generate-redirects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ test('generateRedirects, no pre-release', () => {
"source": "/docs/:renderer(react|vue)/writing-tests/importing-stories-in-tests/",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": true,
"source": "/docs/:renderer(react|vue)/:path*",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": false,
"source": "/docs/8.1/:path*",
},
Expand All @@ -164,7 +164,7 @@ test('generateRedirects, no pre-release', () => {
"source": "/docs/8.0",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": true,
"source": "/docs/8.0/:path*",
},
Expand All @@ -174,7 +174,7 @@ test('generateRedirects, no pre-release', () => {
"source": "/docs/7.6",
},
{
"destination": "/docs/7/:path",
"destination": "/docs/7/:path*",
"permanent": true,
"source": "/docs/7.6/:path*",
},
Expand All @@ -184,7 +184,7 @@ test('generateRedirects, no pre-release', () => {
"source": "/docs/7.0",
},
{
"destination": "/docs/7/:path",
"destination": "/docs/7/:path*",
"permanent": true,
"source": "/docs/7.0/:renderer(react|vue)/:path*",
},
Expand All @@ -194,12 +194,12 @@ test('generateRedirects, no pre-release', () => {
"source": "/docs/next",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": false,
"source": "/docs/next/:renderer(react|vue)/:path*",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": false,
"source": "/docs/next/:path*",
},
Expand Down Expand Up @@ -242,12 +242,12 @@ test('generateRedirects, minor pre-release', () => {
"source": "/docs/:renderer(react|vue)/workflows/unit-testing/",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": true,
"source": "/docs/:renderer(react|vue)/:path*",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": false,
"source": "/docs/8.1/:path*",
},
Expand All @@ -257,7 +257,7 @@ test('generateRedirects, minor pre-release', () => {
"source": "/docs/8.0",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": true,
"source": "/docs/8.0/:path*",
},
Expand All @@ -267,7 +267,7 @@ test('generateRedirects, minor pre-release', () => {
"source": "/docs/7.6",
},
{
"destination": "/docs/7/:path",
"destination": "/docs/7/:path*",
"permanent": true,
"source": "/docs/7.6/:path*",
},
Expand All @@ -277,7 +277,7 @@ test('generateRedirects, minor pre-release', () => {
"source": "/docs/7.0",
},
{
"destination": "/docs/7/:path",
"destination": "/docs/7/:path*",
"permanent": true,
"source": "/docs/7.0/:renderer(react|vue)/:path*",
},
Expand All @@ -287,12 +287,12 @@ test('generateRedirects, minor pre-release', () => {
"source": "/docs/next",
},
{
"destination": "/docs/8.2/:path",
"destination": "/docs/8.2/:path*",
"permanent": false,
"source": "/docs/next/:renderer(react|vue)/:path*",
},
{
"destination": "/docs/8.2/:path",
"destination": "/docs/8.2/:path*",
"permanent": false,
"source": "/docs/next/:path*",
},
Expand Down Expand Up @@ -335,12 +335,12 @@ test('generateRedirects, major pre-release', () => {
"source": "/docs/:renderer(react|vue)/workflows/unit-testing/",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": true,
"source": "/docs/:renderer(react|vue)/:path*",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": false,
"source": "/docs/8.1/:path*",
},
Expand All @@ -350,7 +350,7 @@ test('generateRedirects, major pre-release', () => {
"source": "/docs/8.0",
},
{
"destination": "/docs/:path",
"destination": "/docs/:path*",
"permanent": true,
"source": "/docs/8.0/:path*",
},
Expand All @@ -360,7 +360,7 @@ test('generateRedirects, major pre-release', () => {
"source": "/docs/7.6",
},
{
"destination": "/docs/7/:path",
"destination": "/docs/7/:path*",
"permanent": true,
"source": "/docs/7.6/:path*",
},
Expand All @@ -370,7 +370,7 @@ test('generateRedirects, major pre-release', () => {
"source": "/docs/7.0",
},
{
"destination": "/docs/7/:path",
"destination": "/docs/7/:path*",
"permanent": true,
"source": "/docs/7.0/:renderer(react|vue)/:path*",
},
Expand All @@ -380,7 +380,7 @@ test('generateRedirects, major pre-release', () => {
"source": "/docs/9.0",
},
{
"destination": "/docs/9/:path",
"destination": "/docs/9/:path*",
"permanent": true,
"source": "/docs/9.0/:path*",
},
Expand All @@ -390,12 +390,12 @@ test('generateRedirects, major pre-release', () => {
"source": "/docs/next",
},
{
"destination": "/docs/9/:path",
"destination": "/docs/9/:path*",
"permanent": false,
"source": "/docs/next/:renderer(react|vue)/:path*",
},
{
"destination": "/docs/9/:path",
"destination": "/docs/9/:path*",
"permanent": false,
"source": "/docs/next/:path*",
},
Expand Down
10 changes: 5 additions & 5 deletions apps/frontpage/lib/generateRedirects/generate-redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function generateRedirects({
acc.push(
getRedirect(
`/docs/${renderersPathWildcardWithRegex}/:path*`,
'/docs/:path',
'/docs/:path*',
'308',
'd',
),
Expand All @@ -193,8 +193,8 @@ export function generateRedirects({
getRedirect(
`/docs/${string}/${renderersPathWildcardWithRegex}/:path*`,
isMajorOfLatestMinor || (isNext && !nextVersionString)
? `/docs/:path`
: `/docs${versionSlugOverride}/:path`,
? `/docs/:path*`
: `/docs${versionSlugOverride}/:path*`,
isNext ? '307' : '308',
'e',
),
Expand All @@ -212,8 +212,8 @@ export function generateRedirects({
getRedirect(
`/docs/${string}/:path*`,
isMajorOfLatestMinor || (isNext && !nextVersionString)
? `/docs/:path`
: `/docs${versionSlugOverride}/:path`,
? `/docs/:path*`
: `/docs${versionSlugOverride}/:path*`,
isLatest || isNext ? '307' : '308',
'f',
),
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/redirects/docs-common-redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export const docsCommonRedirects: RedirectData[] = [
},
{
source: '/tag/:path*',
destination: '/addons/tag/:path',
destination: '/addons/tag/:path*',
permanent: true,
},
];

0 comments on commit 18ef210

Please sign in to comment.