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