cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: spfx project devcontainer init

Open martinlingstuyl opened this issue 2 years ago • 2 comments

Usage

m365 spfx project devcontainer init

Description

Initialize a devcontainer with all requirements for building SPFx webparts

Options

Option Description
-n, --name <name> The name of the devcontainer and working directory.
-v, --version [version] The version of SPFx to initialize a devcontainer for. Defaults to latest.
-g, --generator [generator] The SPFx generator to use to initialize a devcontainer with. Allowed values: Official, PnP. Defaults to Official.

The command initializes an empty directory with dev container files, so the user can open the folder in vs code and start scaffolding his project within the container right after.

Examples

Create a devcontainer to start building SPFx webparts using the latest version.

m365 spfx project devcontainer init --name "Contoso.SPFxWebparts"

Create a devcontainer to start building SPFx webparts on a specific SPFx version.

m365 spfx project devcontainer init --name "Contoso.SPFxWebparts" --version 1.14

Additional Info

I'm often having to take a lot of steps to start an spfx project within a container. Why can't we automate that 🤙. It's a kind of scaffolding, but it doesn't fit in the yeoman sharepointframework generator, as that generator is part of the dependencies of the container. So I think it's fits in nicely with the existing spfx tools the CLI offers.

Of course, we do not need support for ALL SPFx versions. We could create containers for a few of the latest.

Related to 3098

martinlingstuyl avatar Jun 30 '22 06:06 martinlingstuyl

Nice suggestion @martinlingstuyl 👍🏻

Could we include a new option for specifying which generator you would want to use?

This could be optional and default to official, but also accept pnp to use the PnP generator if that is your preference.

garrytrinder avatar Jul 16 '22 10:07 garrytrinder

Great idea @garrytrinder

martinlingstuyl avatar Jul 16 '22 11:07 martinlingstuyl

Closing as a duplicate of #3098

martinlingstuyl avatar Aug 18 '22 16:08 martinlingstuyl