chore: minor QoL improvements

This commit is contained in:
Morten Olsen
2025-08-08 20:22:10 +02:00
parent ef32edcb29
commit 00786d5508
3 changed files with 35 additions and 56 deletions

View File

@@ -117,7 +117,7 @@ override the SSM-resolved values. To avoid this:
- Use `.env.with-ssm` instead of `.env` for SSM references
- Or use environment variable substitution if your app supports it:
`${API_KEY:-SSM:/myapp/api-key}`
`API_KEY=${API_KEY:-SSM:/myapp/api-key}`
### 🚀 Deployment Considerations

View File

@@ -5,8 +5,7 @@ import { exec } from './utils/exec.js';
import { getEnv } from './utils/env.js';
import { replaceParams } from './utils/ssm.js';
const main = async () => {
const argv = await yargs(hideBin(process.argv))
const argv = await yargs(hideBin(process.argv))
.usage('Usage: $0 [options] -- <command>')
.option('region', {
type: 'string',
@@ -27,26 +26,20 @@ const main = async () => {
.epilogue('For more information, check the documentation.')
.parse();
const command = argv._[0] as string;
const commandArgs = argv._.slice(1).map(String);
const command = argv._[0] as string;
const commandArgs = argv._.slice(1).map(String);
if (!command) {
if (!command) {
console.error('No command provided');
process.exit(1);
}
}
const files = argv.file && Array.isArray(argv.file) ? argv.file : [argv.file];
const hostEnv = await getEnv(files);
const env = await replaceParams(hostEnv);
const files = argv.file && Array.isArray(argv.file) ? argv.file : [argv.file];
const hostEnv = await getEnv(files);
const env = await replaceParams(hostEnv);
exec({
exec({
command,
env,
args: commandArgs,
});
};
main().catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -1,14 +0,0 @@
const splitArgs = (args: string[]) => {
const separatorIndex = args.indexOf('--');
const actionArgs = args.slice(0, separatorIndex);
const command = args[separatorIndex + 1];
const commandArgs = args.slice(separatorIndex + 2);
return {
actionArgs,
command,
commandArgs,
};
};
export { splitArgs };