Update libs (#28)

* added prompt context library

* updated libs, except chalk that should not be updated

* updated libs and fixed speed
This commit is contained in:
Arwid Thornström
2025-06-17 10:12:48 +02:00
committed by GitHub
parent 90b9ccc454
commit 5c43d166ba
27 changed files with 2429 additions and 3457 deletions
+1 -1
View File
@@ -1 +1 @@
v16.13.0
v20.19.2
+7
View File
@@ -0,0 +1,7 @@
{
"trailingComma": "all",
"arrowParens": "always",
"printWidth": 100,
"singleQuote": true,
"semi": true
}
+6 -9
View File
@@ -1,21 +1,18 @@
#!/usr/bin/env node
/* tslint:disable */
// check if we're running in dev mode
var devMode = require('fs').existsSync(`${__dirname}/../src`)
// or want to "force" running the compiled version with --compiled-build
var wantsCompiled = process.argv.indexOf('--compiled-build') >= 0
// check if we want to run in dev mode explicitly
var wantsDev = process.argv.indexOf('--dev') >= 0;
if (wantsCompiled || !devMode) {
// this runs from the compiled javascript source
require(`${__dirname}/../build/cli`).run(process.argv)
} else {
if (wantsDev) {
// this runs from the typescript source (for dev only)
// hook into ts-node so we can run typescript on the fly
require('ts-node').register({ project: `${__dirname}/../tsconfig.json` })
// run the CLI with the current process arguments
require(`${__dirname}/../src/cli`).run(process.argv)
} else {
// this runs from the compiled javascript source
require(`${__dirname}/../build/cli`).run(process.argv)
}
+19 -18
View File
@@ -12,7 +12,8 @@
"clean-build": "rm -rf ./build",
"compile": "tsc -p .",
"copy-templates": "if [ -e ./src/templates ]; then cp -a ./src/templates ./build/; fi",
"build": "yarn format && yarn clean-build && yarn compile && yarn copy-templates",
"copy-promptcontextlibrary-txts": "mkdir -p build/commands/ai/promptcontextlibrary && cp src/commands/ai/promptcontextlibrary/*.txt build/commands/ai/promptcontextlibrary/ || true",
"build": "yarn format && yarn clean-build && yarn compile && yarn copy-templates && yarn copy-promptcontextlibrary-txts",
"prepublishOnly": "yarn build",
"test": "jest",
"watch": "jest --watch",
@@ -30,31 +31,31 @@
],
"license": "MIT",
"dependencies": {
"@lenne.tech/gluegun-menu": "^0.0.5",
"@lenne.tech/gluegun-menu": "^0.0.7",
"@mailchimp/mailchimp_transactional": "^1.0.59",
"@octokit/core": "^3.5.1",
"@octokit/core": "^7.0.2",
"chalk": "^4.1.2",
"cli-select": "^1.1.2",
"clipboardy": "2.3.0",
"enquirer": "^2.3.6",
"clipboardy": "4.0.0",
"enquirer": "^2.4.1",
"gluegun": "latest",
"lodash.snakecase": "^4.1.1",
"strip-ansi": "^7.0.1",
"strip-ansi": "^7.1.0",
"terminal-table-output": "^1.4.0"
},
"devDependencies": {
"@types/jest": "^24.0.18",
"@types/node": "^12.7.11",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^24.1.0",
"prettier": "^2.0.0",
"ts-jest": "^24.1.0",
"ts-node": "^8.4.1",
"typescript": "^3.6.3"
"@types/jest": "^30.0.0",
"@types/node": "^24.0.3",
"@typescript-eslint/eslint-plugin": "^8.34.0",
"@typescript-eslint/parser": "^8.34.0",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.4.1",
"jest": "^30.0.0",
"prettier": "^3.5.3",
"ts-jest": "^29.4.0",
"ts-node": "^10.9.2",
"typescript": "^5.8.3"
},
"jest": {
"preset": "ts-jest",
-6
View File
@@ -14,9 +14,3 @@ needed for the photowall organisation.
# Usage
When running `pwcli` command in the terminal is will open a interactive view but all commands are accessable through shortcuts. So if you want to run status on development testservers its possible to run `pwcli d ts s` for d = development, ts = test servers, s = status. Shortcuts are listed in the interactive view.
TEST
TEST
TEST
TEST
@@ -3,7 +3,7 @@ import * as path from 'path';
import * as fs from 'fs';
import chalk = require('chalk');
const { AutoComplete } = require('enquirer');
const clipboard = require('clipboardy');
import clipboardy from 'clipboardy';
module.exports = {
name: 'promptcontextlibrary',
@@ -22,6 +22,15 @@ module.exports = {
console.log(chalk.cyan('📚 Welcome to the Prompt Context Library! 📚'));
// Check if any .txt files exist
if (files.length === 0) {
console.log(
chalk.yellow('⚠️ No context files (.txt) found in the library.'),
);
console.log(chalk.gray(` Directory: ${currentDir}`));
return;
}
const prompt = new AutoComplete({
name: 'context',
message: chalk.yellow('✨ Select a context file:'),
@@ -36,13 +45,13 @@ module.exports = {
const fileContent = fs.readFileSync(filePath, 'utf8');
// Copy content to clipboard
await clipboard.write(fileContent);
await clipboardy.write(fileContent);
console.log(chalk.green(`🎯 Selected: ${chalk.bold(answer)}`));
console.log(
chalk.magenta(
'📋 Context has been copied to clipboard and is ready to paste! 🚀'
)
'📋 Context has been copied to clipboard and is ready to paste! 🚀',
),
);
} catch (error) {
console.error(chalk.red('❌ Operation cancelled'));
+1 -1
View File
@@ -13,7 +13,7 @@ module.exports = {
const { print, system, strings } = toolbox;
const groups = JSON.parse(
strings.trim(await system.run(`aws logs describe-log-groups`))
strings.trim(await system.run(`aws logs describe-log-groups`)),
);
const options = groups.logGroups.map((item) => {
@@ -25,14 +25,14 @@ module.exports = {
const checkResult = JSON.parse(
strings.trim(
await system.run(
`aws ssm get-parameter --name "${parameterName.name}" --with-decryption`
)
)
`aws ssm get-parameter --name "${parameterName.name}" --with-decryption`,
),
),
);
if (checkResult.Parameter) {
print.error(
chalk.red(`Parameter "${parameterName.name}" already exists.`)
chalk.red(`Parameter "${parameterName.name}" already exists.`),
);
return;
}
@@ -41,8 +41,8 @@ module.exports = {
if (!error.message.includes('ParameterNotFound')) {
print.error(
chalk.red(
`An error occurred while checking the parameter: ${error.message}`
)
`An error occurred while checking the parameter: ${error.message}`,
),
);
return;
}
@@ -59,7 +59,7 @@ module.exports = {
});
const secureParameter = await prompt.confirm(
'Should this parameter be secure?'
'Should this parameter be secure?',
);
let parameterType = 'String';
@@ -74,19 +74,19 @@ module.exports = {
const confirmCreate = await prompt.confirm(
`Create [${chalk.yellow(parameterName.name)}] with value [${chalk.green(
parameterValue.value
)}] as ${chalk.red(parameterType)}?`
parameterValue.value,
)}] as ${chalk.red(parameterType)}?`,
);
if (confirmCreate) {
try {
const createResult = await system.run(
`aws ssm put-parameter --name "${parameterName.name}" --value "${parameterValue.value}" --type ${parameterType}`
`aws ssm put-parameter --name "${parameterName.name}" --value "${parameterValue.value}" --type ${parameterType}`,
);
print.success(
chalk.green(
`Parameter "${parameterName.name}" created successfully as ${parameterType}.`
)
`Parameter "${parameterName.name}" created successfully as ${parameterType}.`,
),
);
} catch (error) {
print.error(chalk.red(`Failed to create parameter: ${error.message}`));
+11 -11
View File
@@ -19,7 +19,7 @@ module.exports = {
let nextToken = '';
if (valueNames.length === 0) {
const spinner = print.spin(
`Downloading parameter names (${chalk.red('0')})`
`Downloading parameter names (${chalk.red('0')})`,
);
while (nextToken !== null) {
const values = JSON.parse(
@@ -27,20 +27,20 @@ module.exports = {
await system.run(
`aws ssm describe-parameters --output json --max-items 50 ${
nextToken !== '' ? `--starting-token ${nextToken}` : ''
}`
)
)
}`,
),
),
);
await sleep(500);
valueNames.push(
...values.Parameters.map(({ Name }) => {
return Name;
})
}),
);
nextToken = values.NextToken || null;
spinner.text = `Downloading parameter names (${chalk.red(
valueNames.length
valueNames.length,
)})`;
}
@@ -70,14 +70,14 @@ module.exports = {
const parameterValue = JSON.parse(
strings.trim(
await system.run(
`aws ssm get-parameter --name ${parameterName} --with-decryption`
)
)
`aws ssm get-parameter --name ${parameterName} --with-decryption`,
),
),
);
print.success(
`${chalk.green(parameterName)} value is [${chalk.yellow(
parameterValue.Parameter.Value
)}]`
parameterValue.Parameter.Value,
)}]`,
);
} catch (e) {
parameterName = 'exit';
@@ -21,8 +21,8 @@ module.exports = {
} else {
print.error(
chalk.red(
'Cache file not found. Please run "a ps l" first to populate the cache.'
)
'Cache file not found. Please run "a ps l" first to populate the cache.',
),
);
return;
}
@@ -47,12 +47,12 @@ module.exports = {
print.info(
`Parameter: ${chalk.yellow(parameterName)}, New Value: ${chalk.green(
parameterValue.value
)}`
parameterValue.value,
)}`,
);
const secureParameter = await prompt.confirm(
'Should this parameter be secure?'
'Should this parameter be secure?',
);
let parameterType = 'String';
@@ -62,24 +62,24 @@ module.exports = {
const confirmUpdate = await prompt.confirm(
`Update [${chalk.yellow(parameterName)}] with value [${chalk.green(
parameterValue.value
)}] as ${chalk.red(parameterType)}?`
parameterValue.value,
)}] as ${chalk.red(parameterType)}?`,
);
if (confirmUpdate) {
try {
const updateResult = await system.run(
`aws ssm put-parameter --name "${parameterName}" --value "${parameterValue.value}" --type ${parameterType} --overwrite`
`aws ssm put-parameter --name "${parameterName}" --value "${parameterValue.value}" --type ${parameterType} --overwrite`,
);
print.info(updateResult);
print.success(
chalk.green(`Parameter "${parameterName}" updated successfully.`)
chalk.green(`Parameter "${parameterName}" updated successfully.`),
);
} catch (error) {
print.error(
chalk.red(
`An error occurred while updating the parameter: ${error.message}`
)
`An error occurred while updating the parameter: ${error.message}`,
),
);
return;
}
+3 -3
View File
@@ -27,7 +27,7 @@ module.exports = {
const { system, strings, print } = toolbox;
const pipelines = JSON.parse(
strings.trim(await system.run(`aws codepipeline list-pipelines`))
strings.trim(await system.run(`aws codepipeline list-pipelines`)),
);
// const testPipelines = pipelines.pipelines.filter(item => {
@@ -65,8 +65,8 @@ module.exports = {
const pipelineState = JSON.parse(
await system.run(
`aws codepipeline get-pipeline-state --name ${pipelineName}`,
{ trim: true }
)
{ trim: true },
),
);
const states = {};
for (const state of pipelineState.stageStates) {
@@ -14,7 +14,7 @@ module.exports = {
const stationListDev = await createPrintBucketStationList(
toolbox,
'photowall-prints-dev'
'photowall-prints-dev',
);
// Now show these in a enquiere prompt where the user can search and choose a folder
@@ -28,7 +28,7 @@ module.exports = {
// Ask the user if he wants to delete all the files in that station
const confirm = new Confirm({
message: `Do you want to delete all the files in ${chalk.yellow(
stationName
stationName,
)}?`,
});
const deleteAll = await confirm.run();
@@ -14,7 +14,7 @@ module.exports = {
const stationListDev = await createPrintBucketStationList(
toolbox,
'photowall-prints-dev'
'photowall-prints-dev',
);
// Now show these in a enquiere prompt where the user can search and choose a folder
@@ -44,20 +44,20 @@ module.exports = {
// Ask the user if he wants to delete all the files in that station
const confirm = new Confirm({
message: `Are u sure you want to copy files from s3://photowall-prints-dev/${chalk.yellow(
stationNameDev
stationNameDev,
)} to s3://photowall-prints/${chalk.blue(
stationNameProd
stationNameProd,
)} printing them in production?`,
});
const confirmResult1 = await confirm.run();
const confirmAgain = new Confirm({
message: `${chalk.black.bgYellow.bold(
'Doing this will disrupt the packing process and cause confusion. Are you physically present at the target station?'
'Doing this will disrupt the packing process and cause confusion. Are you physically present at the target station?',
)}\n\n${chalk.bold('Files to be copied:')}\n${stationListDev.stationFiles[
stationNameDev
].map((file) => chalk.yellow(file.Key) + '\n')}\n\n${chalk.yellow.bold(
'Are you really sure?'
'Are you really sure?',
)}`,
});
const confirmResult2 = await confirmAgain.run();
@@ -59,7 +59,7 @@ module.exports = {
const dryRunPrompt = new Confirm({
name: 'dryrun',
message: `Do you want to use the ${chalk.cyan(
'--dryrun'
'--dryrun',
)} flag for all commands?`,
});
@@ -11,7 +11,7 @@ const getConfirmation = async (branchName: string, stackName: string) => {
const confirm = new Confirm({
name: 'confirm',
message: `Will create ${chalk.yellow(
url + '.photowall-test.xx'
url + '.photowall-test.xx',
)} and publish ${chalk.green(branchName)} to it, continue?`,
});
@@ -47,7 +47,7 @@ module.exports = {
toolbox,
config.gh_token,
'Photowall',
'photowall'
'photowall',
);
const branchOptions = branches.map((item) => item.name);
@@ -78,7 +78,7 @@ module.exports = {
print.error(`
The stack ${chalk.yellow(
stackName
stackName,
)} is already taken, try the update command instead.
`);
@@ -91,14 +91,14 @@ module.exports = {
print.error(`
The stack must begin with ${chalk.yellow(
'test-'
'test-',
)} and then something after like ${chalk.yellow('test-yourname-1')}.
`);
if (toolbox.fromMenu()) {
await toolbox.menu.showMenu(
'deployment testservers',
defaultMenuSettings
defaultMenuSettings,
);
} else {
exit();
@@ -112,8 +112,8 @@ module.exports = {
const cmd = `make create-stack STACK_ENVIRONMENT_NAME=${stacksuffix} GITHUB_BRANCH=${branchName}`;
print.fancy(
`Running [${chalk.yellow(
cmd
)}] in folder [${`${config.photowall_repo}/cloudformation/`}]`
cmd,
)}] in folder [${`${config.photowall_repo}/cloudformation/`}]`,
);
const output = await system.run(cmd, {
cwd: `${config.photowall_repo}/cloudformation/`,
@@ -128,7 +128,7 @@ module.exports = {
if (toolbox.fromMenu()) {
await toolbox.menu.showMenu(
'deployment testservers',
defaultMenuSettings
defaultMenuSettings,
);
}
},
@@ -9,7 +9,7 @@ const getConfirmation = async (stackName: string) => {
const confirm = new Confirm({
name: 'confirm',
message: `The stack ${chalk.yellow(stackName)} will be ${chalk.red.bold(
'deleted'
'deleted',
)}`,
});
@@ -77,46 +77,46 @@ module.exports = {
await runCommand(
system,
await confirmCommand(
`aws cloudformation delete-stack --stack-name ${stackName}`
)
`aws cloudformation delete-stack --stack-name ${stackName}`,
),
);
await runCommand(
system,
await confirmCommand(
`aws ecr delete-repository --force --repository-name ${stackName}`
)
`aws ecr delete-repository --force --repository-name ${stackName}`,
),
);
const artifacts = strings
.trim(
await system.run(
`aws s3 ls | grep ${stackName}-artifactbucket | awk '{print $3}'`
)
`aws s3 ls | grep ${stackName}-artifactbucket | awk '{print $3}'`,
),
)
.split('\n');
for (const artifact of artifacts) {
await runCommand(
system,
await confirmCommand(`aws s3 rb --force s3://${artifact}`)
await confirmCommand(`aws s3 rb --force s3://${artifact}`),
);
}
await runCommand(
system,
await confirmCommand(
`aws logs delete-log-group --log-group-name /aws/codebuild/${stackName}`
)
`aws logs delete-log-group --log-group-name /aws/codebuild/${stackName}`,
),
);
await runCommand(
system,
await confirmCommand(
`aws logs delete-log-group --log-group-name ${stackName}`
)
`aws logs delete-log-group --log-group-name ${stackName}`,
),
);
}
if (toolbox.fromMenu()) {
await toolbox.menu.showMenu(
'deployment testservers',
defaultMenuSettings
defaultMenuSettings,
);
}
},
@@ -54,7 +54,7 @@ module.exports = {
toolbox,
config.gh_token,
'photowall',
issueNumber
issueNumber,
);
return {
@@ -66,10 +66,10 @@ module.exports = {
const printIssueStatus = (
issueStatuses: { issue: string; status: string }[],
issueNumber: string
issueNumber: string,
) => {
const issueStatus = issueStatuses.find(
(issueStatus) => issueStatus.issue === issueNumber
(issueStatus) => issueStatus.issue === issueNumber,
);
return issueStatus ? issueStatus.status : getStatusIcon('null');
};
@@ -161,14 +161,14 @@ module.exports = {
ellipsis(stack.branch, 24),
printIssueStatus(issueStatuses, branchIssueNumber),
issueStatuses.find(
(issueStatus) => issueStatus.issue === branchIssueNumber
(issueStatus) => issueStatus.issue === branchIssueNumber,
)
? timeSince(
new Date(
issueStatuses.find(
(issueStatus) => issueStatus.issue === branchIssueNumber
).issueUpdated
).getTime()
(issueStatus) => issueStatus.issue === branchIssueNumber,
).issueUpdated,
).getTime(),
)
: '-',
!isNaN(t.getTime())
@@ -182,7 +182,7 @@ module.exports = {
if (toolbox.fromMenu()) {
await toolbox.menu.showMenu(
'deployment testservers',
defaultMenuSettings
defaultMenuSettings,
);
}
},
@@ -22,7 +22,7 @@ type Stack = {
const getBranchName = async (
toolbox: GluegunMenuToolbox,
token: string,
repoPath: string
repoPath: string,
) => {
const { print } = toolbox;
const currentBranch = await getCurrentBranch(repoPath, toolbox);
@@ -44,7 +44,7 @@ const getBranchName = async (
owner: 'photowall',
repo: 'photowall',
branch: responseBranch,
}
},
);
if (response.status === 200) {
return responseBranch;
@@ -59,7 +59,7 @@ const getConfirmation = async (branchName: string, stackName: string) => {
const confirm = new Confirm({
name: 'confirm',
message: `The branch ${chalk.green(
branchName
branchName,
)} will deploy to ${chalk.yellow(stackName)}`,
});
@@ -96,7 +96,7 @@ module.exports = {
branchName = await getBranchName(
toolbox,
config.gh_token,
config.photowall_repo
config.photowall_repo,
);
}
@@ -123,8 +123,8 @@ module.exports = {
const cmd = `make update-stack STACK_ENVIRONMENT_NAME=${stacksuffix} GITHUB_BRANCH=${branchName}`;
print.fancy(
`Running [${chalk.yellow(
cmd
)}] in folder [${`${config.photowall_repo}/cloudformation/`}]`
cmd,
)}] in folder [${`${config.photowall_repo}/cloudformation/`}]`,
);
const output = await system.run(cmd, {
cwd: `${config.photowall_repo}/cloudformation/`,
@@ -144,17 +144,17 @@ module.exports = {
switch (currentStackStatus) {
case 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS':
statusOutput = `[${chalk.yellow(
currentStackStatus
currentStackStatus,
)}]: Almost done, cleanup in progress`;
break;
case 'UPDATE_COMPLETE':
statusOutput = `[${chalk.green(
currentStackStatus
currentStackStatus,
)}]: Update complete`;
break;
default:
statusOutput = `[${chalk.red(
currentStackStatus
currentStackStatus,
)}]: Updating the stack`;
break;
}
@@ -165,7 +165,7 @@ module.exports = {
}
spinner.text = `Will start the pipeline now [${chalk.yellow(
`photowall-${stacksuffix}Pipeline`
`photowall-${stacksuffix}Pipeline`,
)}]`;
const runPipelineCmd = `aws codepipeline start-pipeline-execution --name photowall-${stacksuffix}Pipeline`;
await system.run(runPipelineCmd);
@@ -180,7 +180,7 @@ module.exports = {
if (toolbox.fromMenu()) {
await toolbox.menu.showMenu(
'deployment testservers',
defaultMenuSettings
defaultMenuSettings,
);
} else {
exit();
@@ -52,7 +52,7 @@ module.exports = {
spinner.stop();
if (typeof templates !== 'object' || !templates.length) {
print.error(
'Could not fetch templates, does your API key have the right permissions or restricts access for your current IP?'
'Could not fetch templates, does your API key have the right permissions or restricts access for your current IP?',
);
return;
}
+4 -4
View File
@@ -31,7 +31,7 @@ module.exports = {
First step is to install aws cli [https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html]
and configuring it. Install it either with brew or do as specified in the link.
`)
`),
);
let config = await getSettings(toolbox);
@@ -103,7 +103,7 @@ module.exports = {
await system.run('touch ~/.pwcli_settings');
print.info(
`Created configuration file ${chalk.yellow(`~/.pwcli_settings`)}`
`Created configuration file ${chalk.yellow(`~/.pwcli_settings`)}`,
);
if (!config) {
config = {
@@ -115,7 +115,7 @@ module.exports = {
config.gh_token = await new Input({
message: `A github accesstoken is required with ${chalk.yellow(
'Full control of private repositories'
'Full control of private repositories',
)}, please insert the key >`,
initial: config.gh_token,
}).run();
@@ -138,7 +138,7 @@ module.exports = {
if (
await new Confirm({
message: `Ok to save the these settings to ${chalk.yellow(
`~/.pwcli_settings`
`~/.pwcli_settings`,
)}?`,
}).run()
) {
@@ -42,12 +42,12 @@ module.exports = {
(localBranch) =>
!remoteBranchesArray.includes(localBranch) &&
localBranch !== 'master' &&
localBranch !== 'main'
localBranch !== 'main',
);
if (branchesToDelete.length > 0) {
print.info(
`Found ${branchesToDelete.length} local branches without a remote connection.`
`Found ${branchesToDelete.length} local branches without a remote connection.`,
);
// Create MultiSelect prompt with branches
@@ -77,7 +77,7 @@ module.exports = {
// Confirm deletion of selected branches
if (
await confirmMessage(
`Delete ${Object.keys(selectedBranches).length} selected branches?`
`Delete ${Object.keys(selectedBranches).length} selected branches?`,
)
) {
for (const branch of Object.keys(selectedBranches)) {
@@ -29,7 +29,7 @@ module.exports = {
const repos = await getOrgIssues(toolbox, config.gh_token);
const issueOptions = repos.flatMap((repo) => {
return repo.issues.map(
(issue) => `${issue.number}-${repo.repo}-${issue.title}`
(issue) => `${issue.number}-${repo.repo}-${issue.title}`,
);
});
@@ -48,13 +48,13 @@ module.exports = {
toolbox,
config.gh_token,
repo,
issueNumber
issueNumber,
);
const branchName = issueToBranchName(issueData);
if (
await confirmMessage(
`Create new branch ${chalk.yellow(branchName)} from origin/master?`
`Create new branch ${chalk.yellow(branchName)} from origin/master?`,
)
) {
await system.run(`git checkout -b ${branchName} origin/master`, {
+6 -6
View File
@@ -10,12 +10,12 @@ export type Stack = {
};
export const getTestStacksInfo = async (
toolbox: GluegunMenuToolbox
toolbox: GluegunMenuToolbox,
): Promise<Stack[]> => {
const { strings, system } = toolbox;
const stacks = JSON.parse(
strings.trim(await system.run(`aws cloudformation list-stacks`))
strings.trim(await system.run(`aws cloudformation list-stacks`)),
);
const allStacks = (await Promise.all(
@@ -37,9 +37,9 @@ export const getTestStacksInfo = async (
const pipeline = JSON.parse(
strings.trim(
await system.run(
`aws codepipeline get-pipeline --name ${item.StackName}Pipeline`
)
)
`aws codepipeline get-pipeline --name ${item.StackName}Pipeline`,
),
),
);
const sourceStage = pipeline.pipeline.stages.filter((stage) => {
return stage.name === 'Source';
@@ -68,7 +68,7 @@ export const getTestStacksInfo = async (
}
}
return Promise.resolve(null);
})
}),
)) as Stack[] | null;
return allStacks.filter(Boolean);
};
+3 -3
View File
@@ -17,13 +17,13 @@ export const getSettings = async (toolbox): Promise<TConfig | null> => {
try {
return await filesystem.readAsync(
`${os.homedir()}/.pwcli_settings`,
'json'
'json',
);
} catch {
print.error(`
No config found, please run [ ${chalk.cyan(
'pwcli s se'
'pwcli s se',
)} ] or setup > settings from the menu.
`);
@@ -33,7 +33,7 @@ export const getSettings = async (toolbox): Promise<TConfig | null> => {
export const getCurrentBranch = async (
path: string,
toolbox
toolbox,
): Promise<string | null> => {
const { system } = toolbox;
const config = await getSettings(toolbox);
+1 -1
View File
@@ -2,7 +2,7 @@ export const createPrintBucketStationList = async (toolbox, bucket) => {
const { system } = toolbox;
// List all the folders on root level in bucket photowall-prints-dev
const allFiles = await system.run(
`aws s3api list-objects-v2 --bucket ${bucket} --output json`
`aws s3api list-objects-v2 --bucket ${bucket} --output json`,
);
const allFilesArray = JSON.parse(allFiles);
+4 -4
View File
@@ -46,7 +46,7 @@ export const getRepoBranches = async (toolbox, token, owner, repo) => {
repo: repo,
page: page,
per_page: 100,
}
},
);
return response;
};
@@ -77,7 +77,7 @@ export const getOrgIssues = async (toolbox, token) => {
// console.log(`${repoName} - issues`, issues.length);
// return issues.map(item => `${item.number}-${item.title.substring(0, 10)}`);
return { repo: repoName, issues: issues };
})
}),
);
return allIssues.flat();
};
@@ -110,7 +110,7 @@ export const getIssueFromRepo = async (toolbox, token, repo, issueNumber) => {
owner: 'Photowall',
repo: repo,
issue_number: issueNumber,
}
},
);
if (response.status === 200) {
return response.data;
@@ -125,7 +125,7 @@ export const createPullRequest = async (
toolbox,
token: string,
repo: string,
branch: string
branch: string,
) => {
const { print } = toolbox;
const octokit = new Octokit({ auth: token });
+2271 -3307
View File
File diff suppressed because it is too large Load Diff