Skip to content

Commit

Permalink
Merge pull request #27 from jeankhawand/add-dev-container
Browse files Browse the repository at this point in the history
Add DevContainer Support
  • Loading branch information
ricmars authored Feb 19, 2024
2 parents 762655c + 4319c71 commit d723442
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Known Issues

If you encountered issue with `npm install` exited with the following
```
[4949 ms] Start: Run in container: /bin/sh -c npm install
npm notice
npm notice New minor version of npm available! 10.2.3 -> 10.4.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.4.0
npm notice Run npm install -g [email protected] to update!
npm notice
[121068 ms] postCreateCommand failed with exit code 1. Skipping any further user-provided commands.
```
you are most probably behind a proxy / corporate network. To resolve this issue:
1. Open in a new browser tab `https://registry.npmjs.org/`
2. Follow [here](https://www.howtogeek.com/292076/how-do-you-view-ssl-certificate-details-in-google-chrome/) to get Root CA and click on `Export` to extract certificate content
3. Copy and paste the content inside `root_ca.crt` that should be created under `.devcontainer/`
4. add the following env variable to map Root CA into the container
```json
[...]
"remoteEnv": {
[...]
"NODE_EXTRA_CA_CERTS": ".devcontainer/root_ca.crt"
},
[...]
```
5. In VS Code `cmd/ctrl` + `shift` + `p` and select the **Dev Containers: Rebuild and Reopen in container** command to rebuild and open container.


References:
- [Issue with self signed certificates when installing extensions](https://github.com/microsoft/vscode-remote-release/issues/2987)
- [Self signed SSL Certificate support for DevContainers](https://github.com/microsoft/vscode-remote-release/issues/6092)
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "constellation-ui-gallery",
"forwardPorts": [6006, 4010],
"image": "mcr.microsoft.com/devcontainers/javascript-node:18",
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"postCreateCommand": "npm install",
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"stylelint.vscode-stylelint",
"streetsidesoftware.code-spell-checker",
"styled-components.vscode-styled-components"
]
}
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ dist
.yarn/install-state.gz
.pnp.*
.DS_Store

# Devcontainer certs
.devcontainer/root_ca.crt
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Install npm from [nodejs.org](https://nodejs.org/en/download/)

You should have the following versions installed: System node version 18.13.0 and npm version 8.

If you already have [VS Code](https://code.visualstudio.com/) and [Docker](https://docs.docker.com/get-docker/) installed, you can click [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/pegasystems/constellation-ui-gallery) to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.

For more details, see [docs.pega.com](https://docs.pega.com/bundle/constellation-dx-components/page/constellation-dx-components/custom-components/initialize-project.html)

### Project setup
Expand Down

0 comments on commit d723442

Please sign in to comment.