chore: helper script for local dev (#492)

This commit is contained in:
Roman Hotsiy
2021-12-31 10:39:13 +02:00
committed by GitHub
parent 6700ee5c0c
commit bd119b612c
2 changed files with 15 additions and 9 deletions

View File

@@ -9,18 +9,23 @@ const fileNameLatest = `openapi-cli.latest.tar.gz`;
execSync(`tar -zcvf ${fileName} dist`);
execSync(`tar -zcvf ${fileNameLatest} dist`);
const argv = yargs
.option('aws-profile', {
alias: 'p',
type: 'string',
})
.argv;
const argv = yargs.option('aws-profile', {
alias: 'p',
type: 'string',
}).argv;
let profile = !!argv.awsProfile ? `--profile ${argv.awsProfile}` : '';
try {
if (process.env.ENV === 'local') {
execSync(`mkdir -p /tmp/redocly/openapi-cli/latest/`);
execSync(`mkdir -p /tmp/redocly/openapi-cli/${version}/`);
execSync(`cp -R dist /tmp/redocly/openapi-cli/latest/`);
execSync(`cp -R dist /tmp/redocly/openapi-cli/${version}/`);
} else {
try {
execSync(`aws s3 cp ${fileName} s3://${process.env.AWS_S3_PATH} ${profile}`);
execSync(`aws s3 cp ${fileNameLatest} s3://${process.env.AWS_S3_PATH} ${profile}`);
} catch (e) {
} catch (e) {
process.stderr.write(e.output);
}
}