Skip to content

Commit

Permalink
displayName property in package.json (#174)
Browse files Browse the repository at this point in the history
* displayName property in package.json

* "version": "0.0.50"
  • Loading branch information
tomer-epstein authored Mar 9, 2020
1 parent 8842999 commit 85edc69
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"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.49",
"version": "0.0.50",
"engines": {
"vscode": "^1.39.2"
},
Expand Down
3 changes: 2 additions & 1 deletion backend/src/yeomanui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ export class YeomanUI {
}

const genMessage = _.get(packageJson, "description", YeomanUI.defaultMessage);
const genPrettyName = titleize(humanizeString(genName));
const genDisplayName = _.get(packageJson, "displayName", '');
const genPrettyName = _.isEmpty(genDisplayName) ? titleize(humanizeString(genName)) : genDisplayName;
const genHomepage = _.get(packageJson, "homepage", '');

return {
Expand Down
4 changes: 2 additions & 2 deletions backend/tests/yeomanui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ describe('yeomanui unit test', () => {

fsExtraMock.expects("readFile").withExactArgs(path.join("test1Path", PACKAGE_JSON), UTF8).resolves(`{"generator-filter": {"type": "project"}, "description": "test1Description"}`);
fsExtraMock.expects("readFile").withExactArgs(path.join("test2Path", PACKAGE_JSON), UTF8).resolves(`{"generator-filter": {"type": "module"}}`);
fsExtraMock.expects("readFile").withExactArgs(path.join("test3Path", PACKAGE_JSON), UTF8).resolves(`{"description": "test3Description"}`);
fsExtraMock.expects("readFile").withExactArgs(path.join("test3Path", PACKAGE_JSON), UTF8).resolves(`{"description": "test3Description", "displayName": "3rd - Test"}`);

yeomanUi.setGenFilter(GeneratorFilter.create());
const result = await yeomanUi.getGenerators();
Expand All @@ -388,7 +388,7 @@ describe('yeomanui unit test', () => {
const test3Choice = result.questions[0].choices[2];
expect(test1Choice.prettyName).to.be.equal("Test1 Project");
expect(test2Choice.prettyName).to.be.equal("Test2 Module");
expect(test3Choice.prettyName).to.be.equal("Test3");
expect(test3Choice.prettyName).to.be.equal("3rd - Test");
});

it("get generators with homepage", async () => {
Expand Down

0 comments on commit 85edc69

Please sign in to comment.