Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "jest"
},
"devDependencies": {
"aws-cdk": "%cdk-version%",
"aws-cdk": "%cdk-cli-version%",
"jest": "^29.7.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@types/node": "22.7.9",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"aws-cdk": "%cdk-version%",
"aws-cdk": "%cdk-cli-version%",
"ts-node": "^10.9.2",
"typescript": "~5.6.3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "jest"
},
"devDependencies": {
"aws-cdk": "%cdk-version%",
"aws-cdk": "%cdk-cli-version%",
"jest": "^29.7.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@types/node": "22.7.9",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"aws-cdk": "%cdk-version%",
"aws-cdk": "%cdk-cli-version%",
"ts-node": "^10.9.2",
"typescript": "~5.6.3"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/aws-cdk/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as childProcess from 'child_process';
import * as path from 'path';
import * as chalk from 'chalk';
import * as fs from 'fs-extra';
import { versionNumber } from './cli/version';
import { invokeBuiltinHooks } from './init-hooks';
import { error, info, warning } from './logging';
import { ToolkitError } from './toolkit/error';
Expand Down Expand Up @@ -176,6 +177,7 @@ export class InitTemplate {

private expand(template: string, language: string, project: ProjectInfo) {
const cdkVersion = project.versions['aws-cdk-lib'];
const cdkCliVersion = project.versions['aws-cdk'];
let constructsVersion = project.versions.constructs;

switch (language) {
Expand All @@ -202,6 +204,7 @@ export class InitTemplate {
.replace(/%name\.camelCased%/g, camelCase(project.name))
.replace(/%name\.PascalCased%/g, camelCase(project.name, { pascalCase: true }))
.replace(/%cdk-version%/g, cdkVersion)
.replace(/%cdk-cli-version%/g, cdkCliVersion)
.replace(/%constructs-version%/g, constructsVersion)
.replace(/%cdk-home%/g, cdkHomeDir())
.replace(/%name\.PythonModule%/g, project.name.replace(/-/g, '_'))
Expand Down Expand Up @@ -475,6 +478,7 @@ async function execute(cmd: string, args: string[], { cwd }: { cwd: string }) {
}

interface Versions {
['aws-cdk']: string;
['aws-cdk-lib']: string;
constructs: string;
}
Expand All @@ -491,6 +495,7 @@ async function loadInitVersions(): Promise<Versions> {
const ret = {
'aws-cdk-lib': contents['aws-cdk-lib'],
'constructs': contents.constructs,
'aws-cdk': versionNumber(),
};
for (const [key, value] of Object.entries(ret)) {
/* istanbul ignore next */
Expand Down
Loading