Skip to content

Commit

Permalink
fix(ui5-tooling-transpile): allow to break build with failOnDtsErrors…
Browse files Browse the repository at this point in the history
…=true (#1148)

Fixes #1145
  • Loading branch information
petermuessig authored Jan 8, 2025
1 parent cbbcd11 commit 37ca8aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/ui5-tooling-transpile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ npm install ui5-tooling-transpile --save-dev
- generateDts: `boolean`
if enabled, the tooling extension will generate type definitions (`.d.ts`) files; by default for projects of type `library` this option is considered as `true` and for other projects such as `application` this option is considered as `false` by default (is only relevant in case of transformTypeScript is `true`)

- failOnDtsErrors: `boolean`
if enabled, the tooling extension will fail during the generation of type definitions (`.d.ts`) files; this option is considered as `false` by default (is only relevant in case of generateDts is `true`)

- omitTSFromBuildResult: `boolean`
if enabled, the TypeScript sources will be omitted from the build result. This will disable the debugging support in the TypeScript sources (since the related source files aren't included anymore)

Expand Down
6 changes: 5 additions & 1 deletion packages/ui5-tooling-transpile/lib/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ module.exports = async function ({ log, workspace /*, dependencies*/, taskUtil,
await workspace.write(indexDtsFile);
} else {
// error diagnostics
log.error(
throw new Error(
`The following errors occured during d.ts generation: \n${ts.formatDiagnostics(
result.diagnostics,
host
Expand All @@ -400,7 +400,11 @@ module.exports = async function ({ log, workspace /*, dependencies*/, taskUtil,
}
} catch (e) {
// typescript dependency should be available, otherwise we can't generate the dts files
// or if a d.ts file is not valid, the generation will fail and we report the error
log.error(`Generating d.ts failed! Reason: ${e.message}\n${e.stack}`);
if (config.failOnDtsErrors) {
throw e;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/ui5-tooling-transpile/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ module.exports = function (log) {
omitTSFromBuildResult: config.omitTSFromBuildResult,
generateTsInterfaces,
generateDts: config.generateDts,
failOnDtsErrors: config.failOnDtsErrors,
transpileDependencies: config.transpileDependencies,
transformAtStartup: config.transformAtStartup,
transformTypeScript,
Expand Down

0 comments on commit 37ca8aa

Please sign in to comment.