Server-side Dart proof-of-concept working :)


#1

Project URL: https://hyperweb.space/#!/project/equinox-breeze

I don’t know if I’m taking advantage of anything that shouldn’t be possible, but I was able to run a Dart server instead of Node :slight_smile:

I created a node script (download-dart.js) which uses wget and unzip to download Dart and unzip it. I put this into the package.json as an install script (which runs before the FS goes readonly) and then replaced the start script with dart-sdk/bin/dart server.dart.

It seems to work fine, even if the download is a bit hacky. There are some problems with it (like having to edit package.json to force the download script, such as if the app died/slept) but it’s good enough to use to hack around with Dart for testing :slight_smile:

I haven’t tried getting pub working yet but I think it’ll just be a case of tagging some pub commands on the end of the download script. The same could be done for client-side Dart (running dart2js), but that will probably become a pain because it could only run when the fs is writable which means editing package.json and waiting for npm to not do anything on every change :frowning:

I might switch my game prototype from TypeScript to this to see how it goes (as an added bonus, because the file extension matches the Ace config filename it’s already recognised there). I don’t think it’d be a good way to run in production, but maybe if it works well enough the team would consider adding Dart to the main image and support it properly? :slight_smile: Would need to call dart instead of node and pub commands instead of npm commands, but I don’t think there’s a huge difference the design of the two platforms.


#2

I love that you’re always pushing the envelope with the product!

Currently this is taking advantage of “not officially supported” features so we can’t guarantee that it will keep working like this forever, but we are looking into ways to provide official support for multiple languages in the near future.

Thanks again for your feedback!


#3

Yes, that’s how I would’ve described it too! :laughing:

Yeah, I figured :smiley: I thought maybe if there were working demos of things like Dart and TS you’d see how simple they are to support and…

… that! :slight_smile:

I was mostly only messing with these because I wanted classes for my game prototype and I think your version of node is from 1985? I wouldn’t be too upset if neither Dart nor TypeScript worked as long if I could use classes in Node!

The other advantages of TS/Dart (like typing/analysis) aren’t actually working out all that useful because of the limitations of a browser-based editor (delays in feedback, editor not understanding importing code from other files, etc.). I don’t know if that’s easily solvable in a generic way, but it’ll be interesting to see how things evolve!


#4

Looks like this got broked already :frowning:

Error: Command failed: wget -O dart.zip https://storage.googleapis.com/dart-archive/channels/stable/release/1.15.0/sdk/dartsdk-linux-x64-release.zip
/bin/sh: 1: wget: not found

Any news on when we might see an updated Node or an alternative way to run something like Dart?


#5

In lieu of fully selectable environments we just upgraded the default node to 4.4.3 - hopefully this is much more useful.

we also streamlined our containers so we may have omitted elements in the container that were there before.


#6

Great; thanks! I don’t know what’s in which version but I’ll try converting my Dart code over when I can find some time :slight_smile:


#7

Fixed my Dart prototype… I thought it’d be handy if I could run my old code to be able to port it and I saw other people writing shell scripts so I figured maybe this wasn’t disallowed (unless they got the idea from mine, in which case - oops). I was just unlucky with the new container missing unzip. So I re-compressed the dart-sdk as .tar.gz :slight_smile:

It’s much cleaner now (using a shell script instead of a node.js script) and restarts the server when you make changes.

Not sure if this sort of thing is intended to work/is allowed, but maybe this’ll help you plug it if not! :slight_smile:


#8

Hi Danny,

Nice Work :slight_smile:

For now, let’s consider the shell start up scripts as “not officially supported” :wink: It’s possible they’ll stop working at some point, or you’ll need to find an alternate package.

Our goal is to give you as much control over your server as necessary to get your project running, and we hope to have support for Dart and other languages as our next major feature :sunglasses:


#9

Not a problem if stuff breaks, just want to make sure I’m not doing anything wrong (or causing any issues) in trying to make them thing work again. Do tell me if I do anything I shouldn’t :grin:


#10

I just came to see whether this Dart app still worked, but equinox-breeze seems totally busted - it’s writing “Segmentation Fault” into the logs (and the file list is full of the Dart SDK, but seemingly not the actual scripts I wrote to make it work).

How to debug? :confused:


#11

Hi Dan :slight_smile:

You have to remove the dart-sdk folder from the project. I can do it for you if you want.


#12

I can’t figure out how to do that, there doesn’t seem to be an entry for the folder?

(note: the sdk was downloaded by my launch script, so probably it’ll just come back? it was a big dirty hack to make Dart work, I don’t know if it’ll still work as-is or even if everything it relied on is still possible!). It’s not a big deal, I wasn’t planning on using it, I was just curious how much had changed and whether it’d still work (I saw that multi-language support was punted).


#13

I tried to remove it on a remix and it worked (your setup script redownloads it).

If you want you can use this as a starting point, it is just your project with these fixes and a .gitignore to not show the dart-sdk folder: https://glitch.com/edit/#!/aromatic-baseball


#14

Cool; thanks! How did you remove the folder? (or is adding it to .gitignore what you meant)?


#15

I used https://support.glitch.com/t/project-console/857?u=etamponi :slight_smile:


#16

Sorry, you don’t have access to that topic!

What’s in the link?


#17

Answering my own question. It’s instructions on how to access a (secret? unannounced at least) terminal in the editor. Users who haven’t been given the ‘Member’ title on the support forum are not permitted to view it.