-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate docs to es modules (#4143)
* chore: migrate docs site to esm * chore: lintfix * chore: update site package.json to reference mjs files * chore: change back docs site type to commonjs as it breaks the x0 dependency Co-authored-by: Erez Rokah <erezrokah@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
3d40fe1
commit cc2c6dd
Showing
10 changed files
with
93 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { join } from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
export const rootDir = fileURLToPath(new URL('..', import.meta.url)) | ||
|
||
export const docs = { | ||
srcPath: join(rootDir, 'docs'), | ||
outputPath: join(rootDir, 'site/src'), | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { promises as fs } from 'fs' | ||
import { join, dirname } from 'path' | ||
import { promisify } from 'util' | ||
|
||
import rimraf from 'rimraf' | ||
|
||
const rimrafAsync = promisify(rimraf) | ||
|
||
export const copyDirRecursiveAsync = async (src, dest) => { | ||
try { | ||
fs.mkdir(dest, { recursive: true }) | ||
} catch { | ||
// ignore erros for mkdir | ||
} | ||
|
||
const childrenItems = await fs.readdir(src) | ||
|
||
await Promise.all( | ||
childrenItems.map(async (item) => { | ||
const srcPath = join(src, item) | ||
const destPath = join(dest, item) | ||
|
||
const itemStat = await fs.lstat(srcPath) | ||
|
||
if (itemStat.isFile()) { | ||
fs.copyFile(srcPath, destPath) | ||
} else { | ||
await copyDirRecursiveAsync(srcPath, destPath) | ||
} | ||
}), | ||
) | ||
} | ||
|
||
export const ensureFilePathAsync = async (filePath) => { | ||
try { | ||
await fs.mkdir(dirname(filePath), { recursive: true }) | ||
} catch { | ||
// ignore any errors with mkdir - it will throw if the path already exists. | ||
} | ||
} | ||
|
||
export const removeRecursiveAsync = async (filePath) => { | ||
await rimrafAsync(filePath) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cc2c6dd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📊 Benchmark results
Package size: 361 MB