vercel / hyper

A terminal built on web technologies
https://hyper.is
MIT License
43.19k stars 3.5k forks source link

Clean up babel/transpiler stuff #4115

Open Stanzilla opened 4 years ago

Stanzilla commented 4 years ago

Since we're only targeting electron, we could just move everything over to es2018 by default and stop transpiling a few things, no?

ivanwonder commented 4 years ago

@LabhanshAgrawal One problem. If hyper use the babel to compile the ts file. Why still use tsc here. It can be removed? https://github.com/zeit/hyper/blob/5bb03972d78ff885df46c9dad692ef22f9a9c047/package.json#L8 If I am wrong, correct me.

LabhanshAgrawal commented 4 years ago

Babel compiles the files from lib, but it doesn't check for type errors

Stanzilla commented 4 years ago

@LabhanshAgrawal what do you think about the es2018 thing though?

LabhanshAgrawal commented 4 years ago

I think it makes sense. The codebase is divided in 4 parts

app/  - already getting transpiled to es2018 by tsc.
lib/  - bundled by webpack (babel-loader) to es5 (no target specified in babel config)
        and then minified by babel (cli)
cli/  - bundled by webpack (babel-loader) to es5 (no target specified in babel config)
test/ - no transpilation, ava running with ts-node

From what I understand We can configure Babel to target specific versions of electron and node (which support es2019 currently). Also possible to take the versions from package.json, which will require to use babel.config .js or provide the config through webpack For lib/ I think we can do the minification during the webpack run itself, when env is production and remove the babel cli stuff

Please correct if I missed something

LabhanshAgrawal commented 4 years ago

Also, transpiling everything atleast once is a necessity as we need to get js from ts

Stanzilla commented 4 years ago

yup that does look correct. should probably try moving the babel stuff to es2018 first and see how it works