1 Commits
0.1.6 ... 0.1.4

Author SHA1 Message Date
Morten Olsen
64f6f6df6a docs: add compare section 2025-08-08 15:14:36 +02:00
7 changed files with 520 additions and 537 deletions

1
.env.with-ssm Normal file
View File

@@ -0,0 +1 @@
PASSWORD=SSM:/test/hfd/rds/DB_USER

View File

@@ -25,7 +25,7 @@ that get resolved at runtime.
## Installation ## Installation
```bash ```bash
npm install -g @morten-olsen/with-ssm npm install -g @0morten-olsen/with-ssm
``` ```
## Quick Start ## Quick Start

View File

@@ -1,2 +1,2 @@
#!/usr/bin/env node #!/usr/bin/env node
import '../dist/index.js'; import '../dist/start.js';

View File

@@ -6,8 +6,8 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"scripts": { "scripts": {
"test:lint": "eslint", "test:lint": "eslint",
"build": "ncc build src/start.ts -o dist", "build": "tsc --build",
"build:dev": "ncc build src/start.ts -o dist --watch", "build:dev": "tsc --build --watch",
"test:unit": "vitest --run --passWithNoTests", "test:unit": "vitest --run --passWithNoTests",
"test": "pnpm run \"/^test:/\"" "test": "pnpm run \"/^test:/\""
}, },
@@ -16,26 +16,27 @@
"dist" "dist"
], ],
"devDependencies": { "devDependencies": {
"@aws-sdk/client-ssm": "^3.863.0",
"@eslint/eslintrc": "3.3.1", "@eslint/eslintrc": "3.3.1",
"@eslint/js": "9.32.0", "@eslint/js": "9.32.0",
"@pnpm/find-workspace-packages": "6.0.9", "@pnpm/find-workspace-packages": "6.0.9",
"@types/node": "24.2.0", "@types/node": "24.2.0",
"@types/yargs": "^17.0.33", "@types/yargs": "^17.0.33",
"@vercel/ncc": "^0.38.3",
"@vitest/coverage-v8": "3.2.4", "@vitest/coverage-v8": "3.2.4",
"dotenv": "^17.2.1",
"eslint": "9.32.0", "eslint": "9.32.0",
"eslint-config-prettier": "10.1.8", "eslint-config-prettier": "10.1.8",
"eslint-plugin-import": "2.32.0", "eslint-plugin-import": "2.32.0",
"eslint-plugin-prettier": "5.5.4", "eslint-plugin-prettier": "5.5.4",
"execa": "^9.6.0",
"prettier": "3.6.2", "prettier": "3.6.2",
"typescript": "5.9.2", "typescript": "5.9.2",
"typescript-eslint": "8.39.0", "typescript-eslint": "8.39.0",
"vitest": "3.2.4", "vitest": "3.2.4"
"yargs": "^18.0.0"
}, },
"name": "@morten-olsen/with-ssm", "name": "@morten-olsen/with-ssm",
"version": "1.0.0" "version": "1.0.0",
"dependencies": {
"@aws-sdk/client-ssm": "^3.859.0",
"dotenv": "^17.2.1",
"execa": "^9.6.0",
"yargs": "^18.0.0"
}
} }

957
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,48 +5,41 @@ import { exec } from './utils/exec.js';
import { getEnv } from './utils/env.js'; import { getEnv } from './utils/env.js';
import { replaceParams } from './utils/ssm.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>')
.usage('Usage: $0 [options] -- <command>') .option('region', {
.option('region', { type: 'string',
type: 'string', description: 'The AWS region to use for SSM.',
description: 'The AWS region to use for SSM.', })
}) .option('profile', {
.option('profile', { type: 'string',
type: 'string', description: 'The AWS profile to use from your credentials file.',
description: 'The AWS profile to use from your credentials file.', })
}) .option('file', {
.option('file', { alias: 'f',
alias: 'f', type: 'string',
type: 'string', description: 'The file to use for environment variables. (multiple files can be specified)',
description: 'The file to use for environment variables. (multiple files can be specified)', default: ['.env', '.env.with-ssm'],
default: ['.env', '.env.with-ssm'], })
}) .demandCommand(1, 'Error: You must provide a command to execute after --')
.demandCommand(1, 'Error: You must provide a command to execute after --') .alias('h', 'help')
.alias('h', 'help') .epilogue('For more information, check the documentation.')
.epilogue('For more information, check the documentation.') .parse();
.parse();
const command = argv._[0] as string; const command = argv._[0] as string;
const commandArgs = argv._.slice(1).map(String); const commandArgs = argv._.slice(1).map(String);
if (!command) { if (!command) {
console.error('No command provided'); 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);
exec({
command,
env,
args: commandArgs,
});
};
main().catch((err) => {
console.error(err);
process.exit(1); 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);
exec({
command,
env,
args: commandArgs,
}); });

View File

@@ -10,7 +10,6 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"skipLibCheck": true, "skipLibCheck": true,
"noEmit": true,
"outDir": "dist", "outDir": "dist",
"jsx": "react-jsx", "jsx": "react-jsx",
"isolatedModules": true, "isolatedModules": true,