question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

spfx project devcontainer add

See original GitHub issue

Usage

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:open
  • Created 2 years ago
  • Reactions:2
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
DonKirkhamcommented, Mar 4, 2022

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.

1reaction
waldekmastykarzcommented, Aug 18, 2022

Shall we consolidate #3098 and #3460?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found