Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jsii): errors when invoking with a project root argument #2351

Merged
merged 2 commits into from
Dec 14, 2020
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
77 changes: 40 additions & 37 deletions packages/jsii/bin/jsii.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,46 @@ const warningTypes = Object.keys(enabledWarnings);
(async () => {
const argv = yargs
.env('JSII')
.command(['$0', 'compile'], 'Compiles a jsii/TypeScript project', (argv) =>
argv
.positional('PROJECT_ROOT', {
type: 'string',
desc: 'The root of the project to be compiled',
default: '.',
normalize: true,
})
.option('watch', {
alias: 'w',
type: 'boolean',
desc: 'Watch for file changes and recompile automatically',
})
.option('project-references', {
alias: 'r',
type: 'boolean',
desc:
'Generate TypeScript project references (also [package.json].jsii.projectReferences)',
})
.option('fix-peer-dependencies', {
type: 'boolean',
default: true,
desc:
'Automatically add missing entries in the peerDependencies section of package.json',
})
.options('fail-on-warnings', {
alias: 'Werr',
type: 'boolean',
desc: 'Treat warnings as errors',
})
.option('silence-warnings', {
type: 'array',
default: [],
desc: `List of warnings to silence (warnings: ${warningTypes.join(
',',
)})`,
}),
.command(
['$0 [PROJECT_ROOT]', 'compile [PROJECT_ROOT]'],
'Compiles a jsii/TypeScript project',
(argv) =>
argv
.positional('PROJECT_ROOT', {
type: 'string',
desc: 'The root of the project to be compiled',
default: '.',
normalize: true,
})
.option('watch', {
alias: 'w',
type: 'boolean',
desc: 'Watch for file changes and recompile automatically',
})
.option('project-references', {
alias: 'r',
type: 'boolean',
desc:
'Generate TypeScript project references (also [package.json].jsii.projectReferences)',
})
.option('fix-peer-dependencies', {
type: 'boolean',
default: true,
desc:
'Automatically add missing entries in the peerDependencies section of package.json',
})
.options('fail-on-warnings', {
alias: 'Werr',
type: 'boolean',
desc: 'Treat warnings as errors',
})
.option('silence-warnings', {
type: 'array',
default: [],
desc: `List of warnings to silence (warnings: ${warningTypes.join(
',',
)})`,
}),
)
.option('verbose', {
alias: 'v',
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii/lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class Compiler implements Emitter {
},
// Make the references absolute for the compiler
projectReferences: tsconf.references?.map((ref) => ({
path: path.resolve(ref.path),
path: path.resolve(path.dirname(this.configPath), ref.path),
})),
host: this.compilerHost,
});
Expand Down