This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows to configure CD only for the core stack Fixes #429 It also separates the Web App and the Device UI stack. BREAKING CHANGE: the Web App stack is renamed How to migrate: - delete the `${STACK_NAME}-webapps` stack after deployment. This is technically not a breaking change, it will create a new stack for the web app and device ui and leave the old stack in place.
- Loading branch information
1 parent
b2a3e9d
commit 3d3e18d
Showing
13 changed files
with
280 additions
and
189 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import * as CloudFormation from '@aws-cdk/core' | ||
import * as chalk from 'chalk' | ||
|
||
const ENABLED = 'enabled' | ||
const DISABLED = 'disabled' | ||
|
||
export const enabledInContext = (node: CloudFormation.ConstructNode) => ({ | ||
key, | ||
component, | ||
truthy, | ||
onDisabled, | ||
onEnabled, | ||
onUndefined, | ||
}: { | ||
key: string | ||
component: string | ||
truthy?: string | ||
onEnabled?: () => void | ||
onDisabled?: () => void | ||
onUndefined?: typeof ENABLED | typeof DISABLED | ||
}): boolean => { | ||
const v = node.tryGetContext(key) | ||
if ( | ||
v === (truthy ?? '1') || | ||
(v === undefined && (onUndefined ?? DISABLED) === ENABLED) | ||
) { | ||
console.error( | ||
chalk.gray(`Component`), | ||
chalk.blueBright(component), | ||
chalk.green('enabled.'), | ||
chalk.gray(`Do not pass`), | ||
chalk.grey.bold(`-c ${key}=${truthy ?? '1'}`), | ||
chalk.gray(`to`), | ||
chalk.grey.bold(`npx cdk deploy '*'`), | ||
chalk.grey(`to disable.`), | ||
) | ||
onEnabled?.() | ||
return true | ||
} | ||
const help = [ | ||
chalk.gray(`Component`), | ||
chalk.grey.bold(component), | ||
chalk.gray('disabled.'), | ||
] | ||
if ((onUndefined ?? DISABLED) === ENABLED) { | ||
help.push( | ||
chalk.gray(`Do not pass`), | ||
chalk.grey.bold(`-c ${key}=${v}`), | ||
chalk.gray(`to`), | ||
chalk.grey.bold(`npx cdk deploy '*'`), | ||
chalk.grey(`to enable.`), | ||
) | ||
} else { | ||
help.push( | ||
chalk.gray(`Pass`), | ||
chalk.grey.bold(`-c ${key}=${truthy ?? '1'}`), | ||
chalk.gray(`to`), | ||
chalk.grey.bold(`npx cdk deploy '*'`), | ||
chalk.grey(`to enable.`), | ||
) | ||
} | ||
console.error(...help) | ||
onDisabled?.() | ||
return false | ||
} |
Oops, something went wrong.