npm package: @mschauer5/spfx-cli
Description: CLI for SPFx projects
Author: Matt Schauer
Latest version: 1.0.30

# CLI for SPFx projects

### In Development - Not ready for use

# Install

```powershell
npm install -g @mschauer5/spfx-cli
```

# Commands

### add alias

```powershell
lf add-alias 'name'
```

> adds a new alias for this program using the name that is provided.<br>
> ( default is 'lf' )

&nbsp;

### env

```powershell
lf env -a
```

> adds / updates .env file to the project setting SITE_URL to pull from your environment variable of 'SPFX_SERVE_TENANT_DOMAIN'.
> This is required to run serve command from this program.

&nbsp;

```powershell
lf env -a https://contoso.sharepoint.com/sites/dev
```

> adds / updates .env file to the project setting SITE_URL to 'https://contoso.sharepoint.com/sites/dev'.
> This is required to run serve-fast command.

&nbsp;

### serve

> This requires the spfx-fast-serve package to be installed globally.

&nbsp;

```powershell
lf serve
```

> runs project using spfx-fast-serve and uses the .env file in the project to launch the correct site url.

&nbsp;

```powershell
lf serve https://contoso.sharepoint.com/sites/dev
```

> runs project using spfx-fast-serve and launches the site that is passed in the command and bypasses the .env file in the project.

&nbsp;

### build

```powershell
lf build
```

> this command will build the project by runing pnpm|npm run build based on the package manager you are using in the project.

&nbsp;

### bundle

```powershell
lf bundle
```

> this command will bundle the project and take the package.json version and update the SharePoint Solution Package version

&nbsp;

### Open folder of sppkg file location

```powershell
lf open-solution
```

> this command opens finder|windows explorer of where the solution package is located

&nbsp;

### Visual Studio Code Commands

requires visual studio code to be installed and having having 'code' in the terminal / command line

```powershell
lf vs
```

> this command will open the default project in visual studio code

&nbsp;

```powershell
lf vs .
```

> this command will open visual studio code in the current directory

&nbsp;

```powershell
lf vs 'name-of-project'
```

> this command will open visual studio code with the matching project name

&nbsp;

```powershell
lf vs-default project1
```

> this command will set project1 as the default project in visual studio code

&nbsp;

```powershell
lf vs-add project1 /path/to/project1
```

> this command will add project1 to the list of projects in visual studio code

&nbsp;

```powershell
lf vs-delete project1
```

> this command will delete project1 from the list of projects in visual studio code

&nbsp;

```powershell
lf vs-list
```

> this command will list all projects in visual studio code

&nbsp;

### Version

```powershell
lf v
```

> this command will list the version of package.json and package-solution.json

&nbsp;

```powershell
lf v-sync
```

> this command will sync the package.json version to package-solution.json version

&nbsp;

```powershell
lf v-increment
```

> this command will increment patch # in package.json and then replace package-solution.json version with updated package.json version

&nbsp;

```powershell
lf v-increment major|minor|patch
```

> this command will increment patch # in package.json and then replace package-solution.json version with updated package.json version based on the argument passed in.
> <br>Options are major, minor, patch
> <br>major = 1.0.0 -> 2.0.0
> <br>minor = 1.0.0 -> 1.1.0
> <br>patch = 1.0.0 -> 1.0.1