Add command to fix templates (#21)

* add command to fix templates

* replaceAll and lint fixes

* fixed menu

* fix lint command and run it

* add basic error handling for listing of templates

* CR suggestions

---------

Co-authored-by: Arwid Thornström <arwidt@gmail.com>
This commit is contained in:
Anders Gustafsson
2024-08-16 09:34:15 +02:00
committed by GitHub
co-authored by Arwid Thornström
parent bc9ba08e76
commit 724f3905ab
28 changed files with 248 additions and 14310 deletions
@@ -12,7 +12,7 @@ const getConfirmation = async (branchName: string, stackName: string) => {
name: 'confirm',
message: `Will create ${chalk.yellow(
url + '.photowall-test.xx'
)} and publish ${chalk.green(branchName)} to it, continue?`
)} and publish ${chalk.green(branchName)} to it, continue?`,
});
try {
@@ -49,27 +49,27 @@ module.exports = {
'Photowall',
'photowall'
);
const branchOptions = branches.map(item => item.name);
const branchOptions = branches.map((item) => item.name);
const promptBranch = new AutoComplete({
name: 'branchName',
message: 'Select a branch',
limit: 10,
initial: 10,
choices: branchOptions
choices: branchOptions,
});
const branchName = await promptBranch.run();
const testStacks = await getTestStacksInfo(toolbox);
const testStacks = await getTestStacksInfo(toolbox);
const options = testStacks.map(item => {
const options = testStacks.map((item) => {
return item.name;
});
const input = new Input({
type: 'input',
name: 'stack',
message: `Subdomain of new server (${chalk.yellow('test-xxx')})`
message: `Subdomain of new server (${chalk.yellow('test-xxx')})`,
});
const stacksuffix = await input.run();
const stackName = `photowall-${stacksuffix}`;
@@ -117,7 +117,7 @@ module.exports = {
);
const output = await system.run(cmd, {
cwd: `${config.photowall_repo}/cloudformation/`,
trim: true
trim: true,
});
print.fancy(output);
}
@@ -131,5 +131,5 @@ module.exports = {
defaultMenuSettings
);
}
}
},
};