-
Notifications
You must be signed in to change notification settings - Fork 135
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
you don't have to use coffeescript anymore #829
Comments
i do want to migrate away from Coffeescript, but not enough that I'd rewrite everything just to do so. But I've been considering a gradual replacement. |
in my new projects i use babel and make (instead of grunt) |
Speaking of grunt and make, needless recompilation is something I want to fix: #833 |
make automatically does that, looks at timestamps to figure out what needs compiling |
makefile tutorial: https://gist.github.com/isaacs/62a2d1825d04437c6f08 |
there's a coffee -> es6 convervter: https://github.com/decaffeinate/decaffeinate. it fails easily, but it should help. |
How should we go about converting it to ES6 without disrupting the current development? Maybe have it on a separate branch until it's completely converted? |
i mean isn't there already a system where coffee and js get combined? |
@aeosynth @r3c0d3x It would also be worth seeing what @zixaphir and @vampiricwulf think of this since if Appchan X continues to be developed it would make merges and/or cherry-picking from/to 4chan X more difficult unless they also make the switch. |
more like, some stuff might not need too much manual handling we're already at the point where native js is good enough. i'm using babel mainly for module + jsx syntax, neither of which are used in this project. |
As decaffeinate is right now, all uses of |
you'll convert from your custom template syntax to template literals i assume? also you could think about embracing the es6 module system, instead of making everything global. rollup is the bundler that i'm using, and it supports adding headers, etc. |
babel's a generic compiler; you can use it just to compile templates |
It's mostly just a matter of converting things like
(https://github.com/ccd0/4chan-x/blob/1.11.35.2/src/Monitoring/Favicon.coffee#L15)
at which point they should convert just fine. The ones like
Probably going to do something like that, but I expect I'll first have to fix a bunch of circular dependencies. |
you could look at the inline environment variables transform, or maybe make your own transform modules should be fine with circular dependencies i'm not familiar with the current state of the code, so my suggestions have to be vague |
That's good, although I want to get rid of the circular dependencies anyway since they make analyzing code changes more complicated. A bigger concern I have about module bundlers is that if they take more than a second to run and/or have any chance of outputting broken code (and would therefore need to have their output linted), that breaks incremental builds. Rollup in particular looks like complexity I don't need, but a simpler bundler might be useful. |
rollup is about the simplest module bundler out there; what complexity are you referring to? anything simpler would be the current method of simply concatenating files. any tool has a chance of containing bugs, but module bundlers are a common tool for production use. edit: rollup does support incremental builds, so the speed is fine edit2: in the end, i suppose it's just preference. if you're fine with the current build system, keep using it. |
Looking at rollup some more, I definitely don't want to use it for 4chan X, because apparently the output would look something like this |
I suppose I could do this And even that starts to look ugly again if I start to define private functions: |
Thank you @ccd0 but you don't have to listen anybody when they have no contributions to the script. |
Aeosynth started 4chan X, but if people currently contributing or interested in contributing prefer CoffeeScript, I could stick with that. But this isn't just something aeosynth wants, it's something I've wanted to do for a while. I'm personally worried that the use of CoffeeScript is limiting potential contributors. I do see a lot of people saying that they would contribute if they knew CoffeeScript instead of just Javascript. I am a bit skeptical that anyone who couldn't pick up enough CoffeeScript to work on the project in a few hours would contribute very good code in any language, but even a small barrier can cause people to lose interest. Another issue with CoffeeScript is that it adds complexity to the build process which can result in errors. These aren't necessarily bugs in CoffeeScript itself, but it's not uncommon for CoffeeScript to surprise people when converted to Javascript. Putting a for loop at the end of a function is an example of something that surprises most people. Arguably this is a matter of people being less proficient with CoffeeScript than with Javascript, but is anyone not more proficient with the latter? You have to know the latter to do the former. Compilation also makes the build process slower. I'd prefer a build process that wasn't much more than concatenation. Switching to ES6 wouldn't allow us to drop compilation immediately if we want to keep supporting Pale Moon and other minor browsers, as we'd need to use babel until the rebase finishes, but it would definitely mean dropping the compilation step within about a year or so. If any forks don't support the ES6 we want to use by then, we should consider them dead and drop support for them. |
any update on this? i was thinking converting files could be a neat warmup exercise. |
If I may say so: One obstacle is the size of the repository. At over 400MB it takes more than one hour to do a full clone from github. |
@mahkoh Alternately, if you don't need the full history, you can check out only recent history by adding |
Hey, I'm considering to rewrite this using THE BEST OF THE JAVASCRIPT OF $CURRENT_YEAR |
…ffeescript before interpolating it. #829
best js of current year is probably typescript |
I would be more interested in TypeScript if it could detect issues like this:
|
Damn, time does fly. I assume the decaffeinate process has improved since then? |
It's just waiting on me right now. The switch and your pull request should be the next things to get looked at when I get around to making major changes again. I intend to update to Coffeescript 2 first which will switch the compiled output to ES6, then modules will have their source code changed into more natural-looking ES6 one by one, possibly with the help of decaffeinate, whenever they get major changes. |
Happy to help and assist in any way, and as always, look forward to seeing 4chan X continue to develop/improve/add features and appreciate the effort you put in. |
fyi es6 = es2015 and is now 5 years old. most of es2020 is supported by my browser (firefox), except for 2018 regex features https://en.wikipedia.org/wiki/ECMAScript#Conformance |
everyone from the old crew is or is approaching boomerhood. |
My first userstyle for 4chan was 2009. 11 years later and I'm still doing the same shit. Boomer confirmed. |
any updates? i see you're still using coffeescript 1.x |
I started a fork to a js/ts migration. It's still work in progress, but I'm optimistic I can get it fully functional soon™. https://github.com/TuxedoTako/4chan-xt |
4chan x lives on |
it's 2016 and what is this
The text was updated successfully, but these errors were encountered: