spfx project devcontainer add
See original GitHub issueUsage
spfx project devcontainer add
Description
Adds the .devcontainer files for the current project
Options
Option | Description |
---|---|
-v, --version [version] |
The version of SPFx to initialize a devcontainer for. |
-g, --generator [generator] |
The SPFx generator to use to initialize a devcontainer with. Allowed values: official , pnp . |
Additional Info
This command would add the .devcontainer folder and the files needed to launch the project in a container. Currently, @hugoabernier has been adding these files manually to the PnP Samples repositories. We have tested webparts, but am not sure about other SPFx project types.
The command would install the files specific for the SPFx “version” and “componentType” in the yo-rc.json file.
I would love to have more conversations about this and help implement.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:22 (22 by maintainers)
Top Results From Across the Web
New Development Containers for SharePoint Framework ...
All SPFx samples being containerized, starting with v1.13, then v1.12 … ... development container | aka.ms/ spfx - devcontainer • Documentation ...
Read more >Developing SPFx solutions using Docker - Don Kirkham
Step 4. Add the Dev Container files to the project. Here is where the magic happens. We are going to create a new...
Read more >Developing inside a Container - Visual Studio Code
A devcontainer.json file in your project tells VS Code how to access (or create) ... VS Code will add the dev container configuration...
Read more >Using Visual Studio Codespaces for SPFx development
I used a local install of VSCode instead of the browser. Step by step. I used the following steps to get my SPFx...
Read more >SharePoint Framework (SPFx), Docker, Dev Containers and ...
A solution would be to add all the SPFx solutions in the same dev container, but this is not ideal as it would...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
All of the above are excellent suggestions.
As far as how to best get the version of SPFx, I defer to those that are more knowledgeable about how SPFx versions are tracked in a project. I always use package.json, since yo-rc.json make not have been updated. But I noticed that upgrade command always instructs that yo-rc.json be updated.
I love the idea that the spfx project upgrade command would have instructions to update the devcontainer files too. Could we also add “spfx doctor” checks to see if the devcontainer files match the SPFx version?
RE @hugoabernier’s comment about different container types. My experience so far is that Codespaces use the exact same container functionality as Docker desktop. i.e., if you can open a project in a Docker container, you can also open that github repo straight into Codespaces. (If you watch how Codespaces are named, you will see it’s the same as Docker. hmmmm
The big difference right now is that Codespaces uses the .devcontainer folder at the root of a repo only. It does not work for big monorepos, like our samples repos. Docker, however, looks for the .devcontainer of the folder loaded in the project and offers the option to rebuild the container using that configuration. An enhancement had been submitted to the Codespaces team to allow this functionality.
Thanks for everyone’s feedback and willingness to help. As I originally mentioned, I would love to help with this implementation. I have not worked with the project before, so I will definitely need some guidance.
Shall we consolidate #3098 and #3460?