Skip to content

Commit 026e52b

Browse files
committed
feature: adding modules to existing stack
1 parent dd9becb commit 026e52b

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

bin/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ async function run(argv: Array<string>): Promise<void> {
3939
console.log(commandErrors)
4040
}
4141
} catch (error) {
42-
console.log("Error: ", (error as Error).message)
42+
console.log("Error: ", error as Error)
43+
//.message)
4344
}
4445
}
4546
run(process.argv.slice(2))

src/roverCLI/roverGenerateCLI.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const rover_helpers = rover.helpers
33
const rover_addComponent = rover.addComponents
44
const rover_addModules = rover.addModules
55
const rover_generateSAM = rover.generateSAM
6+
const rover_addModulesToexisting = rover.addModulesToExisting
67
import * as util from "../utilities/cliUtil"
78
import * as cliConfig from "../configs/cliConfig"
89
import { createModules, roverADD } from "../utilities/helper"
@@ -87,7 +88,6 @@ export async function addComponentCLI() {
8788
)
8889
i = i + 1
8990
} while (moreStack !== "No")
90-
console.log(JSON.stringify(template))
9191
await rover_addComponent.addComponents(template)
9292
}
9393
export async function addModuleCLI(): Promise<void> {
@@ -123,6 +123,9 @@ export async function addModuleCLI(): Promise<void> {
123123
const moduletemplate = <IroveraddModule>(
124124
await createModules(app_name, language)
125125
)
126+
Object.keys(moduletemplate.stackDetails).forEach((ele) => {
127+
moduletemplate.stackDetails[ele].stackName = selectedchoice[0]
128+
})
126129
if (Object.keys(template).length == 0) {
127130
template = moduletemplate
128131
} else {
@@ -131,9 +134,6 @@ export async function addModuleCLI(): Promise<void> {
131134
...moduletemplate.stackDetails,
132135
}
133136
}
134-
Object.keys(template.stackDetails).forEach((ele) => {
135-
template.stackDetails[ele].stackName = selectedchoice[0]
136-
})
137137
} else {
138138
const choice = cliConfig.customizable.components
139139
const Compnents = <Array<string>>(
@@ -143,21 +143,21 @@ export async function addModuleCLI(): Promise<void> {
143143
if (customStacks !== null)
144144
template = {
145145
...template,
146-
file_name,
147146
...Compnents,
148147
}
149148
}
150-
151149
moreStack = await util.moreStack(
152-
"Do you want to add one more modules to this stack ?"
150+
"Do you want to add one more modules to another stack ?"
153151
)
154-
155152
i = i + 1
156153
} while (moreStack !== "No")
154+
template["file_name"] = file_name
155+
console.log("template", JSON.stringify(template))
156+
await rover_addModulesToexisting.addModulesToExistingStack(template)
157157
} else {
158158
template = <IroveraddModule>await createModules(app_name, language)
159-
template["file_name"] = file_name
160-
await rover_addModules.addModules(template)
159+
160+
console.log("template", JSON.stringify(template))
161+
await rover_addModules.addModules(template)
161162
}
162-
163163
}

src/utilities/cliUtil.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export const multichoice = async function (
2020
) {
2121
let messages = ""
2222
if (message == "") {
23-
messages = `Please select your ${name
24-
.charAt(0)
25-
.toUpperCase()} ${name.slice(1)} :`
23+
messages = `Please select your ${name.charAt(0).toUpperCase()}${name.slice(
24+
1
25+
)} :`
2626
} else {
2727
messages = message
2828
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"module": "commonjs" /* Specify what module code is generated. */,
2828
//"rootDir": "ts", /* Specify the root folder within your source files. */
2929
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
30+
"baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3131
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3232
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
3333
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */

0 commit comments

Comments
 (0)