intuit / auto

Generate releases based on semantic version labels on pull requests.
https://intuit.github.io/auto/
MIT License
2.28k stars 204 forks source link

auto.config.ts breaks when tsconfig.json "module" is "es2015" #1943

Open hasparus opened 3 years ago

hasparus commented 3 years ago

Describe the bug

It seems that auto.config.ts as described in the docs doesn't when user's project specifies "module": "es2015" (not "commonjs") in its tsconfig.json.

This is a problem upstream in @endemolshinegroup/cosmiconfig-typescript-loader, but I wanted to leave this issue here for other people encountering the error.

To Reproduce

A fast way:

  1. Copy auto.config.ts to your nearest project with auto.
  2. Change your tsconfig.json module setting to one preserving ES6 imports (e.g. "es2015")

A way I'm 100% sure will crash as expected:

  1. Clone https://github.com/system-ui/theme-ui
  2. Checkout 3a92b715cb83481004dd91b8fe19d5147711411a
  3. Run yarn auto shipit

Expected behavior

Config copied from the docs works.

Screenshots

⇝  yarn auto shipit
yarn run v1.22.5
$ /home/hasparus/workspace/theme-ui/node_modules/.bin/auto shipit
TypeScriptCompileError: Failed to compile TypeScript: Unexpected token 'export'
    at Function.TypeScriptCompileError.fromError (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/Errors/TypeScriptCompileError.ts:20:12)

Environment information:

I don't expect it to be relevant but info crashes too. Should info command crash when the config is broken?

$ /home/hasparus/workspace/theme-ui/node_modules/.bin/auto info
TypeScriptCompileError: Failed to compile TypeScript: Unexpected token 'export'
    at Function.TypeScriptCompileError.fromError (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/Errors/TypeScriptCompileError.ts:20:12)
    at /home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/index.ts:14:34
    at Generator.next (<anonymous>)
    at /home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/node_modules/tslib/tslib.js:113:16)
    at loader (/home/hasparus/workspace/theme-ui/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/index.ts:6:51)
    at Explorer.loadFileContent (/home/hasparus/workspace/theme-ui/node_modules/cosmiconfig/src/Explorer.ts:81:32)
    at Explorer.createCosmiconfigResult (/home/hasparus/workspace/theme-ui/node_modules/cosmiconfig/src/Explorer.ts:89:36)
    at Explorer.loadSearchPlace (/home/hasparus/workspace/theme-ui/node_modules/cosmiconfig/src/Explorer.ts:65:31)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

actual result after I edited comiconfig code

⇝  yarn auto info
yarn run v1.22.5
$ /home/hasparus/workspace/theme-ui/node_modules/.bin/auto info

Environment Information:

"auto" version: v10.25.0
"git"  version: v2.27.0
"node" version: v14.15.3

Project Information:

✔ Repository:      system-ui/theme-ui
✔ Author Name:     hasparus
✔ Author Email:    hasparus@gmail.com
✔ Current Version: v0.6.2
✔ Latest Release:  v0.6.2

✔ Labels configured on GitHub project 

GitHub Token Information:

✔ Token:            [Token starting with 6cf3]
✔ Repo Permission:  admin
✔ User:             hasparus
✔ API:              
✔ Enabled Scopes:   admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow
✔ Rate Limit:       4934/5000
hipstersmoothie commented 3 years ago

Thanks for reporting this! Hopefully we can get a fix upstream

hasparus commented 3 years ago

I made a PR there already.

hipstersmoothie commented 3 years ago

You're the man!

hasparus commented 3 years ago

You don't realize how much time you saved me with auto. I made a first automatic stable release today (after using patch-package to work around this issue), and the only things I had to do were reformatting the changelog and writing an announcement on Discord. This a drastic improvement to my life. Thank you once again.

hipstersmoothie commented 3 years ago

If you want to contribute a discord plugin I'd be all for it 😄