Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/formatter-npm-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Release PowerShell formatter npm package
on: { push: { tags: ["npm-[0-9]+.[0-9]+.[0-9]+"] } }
on: { push: { tags: ["[0-9]+.[0-9]+.[0-9]+-npm"] } }
permissions: { contents: write }
defaults: { run: { shell: pwsh } }
jobs:
Expand All @@ -17,7 +17,7 @@ jobs:
run: |
$package = Get-Content -LiteralPath package.json -Raw | ConvertFrom-Json
$packageVersion = [string] $package.version
$expectedTag = "npm-$packageVersion"
$expectedTag = "$packageVersion-npm"
if ($env:GITHUB_REF_NAME -cne $expectedTag) {
$message = "Tag {0} does not match npm package tag {1}." -f $env:GITHUB_REF_NAME, $expectedTag
"::error::$message"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/formatter-wasm-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Release dprint PowerShell formatter
on: { push: { tags: ["dprint-[0-9]+.[0-9]+.[0-9]+"] } }
on: { push: { tags: ["[0-9]+.[0-9]+.[0-9]+-dprint"] } }
permissions: { contents: write }
defaults: { run: { shell: pwsh } }
jobs:
Expand All @@ -23,7 +23,7 @@ jobs:
"::error::$message"
throw $message
}
$expectedTag = "dprint-$version"
$expectedTag = "$version-dprint"
if ($env:GITHUB_REF_NAME -cne $expectedTag) {
$message = "Tag {0} does not match dprint plugin tag {1}." -f $env:GITHUB_REF_NAME, $expectedTag
"::error::$message"
Expand Down
2 changes: 1 addition & 1 deletion Formatter/Dprint/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class Plugin
private const string RepositoryUrl = $"https://github.com/{RepositoryPath}";
private static readonly string Version = GetVersion();
private static readonly string ConfigSchemaUrl =
$"https://plugins.dprint.dev/{RepositoryPath}/{Version}/schema.json";
$"https://plugins.dprint.dev/{RepositoryPath}/{Version}-dprint/schema.json";

private static readonly HashSet<string> KnownProperties =
[
Expand Down
9 changes: 5 additions & 4 deletions Formatter/Dprint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,19 @@ node Formatter/Dprint/scripts/generate-schema.mjs \
## Release

The plugin version is the `Version` property in `Formatter/Dprint/Formatter.Dprint.csproj`. Its Git
tag, published dprint version, and schema URL use that same bare semantic version. The dprint proxy
does not accept dashes in plugin tags, so `dprint-<Version>` is not a valid registry release tag.
tag uses the `<Version>-dprint` namespace, while the published dprint version remains `Version`.
The schema URL contains the full release tag so the dprint proxy resolves the namespaced GitHub
release without falling back to a bare version tag.

The repository also contains PSScriptAnalyzer's historical tags. The release workflow therefore
refuses to publish unless the pushed tag exactly matches the dprint project's declared version.
refuses to publish unless the pushed tag exactly matches `<Version>-dprint`.

To publish a new immutable release:

1. Update `Version`, build the module, and regenerate `schema.json`.
2. Run `mise exec -- Formatter/Dprint/scripts/e2e.sh` and commit the version, schema, and related
changes.
3. Create and push a signed `<Version>` tag for that exact signed commit.
3. Create and push a signed `<Version>-dprint` tag for that exact signed commit.
4. Follow the `Release dprint PowerShell formatter` workflow through completion.
5. Verify that the GitHub release contains `plugin.wasm`, `schema.json`, `LICENSE`, and
`checksums.txt`, then
Expand Down
2 changes: 1 addition & 1 deletion Formatter/Dprint/schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/0.1.1/schema.json",
"$id": "https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/0.1.1-dprint/schema.json",
"title": "dprint PowerShell formatter configuration",
"type": "object",
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion Formatter/Dprint/scripts/check-plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ assert.equal(info.configKey, "powershell");
assert.equal(info.helpUrl, "https://github.com/kjanat/PSScriptAnalyzer");
assert.equal(
info.configSchemaUrl,
`https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/${expectedVersion}/schema.json`,
`https://plugins.dprint.dev/kjanat/PSScriptAnalyzer/${expectedVersion}-dprint/schema.json`,
);
assert.equal(
info.updateUrl,
Expand Down
4 changes: 2 additions & 2 deletions Formatter/Wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ dotnet publish Formatter/Wasm/Formatter.Wasm.csproj -c Release

The publishable package is written to `Formatter/Wasm/bin/Release/net8.0/browser-wasm/AppBundle`.

Release tags use the package-specific `npm-<version>` namespace. Download and install the GitHub
Release tags use the package-specific `<version>-npm` namespace. Download and install the GitHub
release tarball directly with:

```sh
npm install https://github.com/kjanat/PSScriptAnalyzer/releases/download/npm-0.1.0/psscriptanalyzer-formatter-wasm-0.1.0.tgz
npm install https://github.com/kjanat/PSScriptAnalyzer/releases/download/0.1.1-npm/psscriptanalyzer-formatter-wasm-0.1.1.tgz
```

See [WebAssembly formatter development](../../docs/FormatterWasm.md) for the architecture, complete
Expand Down
2 changes: 1 addition & 1 deletion Formatter/Wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@psscriptanalyzer/formatter-wasm",
"version": "0.1.0",
"version": "0.1.1",
"description": "Parser-backed PowerShell formatter for browsers and Node.js",
"license": "MIT",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions docs/FormatterWasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ real dprint formatting, idempotence, configuration diagnostics, and invalid UTF-

## Release namespaces

Dprint releases use `dprint-<version>` tags such as `dprint-0.1.1`. Browser and Node.js package
releases use the separate `npm-<version>` namespace.
Dprint releases use `<version>-dprint` tags such as `0.1.1-dprint`. Browser and Node.js package
releases use the separate `<version>-npm` namespace.

The dprint proxy selects the newest non-draft, non-prerelease GitHub release when producing
`latest.json`. The npm workflow therefore publishes its GitHub release as a prerelease. This keeps
Expand Down