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
+8 -7
View File
@@ -4,12 +4,13 @@ const snakeCase = require('lodash.snakecase');
const { Confirm } = require('enquirer');
export const defaultMenuSettings = {
showHelp: false
showHelp: false,
};
export type TConfig = {
gh_token: string;
photowall_repo: string;
mandrill_api_key: string;
};
export const getSettings = async (toolbox): Promise<TConfig | null> => {
const { filesystem, print } = toolbox;
@@ -24,7 +25,7 @@ export const getSettings = async (toolbox): Promise<TConfig | null> => {
No config found, please run [ ${chalk.cyan(
'pwcli s se'
)} ] or setup > settings from the menu.
`);
return null;
}
@@ -40,7 +41,7 @@ export const getCurrentBranch = async (
// git rev-parse --abbrev-ref HEAD
const branch = await system.run('git rev-parse --abbrev-ref HEAD', {
cwd: config.photowall_repo,
trim: true
trim: true,
});
console.log(`branch`, branch);
return branch;
@@ -48,14 +49,14 @@ export const getCurrentBranch = async (
return null;
};
export const issueToBranchName = issue => {
export const issueToBranchName = (issue) => {
return `${issue.number}-${snakeCase(issue.title).substr(0, 40)}`;
};
export const confirmMessage = async (message: string) => {
const confirm = new Confirm({
name: 'confirm',
message: message
message: message,
});
try {
@@ -66,6 +67,6 @@ export const confirmMessage = async (message: string) => {
}
};
export const sleep = milliseconds => {
return new Promise(resolve => setTimeout(resolve, milliseconds));
export const sleep = (milliseconds) => {
return new Promise((resolve) => setTimeout(resolve, milliseconds));
};