-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cdk-build-tools): Allow configuring jsii, jsii-pacmak and tsc (#649
) Allows additional options to be used to customize the behavior of `cdk-build-tools` commands, making it significantly easier to test a new version of `jsii`, `jsii-pacmak` or `tsc` without having to make complex changes in the codebase or using `npm link`. Permits using environment variables to specify those options. The environment variables are using the `TRUMP_CASED` name of the command and option, separated with an `_` character. For example, one can use `CDK_BUILD_JSII` to configure a different `jsii` executable to the `cdk-build` command. The default behavior is unchanged from the current (not setting any of those will use the commands provided by the dependency closure of the package).
- Loading branch information
1 parent
85c4e64
commit 29dc3c2
Showing
6 changed files
with
94 additions
and
17 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 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 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 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 |
---|---|---|
@@ -1,11 +1,32 @@ | ||
import yargs = require('yargs'); | ||
import { shell } from '../lib/os'; | ||
import { packageCompiler } from '../lib/package-info'; | ||
|
||
interface Arguments extends yargs.Arguments { | ||
jsii?: string; | ||
tsc?: string; | ||
} | ||
|
||
async function main() { | ||
await shell([packageCompiler(), '-w']); | ||
const args: Arguments = yargs | ||
.env('CDK_WATCH') | ||
.usage('Usage: cdk-watch') | ||
.option('jsii', { | ||
type: 'string', | ||
desc: 'Specify a different jsii executable', | ||
defaultDescription: 'jsii provided by node dependencies' | ||
}) | ||
.option('tsc', { | ||
type: 'string', | ||
desc: 'Specify a different tsc executable', | ||
defaultDescription: 'tsc provided by node dependencies' | ||
}) | ||
.argv as any; | ||
|
||
await shell([packageCompiler({ jsii: args.jsii, tsc: args.tsc }), '-w']); | ||
} | ||
|
||
main().catch(e => { | ||
process.stderr.write(`${e.toString()}\n`); | ||
process.exit(1); | ||
}); | ||
}); |
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 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