diff --git a/packages/next/bundleScss.js b/packages/next/bundleScss.js index 45b07d895..76da7a8da 100644 --- a/packages/next/bundleScss.js +++ b/packages/next/bundleScss.js @@ -14,12 +14,12 @@ async function build() { plugins: [sassPlugin({ css: 'external' })], }) - await fs.rename('dist/prod/esbuildEntry.css', 'dist/prod/styles.css', (err) => { - if (err) { - console.error(`Error while renaming index.css: ${err}`) - throw err - } - }) + try { + fs.renameSync('dist/prod/esbuildEntry.css', 'dist/prod/styles.css') + } catch (err) { + console.error(`Error while renaming index.css: ${err}`) + throw err + } console.log('styles.css bundled successfully') @@ -32,12 +32,12 @@ async function build() { ] for (const file of filesToDelete) { - await fs.unlink(file, (err) => { - if (err) { - console.error(`Error while deleting ${file}: ${err}`) - throw err - } - }) + try { + fs.unlinkSync(file) + } catch (err) { + console.error(`Error while deleting ${file}: ${err}`) + throw err + } } console.log('Files renamed and deleted successfully') diff --git a/packages/richtext-lexical/bundle.js b/packages/richtext-lexical/bundle.js index babb73f71..49263f5cc 100644 --- a/packages/richtext-lexical/bundle.js +++ b/packages/richtext-lexical/bundle.js @@ -30,9 +30,13 @@ async function build() { //external: ['*.svg'], plugins: [sassPlugin({ css: 'external' })], }) - await fs.rename('dist/field/index.css', 'dist/exports/client/bundled.css', (err) => { - if (err) console.error(`Error while renaming index.css: ${err}`) - }) + + try { + fs.renameSync('dist/field/index.css', 'dist/exports/client/bundled.css') + } catch (err) { + console.error(`Error while renaming index.css: ${err}`) + throw err + } console.log('dist/field/bundled.css bundled successfully') diff --git a/packages/ui/bundle.js b/packages/ui/bundle.js index 952f45fef..45b8f929d 100644 --- a/packages/ui/bundle.js +++ b/packages/ui/bundle.js @@ -68,19 +68,20 @@ async function build() { packages: 'external', plugins: [sassPlugin({ css: 'external' })], }) - await fs.rename('dist/index.css', 'dist/styles.css', (err) => { - if (err) { - console.error(`Error while renaming index.css: ${err}`) - throw err - } - }) - await fs.unlink('dist/index.js', (err) => { - if (err) { - console.error(`Error while deleting index.js: ${err}`) - throw err - } - }) + try { + fs.renameSync('dist/index.css', 'dist/styles.css') + } catch (err) { + console.error(`Error while renaming index.css: ${err}`) + throw err + } + + try { + fs.unlinkSync('dist/index.js') + } catch (err) { + console.error(`Error while deleting index.js: ${err}`) + throw err + } console.log('styles.css bundled successfully') // Bundle `client.ts` diff --git a/scripts/delete-recursively.js b/scripts/delete-recursively.js index 37bfd739a..f1085b484 100644 --- a/scripts/delete-recursively.js +++ b/scripts/delete-recursively.js @@ -1,5 +1,5 @@ import { promises as fs, existsSync } from 'fs' -import path, { join } from 'path' +import { join } from 'path' import globby from 'globby' import process from 'node:process' import chalk from 'chalk'