diff --git a/packages/quill/scripts/babel-svg-inline-import.cjs b/packages/quill/scripts/babel-svg-inline-import.cjs index faa4e8797b..aafb7cbe36 100644 --- a/packages/quill/scripts/babel-svg-inline-import.cjs +++ b/packages/quill/scripts/babel-svg-inline-import.cjs @@ -17,10 +17,14 @@ module.exports = ({ types: t }) => { const id = specifier.local.name; const reference = state && state.file && state.file.opts.filename; const absolutePath = resolve(dirname(reference), givenPath); - const content = optimize( - fs.readFileSync(absolutePath).toString(), - { plugins: [] }, - ).data; + const content = fs.readFileSync(absolutePath).toString(); + let optimizedContent; + try { + optimizedContent = optimize(content, { plugins: [] }).data; + } catch (error) { + console.error(`Error optimizing SVG: ${absolutePath}`, error); + return; + } const variableValue = t.stringLiteral(content); const variable = t.variableDeclarator( diff --git a/scripts/changelog.mjs b/scripts/changelog.mjs index 7124aa47c0..008945e056 100644 --- a/scripts/changelog.mjs +++ b/scripts/changelog.mjs @@ -16,7 +16,14 @@ const changeLogFilePath = join( changelogFilename ); -const currentChangeLog = await readFile(changeLogFilePath, "utf-8"); +(async () => { +try { + const currentChangeLog = await readFile(changeLogFilePath, "utf-8"); + +} catch (error) { + console.error("Error occurred:", error); + process.exit(1); +} const { stdout } = await $`gh release list --exclude-drafts --json=tagName,publishedAt,name,isLatest`; @@ -66,3 +73,9 @@ await $`git add ${changelogFilename}`; const message = `Update ${changelogFilename}: ${release.tagName}`; await $`git commit -m ${message}`; await $`git push origin main`; + +} catch (error) { + console.error("An error occurred:", error); + process.exit(1); +} +})(); diff --git a/scripts/release.js b/scripts/release.js index ad4cc9fb73..e8591affaa 100755 --- a/scripts/release.js +++ b/scripts/release.js @@ -31,9 +31,17 @@ if (!process.env.CI) { exec('echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'); async function main() { - const configGit = (await import("./utils/configGit.mjs")).default; - await configGit(); + try { + const configGit = (await import("./utils/configGit.mjs")).default; + await configGit(); + + + } catch (error) { + console.error("An error occurred:", error); + exitWithError("Exiting due to an error."); + } +} /* * Check that the git working directory is clean */