-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate commands from webapp Makefile to CLI
- Loading branch information
1 parent
8d82928
commit 2f8b852
Showing
15 changed files
with
151 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "cli", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/internal/cli/src", | ||
"projectType": "library", | ||
"targets": {}, | ||
"tags": [] | ||
} |
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,34 @@ | ||
import { Command } from '@oclif/core'; | ||
import { color } from '@oclif/color'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
import { ENV_STAGE_LOCAL } from '../../config/env'; | ||
import { assertChamberInstalled, loadChamberEnv } from '../../lib/chamber'; | ||
|
||
export default class WebappBuild extends Command { | ||
static description = 'Build webapp artifact'; | ||
|
||
static examples = [`$ <%= config.bin %> <%= command.id %>`]; | ||
|
||
async run(): Promise<void> { | ||
const { envStage, version, awsRegion, awsAccountId, projectEnvName } = | ||
await initConfig(this, { requireAws: 'allow-local' }); | ||
|
||
if (envStage !== ENV_STAGE_LOCAL) { | ||
await assertChamberInstalled(); | ||
await loadChamberEnv(this, { | ||
serviceName: `env-${projectEnvName}-webapp`, | ||
}); | ||
} | ||
|
||
this.log(`Building webapp: | ||
envStage: ${color.green(envStage)} | ||
version: ${color.green(version)} | ||
AWS account: ${awsAccountId ? color.green(awsAccountId) : 'none'} | ||
AWS region: ${awsRegion ? color.green(awsRegion) : 'none'} | ||
`); | ||
|
||
await runCommand('pnpm', ['nx', 'run', 'webapp:build']); | ||
} | ||
} |
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,16 @@ | ||
import { Command } from '@oclif/core'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
|
||
export default class WebappDeploy extends Command { | ||
static description = 'Deploys webapp to AWS using previously built artifact'; | ||
|
||
static examples = [`$ <%= config.bin %> <%= command.id %>`]; | ||
|
||
async run(): Promise<void> { | ||
await initConfig(this, {}); | ||
|
||
await runCommand('pnpm', ['nx', 'run', 'webapp:deploy']); | ||
} | ||
} |
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,16 @@ | ||
import { Command } from '@oclif/core'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
|
||
export default class WebappTest extends Command { | ||
static description = 'Runs all webapp tests in docker container'; | ||
|
||
static examples = [`$ <%= config.bin %> <%= command.id %>`]; | ||
|
||
async run(): Promise<void> { | ||
await initConfig(this, {}); | ||
|
||
await runCommand('pnpm', ['nx', 'run', 'webapp:test']); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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