quick-lint / quick-lint-js

quick-lint-js finds bugs in JavaScript programs
https://quick-lint-js.com
GNU General Public License v3.0
1.55k stars 192 forks source link

Simplify code generation, build scripts, and contributor scripts #903

Open strager opened 1 year ago

strager commented 1 year ago

quick-lint-js has some complicated unorthodox tools which are required for some unorthodox artifacts or which are just used by contributors:

My issues:

Related: #168

strager commented 1 year ago

Languages

For core stuff, I think C++ and JavaScript are here to stay. C++ might be replaced with Rust if Rust build times improve. JavaScript is the language of web tooling, and I think that's fine.

For scripting, we currently use Ansible, Bash, Go, Node.js, and Python:

Other scripting options:

I'm leaning toward this resolution:

strager commented 1 year ago

Documentation

Some ideas:

strager commented 1 year ago

I investigated Go a bit. I ran into an issue.

By default, if you use a command like go run, then the toolchain will check if a vendor directory exists. If vendor does exist, Go will only load dependencies from that directory. If vendor doesn't exist, Go will download and cache dependencies if needed.

quick-lint-js has a directory called vendor which confuses Go. To work around this confusion, you can pass -mod=readonly when running a go command, making the toolchain ignore the vendor directory.

An alternative to -mod=readonly is go mod vendor, which populates the vendor directory. Unfortunately, this command also deletes everything else in the vendor directory. Goodbye C++ code. You can work around this by undeleting the files, but this clearly isn't what the Go developers intended you to do.

strager commented 1 year ago

Thinking about it more, maybe I should choose Node.js for the unorthodox tools. We would then have only two languages in quick-lint-js: C++ and JavaScript. I'm not sure Node.js will work well though; I'll have to play around with it.

Note: Ubuntu 18.04 (the crustiest distro we support) has Node.js version 8 in its repos.

strager commented 1 year ago

Some things to investigate for Node.js:

strager commented 1 year ago

I boiled it down to two options for unorthodox tools: C++ or Node.js.

I am experimenting with C++. I replaced gperf with a custom tool (written in C++), and am integrating it into the build. I plan to release this slowly:

If nobody complains about the second trial release, then I will move forward with C++ for the following tools:

strager commented 1 year ago

I ported the translation infrastructure to C++ integrated into the build. It's been nice except for one issue: if a change is made which doesn't affect the unorthodox source, the generator will update the source's timestamp anyway, causing most files to rebuild. I should fix this with a write_file_if_different function.