mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-16 12:04:12 +08:00

* fix: fetching contributors * refactor(build): improve building * fix: building * refactor: build constants * fix: lockfile * ci: remove token * ci: rename * refactor: improve docs constant
10 lines
332 B
TypeScript
10 lines
332 B
TypeScript
import { existsSync } from 'fs'
|
|
import { mkdir, writeFile } from 'fs/promises'
|
|
|
|
export const writeJson = (path: string, data: any, spaces = 0) =>
|
|
writeFile(path, JSON.stringify(data, undefined, spaces), 'utf-8')
|
|
|
|
export const ensureDir = async (path: string) => {
|
|
if (!existsSync(path)) await mkdir(path, { recursive: true })
|
|
}
|