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

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

Open
hasparus opened this issue Apr 15, 2021 · 5 comments
Open

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

hasparus opened this issue Apr 15, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@hasparus
Copy link
Contributor

hasparus commented Apr 15, 2021

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:    [email protected]
✔ 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
Copy link
Collaborator

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

@hasparus
Copy link
Contributor Author

I made a PR there already.

@hipstersmoothie
Copy link
Collaborator

You're the man!

@hasparus
Copy link
Contributor Author

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants