Skip to content

Commit

Permalink
ref(cdk): transpiling of CDK implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Bender committed Oct 10, 2022
1 parent 01fb0e8 commit 8c03f0d
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 105 deletions.
23 changes: 0 additions & 23 deletions cdk/tsconfig.json

This file was deleted.

8 changes: 3 additions & 5 deletions cdk/app.ts → lib/cdk-app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env node
import 'source-map-support/register'
import * as path from 'path'
import * as packageJson from '../package.json'
import path from 'path'
import packageJson from '../package.json'

import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'
import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'
import { App, AssetHashType, CfnOutput, Duration, RemovalPolicy, Stack, StackProps, SymlinkFollowMode } from 'aws-cdk-lib'
import { App, CfnOutput, Duration, RemovalPolicy, Stack, StackProps, SymlinkFollowMode } from 'aws-cdk-lib'
import { CloudFrontAllowedMethods, CloudFrontWebDistribution, OriginAccessIdentity } from 'aws-cdk-lib/aws-cloudfront'
import { Function } from 'aws-cdk-lib/aws-lambda'
import { Code, LayerVersion, Runtime } from 'aws-cdk-lib/aws-lambda'
Expand Down
7 changes: 3 additions & 4 deletions lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ program
.command('deploy')
.description('Deploy Next application via CDK')
.option('--stackName <name>', 'Name of the stack to be deployed.', 'StandaloneNextjsStack-Temporary')
.option('--tsconfigPath <path>', 'Absolute path to config.', path.resolve(__dirname, '../cdk/tsconfig.json'))
.option('--appPath <path>', 'Absolute path to app.', path.resolve(__dirname, '../cdk/app.ts'))
.option('--appPath <path>', 'Absolute path to app.', path.resolve(__dirname, '../dist/cdk-app.js'))
.action(async (options) => {
const { stackName, appPath, tsconfigPath } = options
const { stackName, appPath } = options
console.log('Our config is: ', options)
wrapProcess(deployHandler({ stackName, appPath, tsconfigPath }))
wrapProcess(deployHandler({ stackName, appPath }))
})

program.parse(process.argv)
5 changes: 2 additions & 3 deletions lib/cli/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import { executeAsyncCmd } from '../utils'

interface Props {
stackName: string
tsconfigPath: string
appPath: string
}

const cdkExecutable = require.resolve('aws-cdk/bin/cdk')

export const deployHandler = async ({ stackName, tsconfigPath, appPath }: Props) => {
export const deployHandler = async ({ stackName, appPath }: Props) => {
// All paths are absolute.
const cdkApp = `node -r ts-node/register --project ${tsconfigPath} ${appPath}`
const cdkApp = `node ${appPath}`
const cdkCiFlags = `--require-approval never --ci`

await executeAsyncCmd({
Expand Down
Loading

0 comments on commit 8c03f0d

Please sign in to comment.