Bug 256144 - [NEW PORT] www/code-server Run VS Code on a server and access it anywhere in a browser
Summary: [NEW PORT] www/code-server Run VS Code on a server and access it anywhere in ...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-25 10:49 UTC by Rob
Modified: 2021-05-26 12:22 UTC (History)
3 users (show)

See Also:


Attachments
diff file for new port code-server per Porters Handbook (334.51 KB, patch)
2021-05-25 10:49 UTC, Rob
no flags Details | Diff
Updated diff file. (334.44 KB, patch)
2021-05-26 10:42 UTC, Rob
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob 2021-05-25 10:49:10 UTC
Created attachment 225246 [details]
diff file for new port code-server per Porters Handbook

Hi,

This is a new port submission for code-server (https://github.com/cdr/code-server) which allows you to run VS Code on any machine anywhere as a server and access it in the browser.

Along with building and installing the software, it also installs an rc.d script to allow it to be easily controlled as a service.

I had posted an rc.d script on GitHub for it, and someone asked if I would be willing to make a port out of it, so I did. (https://github.com/microsoft/vscode-remote-release/issues/727#issuecomment-843870075)

Please let me know if you have any questions!

Thank you,
Rob
Comment 1 Rob 2021-05-25 11:46:29 UTC
(In reply to Rob from comment #0)

Here is a link to the GitHub repo I made for this port:
https://github.com/Rob4226/code-server-freebsd-port
Comment 2 Guangyuan Yang freebsd_committer 2021-05-26 09:16:46 UTC
Thanks for working on this port! I know that this is a long-wanted one from the community. :)

I haven't reviewed it thoroughly, but two things that I noticed:

- $FreeBSD$ line is deprecated. 
- I feel like editors is not the best category for this - although one could argue that this does provide an editor, it is in fact an application server, and should probably belong to www?
Comment 3 Rob 2021-05-26 10:41:17 UTC
(In reply to Guangyuan Yang from comment #2)

Thank you for starting to review!

Yes, I was torn between the editors and www categories and ultimately went with editors, but I agree with you that it actually is an application server.  I have updated the category to www and also removed the deprecated $FreeBSD$ lines.

Please see the attached updated diff. Thank you!
Comment 4 Rob 2021-05-26 10:42:57 UTC
Created attachment 225272 [details]
Updated diff file.

Changed category to www from editors, and removed deprecated $FreeBSD$ lines.
Comment 5 Guangyuan Yang freebsd_committer 2021-05-26 10:58:08 UTC
Ok, I think (from my limited experience in this topic of npm-based ports) this port won't pass Poudriere test port, since internet access in do-install is forbidden, but is required here from npm install.

There aren't many nodejs/npm based ports, and I am not sure what the best way is to solve this problem. A possible way is to pre-fetch and package the node_modules and serve it off for this port. Please take a look at misc/netron/Makefile, and I can possibly help you in the process.
Comment 6 Rob 2021-05-26 11:29:03 UTC
(In reply to Guangyuan Yang from comment #5)

Yes, I was afraid of that :( I had let Poudriere access the internet during the build stage as I wasn't sure if no network access was a strict rule or not.

I did work on a version where during the fetch phase, I extracted the package.json file from the distfile, used it to pre-download the dependencies during fetch, then moved the node_modules to the work dir. (package.json is what npm/node uses to download dependencies into a node_modules folder).  Unfortunately, it is not as simple as that for this particular software so the Makefile started getting ugly, but I will go back to the drawing board and work on it. It may not be pretty, but I am sure there is a way.

Regarding misc/netron, it appears they pre-packaged the entire node_modules folder as a download. That might be an option as a last resort (size permitting).  Thank you!