generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
45 additions
and
11 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 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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import { execa } from 'execa' | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import prettyBytes from 'pretty-bytes' | ||
|
||
export async function BundleSize() { | ||
const { stdout } = await execa('./node_modules/.bin/size-limit', ['--json'], { | ||
cwd: path.resolve(process.cwd(), '../../packages/nuqs') | ||
}) | ||
const [{ size }] = JSON.parse(stdout) | ||
return prettyBytes(size) | ||
const filePath = path.resolve(process.cwd(), '../../packages/nuqs/size.json') | ||
try { | ||
const json = await fs.readFile(filePath, 'utf8') | ||
const [{ size }] = JSON.parse(json) | ||
return prettyBytes(size) | ||
} catch (error) { | ||
console.error(error) | ||
return 'less than 4KB' | ||
} | ||
} |
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 @@ | ||
size.json |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.