Skip to content

Commit

Permalink
cdk-init bug fix (aws#413)
Browse files Browse the repository at this point in the history
Since the toolkit doesn't depend on the framework anymore, "cdk init" cannot obtain
the version of @aws-cdk/cdk when it expands
templates. Since our repo currently uses a
monolithic version number, we can just use
the toolkit's version for that.

Also, remove unreachable code from spec-diff.ts

Fixes aws#409
  • Loading branch information
Elad Ben-Israel authored Jul 26, 2018
1 parent 0016a93 commit 0543402
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion packages/@aws-cdk/cfnspec/build-tools/spec-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ async function main() {

if (typeof(update) !== 'object') {
throw new Error(`Unexpected change for ${namespace}.${prefix} ${JSON.stringify(update)}`);
return changes;
}

if ('__old' in update && '__new' in update) {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class InitTemplate {

private expand(template: string, project: ProjectInfo) {
const MATCH_VER_BUILD = /\+[a-f0-9]+$/; // Matches "+BUILD" in "x.y.z-beta+BUILD"
const cdkVersion = require('@aws-cdk/cdk/package.json').version.replace(MATCH_VER_BUILD, '');
const cdkVersion = require('../package.json').version.replace(MATCH_VER_BUILD, '');
return template.replace(/%name%/g, project.name)
.replace(/%name\.camelCased%/g, camelCase(project.name))
.replace(/%name\.PascalCased%/g, camelCase(project.name, { pascalCase: true }))
Expand Down

0 comments on commit 0543402

Please sign in to comment.