Comments (13)
Would slowly decaffing the files work? Next time someone tries to edit a file, they could decaf it, add their logic, test and then push. JS files should still work with the other coffee files due to the interop.
from duelyst.
Compiling the Coffeescript seems to result in circular dependency issues, at least for the API when using the code in app
, visible when you try to start a new game. I wasted a bunch of time doing things manually before deciding to try the following approach:
- compile all coffeescript files to javascript so we can use javascript tooling
- compile away the custom module resolution rules (
require('app/common/logger')
instead ofrequire('../../common/logger')
so ESLint'simport/no-cycle
rule can work - install the
import/no-cycle
ESLint rule and fix any cyclic dependency issues found (hopefully!)
Since the v1 coffeescript compiler didn't know about ES6 features, especially classes, there is likely a ton of cleanup to be done, and I think JSCodeshift might be helpful there.
from duelyst.
More praise for Decaffeinate here: https://benchling.engineering/from-200k-lines-of-coffeescript-to-zero-making-decaffeinate-super-stable-4de0ca68d9bc
from duelyst.
More tools and documentation:
https://github.com/decaffeinate/bulk-decaffeinate
https://github.com/decaffeinate/decaffeinate/blob/main/docs/conversion-guide.md
https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
from duelyst.
When using decaffeinate --disallow-invalid-constructors
, this change is necessary to make bulk-decaffeinate check
work properly.
Edit: This has been merged upstream.
from duelyst.
It may be a good idea to do this one service at a time. I ran into some issues with classes extending other classes (e.g. must use new
with constructors), possibly related to decaffeinate configs.
from duelyst.
I made some progress on decaffeinating the server
and worker
directories (leaving only app
) here: willroberts/duelyst@main...willroberts:duelyst:decaffeinate-server
It mostly works, but something is up with the user data access. After logging in, I have no faction progress, while on main
I have most factions unlocked. There are no explicit errors being thrown, so I'll need to dig in a bit more.
from duelyst.
decaffeinate
results in logical/structural changes to the code (necessitating a good amount of work to fix things), so I also tried writing a script (https://github.com/willroberts/duelyst/compare/main...willroberts:duelyst:decaffeinate-backend?expand=1) to do this using the CoffeeScript compiler (coffee -c
) instead.
It doesn't work very well, since it produces unlinted files which also need manual changes.
Since this is a fairly complex task, I'm going to hold off on it for now while we focus on the reference deployment.
from duelyst.
I looked at this again today. The reason the decaffeinate
approach struggles is that we're using CoffeeScript 1.x instead of 2.x. In order to use decaffeinate
, we may want to try upgrading to [email protected]
first: https://coffeescript.org/#breaking-changes
The main thing here is https://coffeescript.org/#breaking-changes-super-this
This may be tough, since there are several things which seem to rely on tweaking the object state before calling super()
in order to influence constructor behavior, such as code in app/sdk/actions
and server/lib/custom_errors.coffee
.
We might want to instead try compiling the files (which is what we do in the build process currently) if the resulting JS output is not too ugly.
from duelyst.
I tried to fix it as well but got stuck trying to understand the intention behind this and a way how to make sure that it still work properly.
Does anybody have understanding how it should work so we can implement it properly with proper super
calls?
Or is there any test-cases/checklists how to check that everything is working fine after each change?
I believe there are not much cases which need to be fixed and they might be implemented this way not-intendedly, just occasionally.
from duelyst.
The testing process is generally this:
- Make sure
yarn build
works - Make sure
docker compose up
works - After the above two, go to
http://localhost:3000
and play a practice game
There's more info on this in the Contributor Guide here:
https://github.com/open-duelyst/duelyst/blob/main/docs/CONTRIBUTING.md#setting-up-a-development-environment-
https://github.com/open-duelyst/duelyst/blob/main/docs/CONTRIBUTING.md#starting-the-game-locally-
I haven't looked closely at the super/this code yet, so I'm not yet sure what exactly is needed. But the above steps have been enough to know that it's working (or not).
from duelyst.
Upgrading CoffeeScript appears to result in significantly more memory usage. See #173 for details.
Getting rid of CoffeeScript via compiling it (instead of upgrading it to use decaffeinate
) may be preferable here.
from duelyst.
Would slowly decaffing the files work? Next time someone tries to edit a file, they could decaf it, add their logic, test and then push. JS files should still work with the other coffee files due to the interop.
I really like this approach, and I'll add that incorporating TypeScript to the migration early on would be preferable. If it's an incremental migration then the earlier the better.
from duelyst.
Related Issues (20)
- it does not run: Looks like your video card is not supported. HOT 3
- [P3] Replace Moment.js with Day.js HOT 1
- [P0] Importing a decklist doesnt delete your previous deck/general. Many bugs happen as a result. HOT 2
- [P2] Cannot read property 'availableAt' of undefined HOT 4
- [P2] Bots can have partial or empty decks in practice mode HOT 2
- [P2] Missing cards after deck import HOT 5
- [P2] Github link opens Github in fullscreen with no way back to the game HOT 2
- [P0] Game interferes with Steam Deck overlay menus and keyboard
- You can build a Deck with less than 40 cards, circumventing deckbuilding restrictions HOT 2
- Error in current boss battle: cannot read properties of undefined - reading getIsFollowup HOT 1
- Please ignore HOT 1
- Seek bar/slider for watching replays
- Brazilian Portuguese Localization (pt-BR)
- Enable completely offline Duelyst development via Firebase Emulator instrumentation HOT 1
- tronpy.exceptions.TransactionError: Transaction expired HOT 2
- [P1] Invalid launch template in Terraform when not using custom AMI
- [P3] Fix consistency of AWS environment variables
- Game gifs - hero & map - does not render if the screen size is too small
- Can't register - Create account - Uh-oh! - Please try again HOT 3
- Where can I get these pictures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from duelyst.