Skip to content

Commit 35161c5

Browse files
Merge pull request #26 from antstackio/dev
Dev
2 parents 0d9d7f7 + 3caaac2 commit 35161c5

File tree

3 files changed

+18
-34
lines changed

3 files changed

+18
-34
lines changed

bin/index.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function run(argv:AnyObject) {
2525
let stack_names: any = {};
2626
let customStacks: any = {};
2727
let paramModule:AnyObject={};
28-
var basecrud:AnyObject={} ;
28+
let basecrud:AnyObject={} ;
2929
let StackParams: any = {};
3030
let moreStack: any;
3131
let stackname:object= {};
@@ -40,12 +40,6 @@ async function run(argv:AnyObject) {
4040
if (AppType !== "Customizable") {
4141
stackname[`stackName${i}`]=util.makeid(2)
4242
let stack_name = stackname
43-
// let stack_name = await util.inputString(
44-
// `stackName${i}`,
45-
// `Stack ${i} Name: `,
46-
// ""
47-
// );
48-
//console.log(stack_name)
4943
let stackName:string = stack_name[`stackName${i}`];
5044
if (AppType === "CRUD") {
5145
let crud:AnyObject={} ;
@@ -63,7 +57,6 @@ async function run(argv:AnyObject) {
6357
);
6458
} while (moreStack !== "No");
6559

66-
//console.log("obj",obj)
6760
StackParams = { ...obj };
6861
} else {
6962
paramModule = await util.params(AppType);
@@ -91,15 +84,15 @@ async function run(argv:AnyObject) {
9184
if (stack_names !== null ) template = { ...template, Stacks: stack_names ,StackParams};
9285
if (customStacks !== null)
9386
template = { ...template, CustomStacks: customStacks };
94-
// console.log(JSON.stringify(template))
87+
9588
await rover_utilities.generationSAM(({template})["template"]);
9689
};
97-
//await rover_utilities.generationSAM(input);
90+
9891
} else if (editedSam === "add components to existing SAM") {
9992

10093
let app_name = await util.inputString("app_name", "App Name","");
10194
await rover_utilities.checkFile(app_name["app_name"],"yes")
102-
//console.log(app_name)
95+
10396
let language = await util.languageChoice();
10497
let file_name = await exec("ls " + app_name["app_name"] + "/" + "*.yaml ").toString();
10598
let CompStacks = await rover_utilities.checkNested(file_name);
@@ -144,7 +137,7 @@ async function run(argv:AnyObject) {
144137
}
145138

146139
} while (moreStack !== "No"|| choiceLength===0)
147-
//console.log(JSON.stringify(template, null, 2));
140+
148141
await rover_utilities.addComponents(template)
149142
}else if (editedSam === "add modules to existing SAM") {
150143
console.log("Work in progress...");
@@ -162,7 +155,7 @@ async function run(argv:AnyObject) {
162155
template = { ...template, repoConfig };
163156
let repoconfig = await Promise.resolve(util.jsonCreation(template));
164157
if (repoconfig !== undefined) {
165-
//await rover_utilities.checkFile(JSON.parse(repoconfig)["repoConfig"]["app_name"],"yes")
158+
166159
await deployment.setupRepo(JSON.parse(repoconfig)["repoConfig"]);
167160
}
168161
}
@@ -181,7 +174,7 @@ async function run(argv:AnyObject) {
181174
}
182175
if (stack_name["stack_name"]=="") {stack_name=file_name+"roverTest"}else{stack_name=stack_name["stack_name"]}
183176
let region=deploymentregion["Deployment region"]
184-
// console.log(typeof stack_name,stack_name)
177+
185178
exec("sh " + rover_utilities.npmroot +"/@rover-tools/cli/cli-main/exec.sh "+file_name+" "+stack_name+" "+region+" "+bucketName);
186179

187180
}
@@ -200,7 +193,7 @@ async function run(argv:AnyObject) {
200193

201194
}
202195
}
203-
//export let resource_type = ({} = res);
196+
204197
export let stackNames: any = stack_resource_Name;
205198
let moreStack;
206199
let customStacks:AnyObject;

