Skip to content

Bug report: spfx project upgrade sets wrong sass.schema.json file content #4698

@milanholemans

Description

@milanholemans

Description

Noticed while using spfx project upgrade using --shell powershell it sets wrong file contents for the config/sass.schema.json file.
When looking at the upgrade report I have the following step:

@"
{
  "$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}
"@ | Out-File -FilePath "config\sass.json"

Resulting in the file having this as file content:

{
  "": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}

Because PowerShell thinks $schema is a variable, the property name becomes empty. We should escape the $ in the $schema property name.

Steps to reproduce

Upgrade an old project (with no sass.schema.json file) to the newest version, for me I used a v1.13.1 project and upgraded it to v1.16.1.

Expected results

Project to build

Actual results

Build target: DEBUG
Error: JSON validation failed:
C:\project\config\sass.json

Diagnostics

No response

CLI for Microsoft 365 version

v6.4.0

nodejs version

v16.18.1

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions