Skip to content

Commit

Permalink
fix(init): 'cdk init' doesn't leave .d.ts files (#4841)
Browse files Browse the repository at this point in the history
* fix(init): 'cdk init' doesn't leave .d.ts files

`cdk init` was leaving `add-project.hook.d.ts` in the .NET project
directory, since that file was not matching the regex intended to
catch those files.

Fix that, and add a test to make sure.

* Update init.ts
  • Loading branch information
rix0rrr authored and mergify[bot] committed Nov 4, 2019
1 parent 56d4979 commit 10b5b3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class InitTemplate {
} else if (file.match(/^.*\.template\.[^.]+$/)) {
await this.installProcessed(fromFile, toFile.replace(/\.template(\.[^.]+)$/, '$1'), project);
continue;
} else if (file.match(/^.*\.hook\.[^.]+$/)) {
} else if (file.match(/^.*\.hook\.(d.)?[^.]+$/)) {
await this.installProcessed(fromFile, path.join(targetDirectory, "tmp", file), project);
continue;
} else {
Expand Down
6 changes: 6 additions & 0 deletions packages/aws-cdk/test/integ/init/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ function header() {
log $@
log "============================================================================================"
}

function assert_no_hook_files() {
compgen "\*.hook.\*" || return 0
echo "'cdk init' left hook files in the template directory!" >&2
exit 1
}
9 changes: 3 additions & 6 deletions packages/aws-cdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@
},
"include": [
"**/*.ts",
"**/*.d.ts"
"**/*.d.ts",
"lib/init-templates/*/*/add-project.hook.ts"
],
"exclude": [
"lib/init-templates/**/*"
],
"files": [
"lib/init-templates/app/csharp/add-project.hook.ts",
"lib/init-templates/app/fsharp/add-project.hook.ts"
"lib/init-templates/*/typescript/**/*.ts"
]
}

0 comments on commit 10b5b3c

Please sign in to comment.