Skip to content

Commit

Permalink
Add format updates (#2755)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Feb 6, 2025
1 parent d81f461 commit 0f116a8
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/concepts/lockfile.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: PSRule v3 and later uses a lock file to define the modules and versions used to run analysis. This article describes the lock file and how to manage it.
version: 3.0
---

# Lock file
Expand Down
56 changes: 53 additions & 3 deletions docs/updates/v3.0.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
date: 2024-01-30
date: 2024-02-30
version: 3.0
---

# January 2025 (v3.0)
# vNEXT (v3.0)

Welcome to the January 2025 release of PSRule.
Welcome to the vNEXT release of PSRule.
There are many updates in this version that we hope you'll like, some of the key highlights include:

- [Official CLI support](#official-cli-support) — A new CLI experience for PSRule.
Expand All @@ -23,6 +23,8 @@ Additionally, we wanted to improve the bootstrapping experience for PSRule in du

The new CLI runs on Windows, macOS, and Linux and is available as a standalone executable or can be installed as a .NET tool.

Continue reading [CLI](../concepts/cli/index.md) to learn more.

## Module lock file

We've introduced a new feature to help you manage the versions of modules used by PSRule.
Expand All @@ -34,6 +36,20 @@ When no lock file is present, PSRule will use the latest version of each module

This makes it easier to share and reproduce the versions of modules used during development and CI/CD pipelines.

This is an example of the lock file used for the PSRule repository:

```json title="ps-rule.lock.json"
{
"version": 1,
"modules": {
"PSRule.Rules.MSFT.OSS": {
"version": "1.1.0",
"integrity": "sha512-4oEbkAT3VIQQlrDUOpB9qKkbNU5BMktvkDCriws4LgCMUiyUoYMcN0XovljAIW4FO0cmP7mP6A8Z7MPNGlgK7Q=="
}
}
}
```

This is a change to the previous behavior in CI/CD pipelines where PSRule:

- Would install the latest version of each module but only if no version was not already installed.
Expand All @@ -42,6 +58,8 @@ This is a change to the previous behavior in CI/CD pipelines where PSRule:
The lock file is supported by the CLI, GitHub Actions, Azure Pipelines, and Visual Studio Code extension.
When using PSRule from PowerShell, the lock file is ignored to prevent conflicts with PowerShell's built-in update mechanism.

Continue reading [Lock file](../concepts/lockfile.md) to learn more.

## Visual Studio Code

### New home and identity
Expand Down Expand Up @@ -75,6 +93,38 @@ We've improved the experience by adding the ability to:
- Restore modules from the VSCode command palette.
- Asking to automatically restore required modules when you open a workspace that contains a PSRule lock file.

## Formats and emitters

For a while now, we've wanted to improve how PSRule handles input files to make it easier to work with new formats.
PSRule has supported JSON, YAML, Markdown, and PowerShell data files for some time.
However adding support for new types of files required changes to the core engine.

We've introduced a new format and emitter API to make it easier to add support for new formats outside the core engine.
While workarounds were possible, they were hard to scale when working with large repositories.

This means you can now write emitters for additional or custom formats and use them with PSRule shipped within a module.

Additionally, we added the following features:

- Multiple formats can be used in a single PSRule run.
- The file types associated with each format can be configured as an option.
- Replacement strings can be configured to automatically replace literal values in input files during processing.

For example, the following configuration:

1. Enables the JSON format.
2. Replaces the `{{environment}}` string with `production` in input files.

```yaml title="ps-rule.yaml"
format:
json:
enabled: true
replace:
'{{environment}}': production
```
Continue reading [Formats and emitters](../concepts/formats.md) to learn more.
### Other minor features and improvements
- You can now override the options file that VSCode uses when running PSRule.
Expand Down
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ nav:
- Overview:
- About: about.md
- Features: features.md
- What's new in v3: updates/v3.0.md
- Setup:
- Index: setup/index.md
- Visual Studio Code: setup/vscode.md
Expand Down Expand Up @@ -78,8 +79,8 @@ nav:
- Related projects: related-projects.md
- Support: support.md
- Updates:
# - January 2025: updates/v3.0.md
- Change log: 'CHANGELOG-v3.md'
- vNEXT: updates/v3.0.md
- Change log: CHANGELOG-v3.md
- Deprecations: deprecations.md
- Changes and versioning: versioning.md
- Reference:
Expand Down

0 comments on commit 0f116a8

Please sign in to comment.