Skip to content

Commit

Permalink
feat(cli): add --tsconfig flag to accept custom tsconfig path (#652)
Browse files Browse the repository at this point in the history
* feat: expose tsconfig option

* write a test

* oops, remove the only function

* no need for a snapshot

Co-authored-by: EGOIST <hi@egoist.sh>
  • Loading branch information
jgoux and EGOIST committed Jun 10, 2022
1 parent be48b8b commit 58d0145
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cli-main.ts
Expand Up @@ -79,6 +79,7 @@ export async function main(options: Options = {}) {
default: 'node',
})
.option('--loader <ext=loader>', 'Specify the loader for a file extension')
.option('--tsconfig <filename>', 'Use a custom tsconfig')
.option('--config <filename>', 'Use a custom config file')
.option('--no-config', 'Disable config file')
.option('--shims', 'Enable cjs and esm shims')
Expand Down
15 changes: 15 additions & 0 deletions test/index.test.ts
Expand Up @@ -439,6 +439,21 @@ test('onSuccess', async () => {
expect(logs.includes("world")).toEqual(true)
})

test('custom tsconfig', async () => {
await run(
getTestName(),
{
'input.ts': `export const foo = 'foo'`,
'tsconfig.build.json': `{
"compilerOptions": {
"baseUrl":"."
}
}`,
},
{ flags: ['--tsconfig', 'tsconfig.build.json'] }
)
})

test('support baseUrl and paths in tsconfig.json', async () => {
const { getFileContent } = await run(getTestName(), {
'input.ts': `export * from '@/foo'`,
Expand Down

1 comment on commit 58d0145

@vercel
Copy link

@vercel vercel bot commented on 58d0145 Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tsup – ./

tsup.vercel.app
tsup-git-main-egoist.vercel.app
tsup-egoist.vercel.app
tsup.egoist.sh

Please sign in to comment.