Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
feat: code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vamsimundra committed Jul 30, 2021
1 parent 446bf13 commit 8d068e3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/generators/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ class App extends Generator {
{...opts, name: sfdxExampleCommand, topic})
}

if (!fs.existsSync('messages/messages.json')) {
this.fs.copyTpl(this.templatePath('messages/messages.json'), this.destinationPath(`messages/${sfdxExampleCommand}.json`), this)
if (!fs.existsSync('messages/messages.js')) {
this.fs.copyTpl(this.templatePath('messages/messages.js'), this.destinationPath(`messages/${sfdxExampleCommand}.js`), this)
}

if (!fs.existsSync('.vscode/launch.json')) {
Expand Down
13 changes: 13 additions & 0 deletions templates/messages/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
commandDescription: "print a greeting and your org IDs",
nameFlagDescription: "name to print",
forceFlagDescription: "example boolean flag",
errorNoOrgResults: "No results found for the org '%s'.",
example1: `$ sfdx hello:org --targetusername [email protected] --targetdevhubusername [email protected]
Hello world! This is org: MyOrg and I will be around until Tue Mar 20 2018!
My hub org id is: 00Dxx000000001234
`,
example2: `$ sfdx hello:org --name myname --targetusername [email protected]
Hello myname! This is org: MyOrg and I will be around until Tue Mar 20 2018!
`,
};
6 changes: 0 additions & 6 deletions templates/messages/messages.json

This file was deleted.

8 changes: 1 addition & 7 deletions templates/src/sfdxCommand.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ export default class <%- klass %> extends SfdxCommand {
public static description = messages.getMessage('commandDescription');

public static examples = [
`$ sfdx <%- topicName %>:<%- commandName %> --targetusername [email protected] --targetdevhubusername [email protected]
Hello world! This is org: MyOrg and I will be around until Tue Mar 20 2018!
My hub org id is: 00Dxx000000001234
`,
`$ sfdx <%- topicName %>:<%- commandName %> --name myname --targetusername [email protected]
Hello myname! This is org: MyOrg and I will be around until Tue Mar 20 2018!
`,
messages.getMessage('example1'),messages.getMessage('example2'),
];

public static args = [{ name: 'file' }];
Expand Down

0 comments on commit 8d068e3

Please sign in to comment.