Skip to content
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

adds devcontainer.json for Codespaces and container use #428

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

paulmsmith
Copy link
Contributor

@paulmsmith paulmsmith commented Nov 25, 2024

Description

This PR adds a devcontainer.json file to the Prototype Kit repository. A devcontainer.json file is a configuration file used by Github and Visual Studio Code (as well as other tools) to define a development environment inside a container.

This file is part of the Dev Containers feature, which lets us standardise the Prototype Kit coding setup within GitHub Codespaces.

What does this configuration do?

  1. Sets a port number in an environment variable to override the default 2000 for Codespaces (as 2000 conflicts in a Codespace).
  2. Labels the port 3001 so a kit user knows what is running on that port (the kit)
  3. Upon activation of the port shows the preview feature within Codespaces to show the user that the kit is up and running.
  4. Tell any other ports made active by the kit to not be shown to the user.
  5. Sets the git config to use rebasing (to make merging via Codespaces easier).
  6. Tells the container to run npm install once it has been created.
  7. Tells the container to run npm run watch each time a user attaches (opens the Codespace).
  8. Customises the web-based VSCode interface to enable emmet (a developer feature for writing HTML) within Nunjucks language.
  9. Adds a Nunjucks syntax highlighting extension so users can more easily read Nunjucks templates within a Codespace

Checklist

  • CHANGELOG entry

frankieroberto
frankieroberto previously approved these changes Nov 26, 2024
Copy link
Contributor

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

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

Nice!

I tested this by copying the config into the prototype for the service I’m working on and it worked (after I, um, fixed a typo I introduced).

The one thing that doesn’t seem to work yet is BrowserSync. When I look at the javascript console for the codespace there seems to be a access control issue with the XMLHttpRequest call that BrowserSync uses:

Screenshot 2024-11-26 at 23 14 43

Any ideas? Not a blocker though - can still do manual refreshes for now.

.devcontainer/devcontainer.json Show resolved Hide resolved
@vickytnz vickytnz added type: enhancement 💡 New feature or request JavaScript Pull requests that update Javascript code labels Nov 27, 2024
@paulmsmith
Copy link
Contributor Author

paulmsmith commented Nov 27, 2024

Nice!

I tested this by copying the config into the prototype for the service I’m working on and it worked (after I, um, fixed a typo I introduced).

The one thing that doesn’t seem to work yet is BrowserSync. When I look at the javascript console for the codespace there seems to be a access control issue with the XMLHttpRequest call that BrowserSync uses:

Screenshot 2024-11-26 at 23 14 43

Any ideas? Not a blocker though - can still do manual refreshes for now.

Ah.. Good spot! I thought that was working but I might have made that up because it does the same for me.

Copy link
Contributor

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

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

I’ve tested this and it all works (apart from the livereload feature but that’s not blocking and can be fixed later). 👍

Suggest we release this and test it out with a few people and then put out some guidance for it in https://prototype-kit.service-manual.nhs.uk later.

@frankieroberto frankieroberto merged commit c19e71c into main Dec 10, 2024
3 checks passed
@frankieroberto frankieroberto deleted the feature/devcontainer branch December 10, 2024 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScript Pull requests that update Javascript code type: enhancement 💡 New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants