Skip to content

Commit

Permalink
forward environment errors (#250)
Browse files Browse the repository at this point in the history
* forward environment errors

* Update .nycrc.json
  • Loading branch information
slavik-lvovsky authored May 4, 2020
1 parent f940135 commit 52b0b20
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions backend/.nycrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"report-dir": "./reports/coverage",
"check-coverage": true,
"branches": 81.8,
"lines": 87.3,
"lines": 87.1,
"functions": 81.3,
"statements": 86.8
"statements": 86.6
}
7 changes: 4 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"license": "Apache 2.0",
"description": "Provide rich user experience for Yeoman generators using VSCode extension or the browser",
"repository": "https://github.com/SAP/yeoman-ui",
"version": "0.0.79",
"version": "0.0.80",
"engines": {
"vscode": "^1.39.2"
},
"categories": [
"Other"
],
"activationEvents": [
"*",
"onCommand:loadYeomanUI",
"onWebviewPanel:yeomanui"
],
Expand Down Expand Up @@ -105,7 +106,7 @@
"strip-ansi": "^6.0.0",
"titleize": "^1.0.1",
"ws": "^7.2.5",
"yeoman-environment": "2.8.0"
"yeoman-environment": "2.10.0"
},
"devDependencies": {
"@types/chai": "^4.2.9",
Expand All @@ -117,7 +118,7 @@
"@types/object-hash": "^1.3.1",
"@types/sinon": "^7.5.0",
"@types/ws": "^6.0.3",
"@types/yeoman-environment": "^2.3.2",
"@types/yeoman-environment": "^2.3.3",
"bufferutil": "^4.0.1",
"chai": "^4.2.0",
"copy-webpack-plugin": "^5.0.5",
Expand Down
14 changes: 6 additions & 8 deletions backend/src/yeomanui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ export class YeomanUI {
const targetFolder = this.getCwd();
await fsextra.mkdirs(targetFolder);
const dirsBefore = await this.getChildDirectories(targetFolder);
const env: Environment = Environment.createEnv(undefined, {}, this.youiAdapter);
const env: Environment = Environment.createEnv(undefined, {newErrorHandler: true}, this.youiAdapter);
const meta: Environment.GeneratorMeta = this.getGenMetadata(generatorName);
// TODO: support sub-generators
// @ts-ignore
env.register(meta.resolved, meta.namespace, meta.packagePath);

Expand All @@ -155,12 +154,11 @@ export class YeomanUI {
this.promptCount = 0;
this.gen = (gen as Generator);
this.gen.destinationRoot(targetFolder);
/* Generator.run() returns promise. Sending a callback is deprecated:
https://yeoman.github.io/generator/Generator.html#run
... but .d.ts hasn't been updated for a while:
https://www.npmjs.com/package/@types/yeoman-generator */
this.gen.run(async (err) => {
if (!err) {

env.run(generatorName, {}, async error => {
if (error) {
this.onGeneratorFailure(generatorName, error);
} else {
const dirsAfter = await this.getChildDirectories(this.gen.destinationRoot());
this.onGeneratorSuccess(generatorName, dirsBefore, dirsAfter);
}
Expand Down

0 comments on commit 52b0b20

Please sign in to comment.