cli-main/buildConfig.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ export let samConfig = {
3636
samBuild: [
3737

3838

39-
// { key: "name", value: "string" ,message:"Name:"},
40-
//{ key: "app_name", value: "string",message:"App Name:" },
39+
4140
{ key: "repoType", value: "choice",message:"Repo Type:" },
4241
{ key: "tool", value: "choice",message:"Tools:" },
43-
//{ key: "language", value: "choice",message:"Language:" },
44-
//{ key: "framework", value: "choice",message:"Framework:" },
42+
4543

4644
]
4745
}

cli-main/util.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ import * as init from "../bin/index";
33
import * as inquirer from "inquirer";
44
import * as cliConfig from "./cliConfig";
55
import * as buildConfig from "./buildConfig";
6-
var fs = require("fs");
6+
let fs = require("fs");
77
let Yaml = require("js-yaml");
88
const exec = require("child_process").execSync;
9-
var path = require('path');
109
const moduleParams = require("@rover-tools/engine").rover_modules;
1110
const Stack = require("@rover-tools/engine").rover_modules;
1211
import * as awsConfig from "./configaws";
1312
import { AnyArray, AnyObject } from "immer/dist/internal";
1413
const rover_utilities= require("@rover-tools/engine").rover_utilities;
1514
const TOML = require('@iarna/toml')
16-
let config = {};
1715
let pythonpattern=new RegExp(/python[1-9]*\.[1-9]*/g)
1816
let jspattern=new RegExp(/nodejs[1-9]*\.[a-zA-Z]*/g)
1917
let yamlpattern=new RegExp(/(\.yaml$)/g)
@@ -59,7 +57,7 @@ export let inputString = async function (userName: string, message = "",defaults
5957
message: message,
6058
validate: function (value) {
6159
if (userName=="path"){
62-
var pass = apipathpattern.test(value)
60+
let pass = apipathpattern.test(value)
6361
if (pass) {
6462
return true
6563
}
@@ -133,21 +131,16 @@ export let inputNumber = async function (userName: string,message:string) {
133131
message: `Please enter the required number of ${displayname} you want ?`,
134132
name: `${userName}`,
135133
validate: function (value) {
136-
var pass = !isNaN(value)
134+
let pass = !isNaN(value)
137135
if (pass) {
138136
return true
139137
}
140138
return 'Please enter a valid number'
141-
// if (isNaN(value)) {
142-
// return "Please enter valid number"
143-
// // return inputNumber(userName,message)
144-
// } else {
145-
// return true;
146-
// }
139+
147140
},
148141
},
149142
])
150-
// console.log(takeInput)
143+
151144
return parseInt(takeInput[`${userName}`],10);
152145
};
153146

@@ -304,7 +297,7 @@ export let inputCli = async function (
304297
let FnGetAtt: any = [];
305298
FnGetAtt.push(r["Fn::GetAtt"]);
306299
FnGetAtt.push("Arn");
307-
temp = { FnGetAtt }; //"Fn::GetAtt": ["PostSignup","Arn"]
300+
temp = { FnGetAtt };
308301
} else if (p === "Ref") {
309302
temp = { ...r };
310303
} else {
@@ -432,7 +425,7 @@ Object.assign(temp,ele)
432425
deploymentparameters,
433426
...deploymentEvent,
434427
};
435-
//console.log(JSON.stringify(result, null, 2));
428+
436429
return result;
437430
};
438431

@@ -561,5 +554,5 @@ export let samValidate=function(){
561554
}
562555
export let makeid =function (length) {
563556
const crypto = require('crypto');
564-
return (crypto.randomBytes(1).toString("base64url").replace(/[0-9]/g, 'd')).toLowerCase();
557+
return (crypto.randomBytes(1).toString("base64url").replace(/\d/g, 'd')).toLowerCase();
565558
}

0 commit comments

Comments
 (0)