Skip to content

devcontainer #26055

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

Closed
wants to merge 3 commits into from
Closed

devcontainer #26055

wants to merge 3 commits into from

Conversation

abernier
Copy link
Contributor

@abernier abernier commented May 15, 2023

Description

This PR aims at enhancing the developer experience, by allowing anyone to have the project up-and-running in a Codespace in one click, right from his browser: https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/setting-up-your-repository/facilitating-quick-creation-and-resumption-of-codespaces

image

This PR adds a .devcontainer to the repository, that:

  • runs a linux machine (with enough memory)
  • with node 18
  • automatically being pre-npm ci
  • launches npm start
  • opens a http://localhost:8080 preview
  • pre-installs eslint extension

NB: It also works locally with Dev Containers extension


  • Ready for review
  • let the reviewer runs this devcontainer based on this abernier:devcontainer branch: Open in GitHub Codespaces

@github-actions
Copy link

github-actions bot commented May 15, 2023

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
642.6 kB (159.1 kB) 642.6 kB (159.1 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
432.5 kB (104.8 kB) 432.5 kB (104.8 kB) +0 B

@@ -43,7 +43,7 @@
"test": "npm run lint && npm run test-unit",
"build": "rollup -c utils/build/rollup.config.js",
"build-module": "rollup -c utils/build/rollup.config.js --configOnlyModule",
"dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080 --ssl\"",
"dev": "concurrently -P --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080 --ssl {@}\"",
Copy link
Contributor Author

@abernier abernier May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need --ssl=false?

Copy link
Contributor Author

@abernier abernier May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--ssl=false is only for inside the codespace, on https://localhost:8080, ssl will be ON like before

Actually --ssl=false defined in devcontainer.json postAttachCommand, will override the --ssl flag defined by default in the npm start script, so it has no impact on the npm start command run locally

Copy link
Contributor Author

@abernier abernier May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason is that the endpoint Codespace mounts for the preview is already configured with ssl

@mrdoob
Copy link
Owner

mrdoob commented May 16, 2023

Can the .devcontainer/devcontainer.json file go inside .github/ and avoid polluting the root of the repo?

@abernier
Copy link
Contributor Author

Can the .devcontainer/devcontainer.json file go inside .github/ and avoid polluting the root of the repo?

Unfortunately I think it cannot: https://containers.dev/implementors/spec/#devcontainerjson

Also because devcontainers are not directly related to github: you can for example execute it on your local vscode with this extension https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers

@abernier
Copy link
Contributor Author

abernier commented May 16, 2023

however you can have a .devcontainer.json file at root of the project

the only drawback I can see, is if we want later to provide our own Dockerfile for the image: in that case, having a .devcontainer/ folder to group them all would be handy, but we can start small with root .devcontainer.json file and see later

Tell me if you prefer that option, I'll change into a .devcontainer.json file at root

@mrdoob
Copy link
Owner

mrdoob commented May 17, 2023

This PR aims at enhancing the developer experience, by allowing anyone to have the project up-and-running in a Codespace in one click, right from his browser

Do you mind doing a screen recording showing the developer experience?

@abernier
Copy link
Contributor Author

abernier commented May 17, 2023

Do you mind doing a screen recording showing the developer experience?

You can actually try it directly with that link: https://github.com/codespaces/new?template_repository=abernier%2Fthree.js&ref=devcontainer

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 6, 2023

TBH, downloading the repo and executing npm i && npm start isn't that complicated. To me, this does not justify yet another service that we are going to use (and maintain). Something like Codespace should work without requiring the repositories to add additional configuration.

@mrdoob
Copy link
Owner

mrdoob commented Oct 11, 2023

Agreed. The PR didn't have many upvotes either...

@mrdoob mrdoob closed this Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants