chore: ensure fs operations in bundle scripts finish in sync (#7218)
Hopefully fixes broken releases
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user