diff --git a/apps/www/__registry__/index.ts b/apps/www/__registry__/index.ts index 6c74205f..00289842 100644 --- a/apps/www/__registry__/index.ts +++ b/apps/www/__registry__/index.ts @@ -21505,3 +21505,4 @@ export const Index: Record = { }, }, } + diff --git a/apps/www/scripts/build-registry.ts b/apps/www/scripts/build-registry.ts index cacd04d5..e9e5e9d4 100644 --- a/apps/www/scripts/build-registry.ts +++ b/apps/www/scripts/build-registry.ts @@ -232,7 +232,7 @@ export const Index: Record = { // // // Write component file. // // rimraf.sync(targetFilePath) - // // await fs.writeFile(targetFilePath, code, 'utf8') + // // await writeFile(targetFilePath, code, 'utf8') // // return { // // name: chunkName, @@ -266,8 +266,8 @@ export const Index: Record = { // } // rimraf.sync(sourcePath) - // // await fs.writeFile(sourcePath, sourceFile.getText()) - // await fs.writeFile(sourcePath, raw) + // // await writeFile(sourcePath, sourceFile.getText()) + // await writeFile(sourcePath, raw) // } let componentPath = `@/registry/${style.name}/${type}/${item.name}` @@ -346,15 +346,14 @@ export const Index: Record = { }) const registryJson = JSON.stringify(items, null, 2) rimraf.sync(path.join(REGISTRY_PATH, 'index.json')) - await fs.writeFile( + await writeFile( path.join(REGISTRY_PATH, 'index.json'), registryJson, - 'utf8', ) // Write style index. rimraf.sync(path.join(process.cwd(), '__registry__/index.ts')) - await fs.writeFile(path.join(process.cwd(), '__registry__/index.ts'), index) + await writeFile(path.join(process.cwd(), '__registry__/index.ts'), index) } // ---------------------------------------------------------------------------- @@ -458,10 +457,9 @@ async function buildStyles(registry: Registry) { }) if (payload.success) { - await fs.writeFile( + await writeFile( path.join(targetPath, `${item.name}.json`), - `${JSON.stringify(payload.data, null, 2)}\r\n`, - 'utf8', + JSON.stringify(payload.data, null, 2), ) } } @@ -471,10 +469,10 @@ async function buildStyles(registry: Registry) { // Build registry/styles/index.json. // ---------------------------------------------------------------------------- const stylesJson = JSON.stringify(styles, null, 2) - await fs.writeFile( + await writeFile( path.join(REGISTRY_PATH, 'styles/index.json'), stylesJson, - 'utf8', + ) } @@ -510,10 +508,10 @@ async function buildStylesIndex() { files: [], } - await fs.writeFile( + await writeFile( path.join(targetPath, 'index.json'), JSON.stringify(payload, null, 2), - 'utf8', + ) } } @@ -560,10 +558,10 @@ async function buildThemes() { } } - await fs.writeFile( + await writeFile( path.join(colorsTargetPath, 'index.json'), - `${JSON.stringify(colorsData, null, 2)}\r\n`, - 'utf8', + JSON.stringify(colorsData, null, 2), + ) // ---------------------------------------------------------------------------- @@ -682,10 +680,9 @@ async function buildThemes() { colors: base.cssVars, }) - await fs.writeFile( + await writeFile( path.join(REGISTRY_PATH, `colors/${baseColor}.json`), - `${JSON.stringify(base, null, 2)}\r\n`, - 'utf8', + JSON.stringify(base, null, 2), ) // ---------------------------------------------------------------------------- @@ -766,10 +763,9 @@ async function buildThemes() { ) } - await fs.writeFile( + await writeFile( path.join(REGISTRY_PATH, `themes.css`), themeCSS.join('\n'), - 'utf8', ) // ---------------------------------------------------------------------------- @@ -809,10 +805,9 @@ async function buildThemes() { await fs.mkdir(targetPath, { recursive: true }) } - await fs.writeFile( + await writeFile( path.join(targetPath, `${payload.name}.json`), JSON.stringify(payload, null, 2), - 'utf8', ) } } @@ -830,10 +825,9 @@ async function buildIcons() { const iconsData = icons - await fs.writeFile( + await writeFile( path.join(iconsTargetPath, 'index.json'), JSON.stringify(iconsData, null, 2), - 'utf8', ) } @@ -870,10 +864,9 @@ export const Icons = { // Write style index. rimraf.sync(path.join(process.cwd(), '__registry__/icons.ts')) - await fs.writeFile( + await writeFile( path.join(process.cwd(), '__registry__/icons.ts'), index, - 'utf8', ) } @@ -881,10 +874,9 @@ try { const content = await crawlContent() const result = registrySchema.safeParse([...registry, ...content]) - await fs.writeFile( + await writeFile( path.join(REGISTRY_PATH, 'temp.json'), JSON.stringify(result.data ?? '', null, 2), - 'utf8', ) if (!result.success) { @@ -907,3 +899,11 @@ catch (error) { console.error(error) process.exit(1) } + +async function writeFile(path: string, payload: any) { + return fs.writeFile( + path, + `${payload}\r\n`, + 'utf8', + ) +} diff --git a/apps/www/src/public/r/index.json b/apps/www/src/public/r/index.json index 309e2cdc..ce9989f0 100644 --- a/apps/www/src/public/r/index.json +++ b/apps/www/src/public/r/index.json @@ -4133,4 +4133,4 @@ } ] } -] +] diff --git a/apps/www/src/public/r/styles/default/index.json b/apps/www/src/public/r/styles/default/index.json index cfc8b34e..2ea6ce1f 100644 --- a/apps/www/src/public/r/styles/default/index.json +++ b/apps/www/src/public/r/styles/default/index.json @@ -18,4 +18,4 @@ }, "cssVars": {}, "files": [] -} +} diff --git a/apps/www/src/public/r/styles/index.json b/apps/www/src/public/r/styles/index.json index 01e5b23f..f814dfac 100644 --- a/apps/www/src/public/r/styles/index.json +++ b/apps/www/src/public/r/styles/index.json @@ -7,4 +7,4 @@ "name": "default", "label": "Default" } -] +] diff --git a/apps/www/src/public/r/styles/new-york/index.json b/apps/www/src/public/r/styles/new-york/index.json index 238a7675..5baa4e05 100644 --- a/apps/www/src/public/r/styles/new-york/index.json +++ b/apps/www/src/public/r/styles/new-york/index.json @@ -18,4 +18,4 @@ }, "cssVars": {}, "files": [] -} +} diff --git a/apps/www/src/public/r/temp.json b/apps/www/src/public/r/temp.json index 6a655987..35ca9c80 100644 --- a/apps/www/src/public/r/temp.json +++ b/apps/www/src/public/r/temp.json @@ -13484,4 +13484,4 @@ } ] } -] +] diff --git a/apps/www/src/public/r/themes.css b/apps/www/src/public/r/themes.css index f953bb05..de03d749 100644 --- a/apps/www/src/public/r/themes.css +++ b/apps/www/src/public/r/themes.css @@ -765,4 +765,4 @@ --destructive-foreground: 210 20% 98%; --ring: 263.4 70% 50.4%; -} \ No newline at end of file +} diff --git a/apps/www/src/public/r/themes/gray.json b/apps/www/src/public/r/themes/gray.json index 789a8203..a3ade59b 100644 --- a/apps/www/src/public/r/themes/gray.json +++ b/apps/www/src/public/r/themes/gray.json @@ -55,4 +55,4 @@ "chart-5": "340 75% 55%" } } -} +} diff --git a/apps/www/src/public/r/themes/neutral.json b/apps/www/src/public/r/themes/neutral.json index cb928ac2..dae819bb 100644 --- a/apps/www/src/public/r/themes/neutral.json +++ b/apps/www/src/public/r/themes/neutral.json @@ -55,4 +55,4 @@ "chart-5": "340 75% 55%" } } -} +} diff --git a/apps/www/src/public/r/themes/slate.json b/apps/www/src/public/r/themes/slate.json index b0f1bb85..7a9e142f 100644 --- a/apps/www/src/public/r/themes/slate.json +++ b/apps/www/src/public/r/themes/slate.json @@ -55,4 +55,4 @@ "chart-5": "340 75% 55%" } } -} +} diff --git a/apps/www/src/public/r/themes/stone.json b/apps/www/src/public/r/themes/stone.json index 425b2ee8..d809ac85 100644 --- a/apps/www/src/public/r/themes/stone.json +++ b/apps/www/src/public/r/themes/stone.json @@ -55,4 +55,4 @@ "chart-5": "340 75% 55%" } } -} +} diff --git a/apps/www/src/public/r/themes/zinc.json b/apps/www/src/public/r/themes/zinc.json index edd349eb..cec2d006 100644 --- a/apps/www/src/public/r/themes/zinc.json +++ b/apps/www/src/public/r/themes/zinc.json @@ -55,4 +55,4 @@ "chart-5": "340 75% 55%" } } -} +}