Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Review app Sass compile after error #4239

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 8 additions & 9 deletions shared/tasks/npm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ export async function run(name, args = [], options) {
throw new Error(`Task '${name}' not found in '${pkgPath}'`)
}
} catch (cause) {
const error = new Error(`Task for npm script '${name}' failed`, { cause })

// Skip errors by default to allow Gulp to resume tasks
if (['test', 'production'].includes(process.env.NODE_ENV)) {
throw new PluginError(`npm run ${name}`, error, {
showProperties: false,
showStack: false
})
// Skip Nodemon (SIGINT) exit or aborted task error codes
// https://github.com/open-cli-tools/concurrently/pull/359/files
if (cause.signal === 'SIGINT' || [130, 3221225786].includes(cause.code)) {
return
}

console.error(error.message)
throw new PluginError(`npm run ${name}`, cause, {
// Hide error properties already formatted by npm
showProperties: false
})
}
}

Expand Down
7 changes: 5 additions & 2 deletions shared/tasks/scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { loadConfigFile } from 'rollup/dist/loadConfigFile.js'
* Compile JavaScript task
*
* @param {string} pattern - Minimatch pattern
* @param {AssetEntry[1]} [options] - Asset options for script(s)
* @param {AssetEntry[1]} options - Asset options for script(s)
*/
export async function compile(pattern, options) {
const modulePaths = await getListing(pattern, {
Expand All @@ -21,7 +21,10 @@ export async function compile(pattern, options) {
await compileJavaScript([modulePath, options])
}
} catch (cause) {
throw new PluginError('shared/tasks/scripts', cause)
throw new PluginError(`scripts.compile('${pattern}')`, cause, {
// Show additional error properties from Babel etc
showProperties: true
})
}
}

Expand Down
9 changes: 6 additions & 3 deletions shared/tasks/styles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { assets } from './index.mjs'
* Compile Sass to CSS task
*
* @param {string} pattern - Minimatch pattern
* @param {AssetEntry[1]} options - Asset options
* @param {AssetEntry[1]} options - Asset options for stylesheet(s)
*/
export async function compile(pattern, options) {
const modulePaths = await getListing(pattern, {
Expand All @@ -26,10 +26,13 @@ export async function compile(pattern, options) {

try {
for (const modulePath of modulePaths) {
compileStylesheet([modulePath, options])
await compileStylesheet([modulePath, options])
}
} catch (cause) {
throw new PluginError('shared/tasks/styles', cause)
throw new PluginError(`styles.compile('${pattern}')`, cause, {
// Hide error properties already formatted by Sass
showProperties: false
})
}
}

Expand Down