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

Add env variable to disable transpiling with typescript #1093

Merged
merged 2 commits into from
Jan 4, 2021

Conversation

OzzieOrca
Copy link
Contributor

  • Allows developer to force TS to be compiled with babel

I'm having trouble using tsc to compile dangerfile.ts and it's currently throwing SyntaxError: Cannot use import statement outside a module.

My workflow runs all .ts files through Babel only, uses tsc as a linter only, and I have target set to esnext in my tsconfig.json file:

{
    "compilerOptions": {
        "target": "esnext",
        ...
    },
}

Danger seems to be transpiling with tsc but node can't execute its output since the target is so high. This PR adds the DANGER_DISABLE_TSC flag for a developer to skip tsc and use Babel.

Idk if this is desired to be added to this project and I'm open to other implementations. Maybe the logic should be less about disabling tsc and more about forcing Babel. Or maybe a more robust solution to specify a specific transpiler would be better such as DANGER_TRANSPILATION=off|babel|tsc.

- Allows developer to force TS to be compiled with babel
@orta
Copy link
Member

orta commented Jan 4, 2021

Yeah, I think this is fine - I doubt there'll ever be a third transpiler option, so in theory with these two options you can set it to any of the three.

@orta orta enabled auto-merge January 4, 2021 22:14
@orta orta merged commit 3a90dec into danger:master Jan 4, 2021
@orta
Copy link
Member

orta commented Jan 4, 2021

Shipped in 10.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants