File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change 33 * @import {Root} from 'hast'
44 */
55
6- /**
7- * @typedef Redirect
8- * Redirect.
9- * @property {string } destination
10- * To.
11- * @property {string } source
12- * From.
13- */
14-
156import fs from 'node:fs/promises'
167import { fileURLToPath } from 'node:url'
178import { globby } from 'globby'
@@ -75,31 +66,6 @@ await pAll(
7566
7667console . log ( '✔ %d redirects' , Object . keys ( redirect ) . length )
7768
78- // To do: drop Vercel.
79- /** @type {Array<Readonly<Redirect>> } */
80- const vercelRedirects = [ ]
81- /** @type {string } */
82- let redirectFrom
83-
84- for ( redirectFrom in redirect ) {
85- if ( Object . hasOwn ( redirect , redirectFrom ) ) {
86- const source = redirectFrom . replace ( / \/ i n d e x .h t m l $ / , '/' )
87- const destination = redirect [ redirectFrom ]
88- vercelRedirects . push ( { destination, source} )
89- }
90- }
91-
92- // To do: drop Vercel.
93- /** @type {Record<string, unknown> & {redirects: ReadonlyArray<Readonly<Redirect>>} } */
94- const vercelInfo = JSON . parse ( String ( await fs . readFile ( 'vercel.json' ) ) )
95- await fs . writeFile (
96- 'vercel.json' ,
97- JSON . stringify ( { ...vercelInfo , redirects : vercelRedirects } , undefined , 2 ) +
98- '\n'
99- )
100-
101- console . log ( '✔ `vercel.json` redirects' )
102-
10369/**
10470 *
10571 * @param {string } to
You can’t perform that action at this time.
0 commit comments