-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into move-question-to-another-page
- Loading branch information
Showing
171 changed files
with
15,432 additions
and
18,374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v20.15.0 | ||
v20.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const esbuild = require('esbuild'); | ||
|
||
esbuild | ||
.build({ | ||
bundle: true, | ||
entryPoints: ['./src/index.ts'], | ||
format: 'cjs', | ||
minify: true, | ||
outdir: './dist', | ||
platform: 'node', | ||
sourcemap: true, | ||
target: 'es2020', | ||
}) | ||
.catch(() => process.exit(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
7 changes: 1 addition & 6 deletions
7
apps/cli/src/cli-controller.test.ts → ...src/cli-controller/cli-controller.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Command } from 'commander'; | ||
|
||
import { createDependencyGraph } from '@atj/dependency-graph'; | ||
import type { Context } from './types'; | ||
import { addSecretCommands } from './secrets'; | ||
|
||
export const CliController = (ctx: Context) => { | ||
const cli = new Command().description( | ||
'CLI to interact with the ATJ workspace' | ||
); | ||
|
||
cli | ||
.command('hello') | ||
.description('say hello') | ||
.action(() => { | ||
ctx.console.log('Hello!'); | ||
}); | ||
|
||
cli | ||
.command('create-workspace-graph') | ||
.description('create a dependency graph of projects in the workspace') | ||
.action(async () => { | ||
await createDependencyGraph(ctx.workspaceRoot); | ||
ctx.console.log('wrote workspace dependency graph'); | ||
}); | ||
|
||
addSecretCommands(ctx, cli); | ||
|
||
return cli; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { Command } from 'commander'; | ||
|
||
import { commands, getSecretsVault } from '@atj/infra-core'; | ||
import { Context } from './types'; | ||
import { type DeployEnv } from '@atj/infra-core/src/values'; | ||
import path from 'path'; | ||
|
||
export const addSecretCommands = (ctx: Context, cli: Command) => { | ||
const cmd = cli | ||
.command('secrets') | ||
.option('-f, --file <path>', 'Source JSON file for secrets.', path => { | ||
ctx.file = path; | ||
}) | ||
.description('secrets management commands'); | ||
|
||
cmd | ||
.command('delete') | ||
.description('delete a secret') | ||
.argument('<string>', 'secret key name') | ||
.action(async (key: string) => { | ||
const vault = await getSecretsVault(ctx.file); | ||
await commands.deleteSecret(vault, key); | ||
}); | ||
|
||
cmd | ||
.command('get') | ||
.description('get a secret value') | ||
.argument('<string>', 'secret key name') | ||
.action(async (key: string) => { | ||
const vault = await getSecretsVault(ctx.file); | ||
const secret = await commands.getSecret(vault, key); | ||
console.log(secret); | ||
}); | ||
|
||
cmd | ||
.command('set') | ||
.description('set a secret value') | ||
.argument('<string>', 'secret key name') | ||
.argument('<string>', 'secret value to set') | ||
.action(async (key: string, value: string) => { | ||
const vault = await getSecretsVault(ctx.file); | ||
await commands.setSecret(vault, key, value); | ||
}); | ||
|
||
cmd | ||
.command('list') | ||
.description('list all secret keys') | ||
.action(async () => { | ||
const vault = await getSecretsVault(ctx.file); | ||
const secretKeys = await commands.getSecretKeyList(vault); | ||
console.log(JSON.stringify(secretKeys, null, 2)); | ||
}); | ||
|
||
cmd | ||
.command('show') | ||
.description('show all secrets') | ||
.action(async () => { | ||
const vault = await getSecretsVault(ctx.file); | ||
const allSecrets = await commands.getSecrets(vault); | ||
console.log(JSON.stringify(allSecrets, null, 2)); | ||
}); | ||
|
||
cmd | ||
.command('set-login-gov-keys') | ||
.description( | ||
'generate and save login.gov keypair; if it already exists, it is not ' + | ||
'updated (future work might include adding key rotation)' | ||
) | ||
.argument('<deploy-env>', 'deployment environment (dev, staging)') | ||
.argument('<app-key>', 'application key') | ||
.action(async (env: DeployEnv, appKey: string) => { | ||
const vault = await getSecretsVault(ctx.file); | ||
const secretsDir = path.resolve(__dirname, '../../../infra/secrets'); | ||
const loginResult = await commands.setLoginGovSecrets( | ||
{ vault, secretsDir }, | ||
env, | ||
appKey | ||
); | ||
if (loginResult.preexisting) { | ||
console.log('Keypair already exists.'); | ||
} else { | ||
console.log(`New keypair added`); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type Context = { | ||
console: Console; | ||
workspaceRoot: string; | ||
file?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
entryPoints: ['src/index.ts'], | ||
format: ['cjs', 'esm'], | ||
target: 'es2020', | ||
minify: true, | ||
sourcemap: true, | ||
clean: true, | ||
bundle: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.