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' })],
|
plugins: [sassPlugin({ css: 'external' })],
|
||||||
})
|
})
|
||||||
|
|
||||||
await fs.rename('dist/prod/esbuildEntry.css', 'dist/prod/styles.css', (err) => {
|
try {
|
||||||
if (err) {
|
fs.renameSync('dist/prod/esbuildEntry.css', 'dist/prod/styles.css')
|
||||||
console.error(`Error while renaming index.css: ${err}`)
|
} catch (err) {
|
||||||
throw err
|
console.error(`Error while renaming index.css: ${err}`)
|
||||||
}
|
throw err
|
||||||
})
|
}
|
||||||
|
|
||||||
console.log('styles.css bundled successfully')
|
console.log('styles.css bundled successfully')
|
||||||
|
|
||||||
@@ -32,12 +32,12 @@ async function build() {
|
|||||||
]
|
]
|
||||||
|
|
||||||
for (const file of filesToDelete) {
|
for (const file of filesToDelete) {
|
||||||
await fs.unlink(file, (err) => {
|
try {
|
||||||
if (err) {
|
fs.unlinkSync(file)
|
||||||
console.error(`Error while deleting ${file}: ${err}`)
|
} catch (err) {
|
||||||
throw err
|
console.error(`Error while deleting ${file}: ${err}`)
|
||||||
}
|
throw err
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Files renamed and deleted successfully')
|
console.log('Files renamed and deleted successfully')
|
||||||
|
|||||||
@@ -30,9 +30,13 @@ async function build() {
|
|||||||
//external: ['*.svg'],
|
//external: ['*.svg'],
|
||||||
plugins: [sassPlugin({ css: 'external' })],
|
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')
|
console.log('dist/field/bundled.css bundled successfully')
|
||||||
|
|
||||||
|
|||||||
@@ -68,19 +68,20 @@ async function build() {
|
|||||||
packages: 'external',
|
packages: 'external',
|
||||||
plugins: [sassPlugin({ css: '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) => {
|
try {
|
||||||
if (err) {
|
fs.renameSync('dist/index.css', 'dist/styles.css')
|
||||||
console.error(`Error while deleting index.js: ${err}`)
|
} catch (err) {
|
||||||
throw 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')
|
console.log('styles.css bundled successfully')
|
||||||
// Bundle `client.ts`
|
// Bundle `client.ts`
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { promises as fs, existsSync } from 'fs'
|
import { promises as fs, existsSync } from 'fs'
|
||||||
import path, { join } from 'path'
|
import { join } from 'path'
|
||||||
import globby from 'globby'
|
import globby from 'globby'
|
||||||
import process from 'node:process'
|
import process from 'node:process'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
|
|||||||
Reference in New Issue
Block a user