From 5778f36293af01607c5022c1568a5e5a4fdec67c Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 21 Aug 2026 14:07:43 -0400 Subject: [PATCH 1/2] chore: use npm plugin specifiers --- .github/workflows/ci.ts | 16 +++++++++++----- README.md | 1 - dprint.json | 10 +++++----- scripts/generate_release_notes.ts | 24 ++++++++---------------- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.ts b/.github/workflows/ci.ts index af22bdc..6f39e87 100755 --- a/.github/workflows/ci.ts +++ b/.github/workflows/ci.ts @@ -115,7 +115,9 @@ const matrix = defineMatrix({ // build and test through cargo-zigbuild for zigbuild targets so the test // suite links (and runs) binaries the same way as the published ones cargo: profile.zigbuildGlibc != null ? "cargo-zigbuild" : "cargo", - cargo_target: profile.zigbuildGlibc != null ? `${profile.target}.${profile.zigbuildGlibc}` : profile.target, + cargo_target: profile.zigbuildGlibc != null + ? `${profile.target}.${profile.zigbuildGlibc}` + : profile.target, })), }); @@ -254,7 +256,8 @@ const buildJob = job("build", { { name: "Build (Debug)", if: isNotCross.and(isNotMuslImage).and(isNotTag), - run: "${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}}", + run: + "${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}}", }, { name: "Check glibc requirement (Debug)", @@ -264,7 +267,8 @@ const buildJob = job("build", { { name: "Build release", if: isNotCross.and(isNotMuslImage).and(isTag), - run: "${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}} --release", + run: + "${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}} --release", }, { name: "Build cross (Debug)", @@ -315,12 +319,14 @@ const buildJob = job("build", { { name: "Test (Debug)", if: runTests.equals("true").and(isNotTag), - run: "${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features", + run: + "${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features", }, { name: "Test (Release)", if: runTests.equals("true").and(isTag), - run: "${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features --release", + run: + "${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features --release", }, { // runs after the tests so this checks the exact binary that gets zipped, diff --git a/README.md b/README.md index cb75cd5..4f4c10d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ This plugin executes CLI commands to format code via stdin (recommended) or via 1. Install [dprint](https://dprint.dev/install/) 2. `dprint init` 3. `dprint add exec` - - Or install from npm: `dprint add npm:@dprint/exec` ## Configuration diff --git a/dprint.json b/dprint.json index de78f16..1e0ad23 100644 --- a/dprint.json +++ b/dprint.json @@ -14,10 +14,10 @@ "**/*-lock.json" ], "plugins": [ - "https://plugins.dprint.dev/json-0.22.0.wasm", - "https://plugins.dprint.dev/markdown-0.22.1.wasm", - "https://plugins.dprint.dev/toml-0.7.0.wasm", - "https://plugins.dprint.dev/exec-0.7.0.json@4c1dc4bede760d7d40bafbafd886395013af597984c0ec4214232b4c4cd600ff", - "https://plugins.dprint.dev/typescript-0.96.1.wasm" + "npm:@dprint/json@0.23.0", + "npm:@dprint/markdown@0.22.1", + "npm:@dprint/toml@0.8.0", + "npm:@dprint/exec@0.7.3/plugin.json@704701df449dd7e942a71144773778ac529d68c2e4657bfc236d393b898b9a67", + "npm:@dprint/typescript@0.96.1" ] } diff --git a/scripts/generate_release_notes.ts b/scripts/generate_release_notes.ts index 192af0b..ff339da 100644 --- a/scripts/generate_release_notes.ts +++ b/scripts/generate_release_notes.ts @@ -3,25 +3,17 @@ import { generateChangeLog } from "jsr:@dprint/automation@0.11.2"; const version = Deno.args[0]; const checksum = Deno.args[1]; -// optional npm install block; only emitted if create_npm_packages.ts has -// run and produced a manifest with the main package's tarball checksum. -let npmBlock = ""; +// prefer the npm specifier, which is what `dprint add` outputs. it's only +// available once create_npm_packages.ts has run and produced a manifest with +// the main package's tarball checksum, so fall back to the plugin url. +let pluginSpecifier = `https://plugins.dprint.dev/exec-${version}.json@${checksum}`; try { const manifest = JSON.parse(await Deno.readTextFile("npm-dist/publish-manifest.json")) as { mainPackageName: string; mainPackageChecksum: string; }; - npmBlock = ` - Alternatively, run \`dprint add npm:${manifest.mainPackageName}\`, which will update the config file as follows: - \`\`\`jsonc - { - // etc... - "plugins": [ - "npm:${manifest.mainPackageName}@${version}/plugin.json@${manifest.mainPackageChecksum}" - ] - } - \`\`\` -`; + pluginSpecifier = + `npm:${manifest.mainPackageName}@${version}/plugin.json@${manifest.mainPackageChecksum}`; } catch (err) { if (!(err instanceof Deno.errors.NotFound)) throw err; } @@ -47,11 +39,11 @@ Then: { // etc... "plugins": [ - "https://plugins.dprint.dev/exec-${version}.json@${checksum}" + "${pluginSpecifier}" ] } \`\`\` -${npmBlock}2. Follow the configuration setup instructions found at https://github.com/dprint/dprint-plugin-exec#configuration +2. Follow the configuration setup instructions found at https://github.com/dprint/dprint-plugin-exec#configuration `; console.log(text); From fde77c2d6002aebceae9e15821848e826154c198 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 21 Aug 2026 14:45:57 -0400 Subject: [PATCH 2/2] chore: simplify release notes install instructions --- .github/workflows/ci.generated.yml | 5 +---- .github/workflows/ci.ts | 12 +----------- scripts/generate_release_notes.ts | 27 +-------------------------- 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.generated.yml b/.github/workflows/ci.generated.yml index d9a5262..c838477 100644 --- a/.github/workflows/ci.generated.yml +++ b/.github/workflows/ci.generated.yml @@ -500,15 +500,12 @@ jobs: - name: Get tag version id: get_tag_version run: 'echo "TAG_VERSION=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT"' - - name: Get plugin file checksum - id: get_plugin_file_checksum - run: 'echo "CHECKSUM=$(shasum -a 256 plugin.json | awk ''{print $1}'')" >> "$GITHUB_OUTPUT"' - name: Update Config Schema Version run: 'sed -i ''s/exec\/0.0.0/exec\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/'' deployment/schema.json' - name: Build npm packages run: deno run -A scripts/create_npm_packages.ts - name: Create release notes - run: 'deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} ${{ steps.get_plugin_file_checksum.outputs.CHECKSUM }} > ${{ github.workspace }}-CHANGELOG.txt' + run: 'deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} > ${{ github.workspace }}-CHANGELOG.txt' - name: Release uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 env: diff --git a/.github/workflows/ci.ts b/.github/workflows/ci.ts index 6f39e87..d9eddb7 100755 --- a/.github/workflows/ci.ts +++ b/.github/workflows/ci.ts @@ -355,13 +355,6 @@ const getTagVersion = step({ outputs: ["TAG_VERSION"], }); -const getPluginFileChecksum = step({ - id: "get_plugin_file_checksum", - name: "Get plugin file checksum", - run: `echo "CHECKSUM=$(shasum -a 256 plugin.json | awk '{print $1}')" >> "$GITHUB_OUTPUT"`, - outputs: ["CHECKSUM"], -}); - const draftReleaseJob = job("draft_release", { name: "draft_release", if: isTag, @@ -392,22 +385,19 @@ const draftReleaseJob = job("draft_release", { run: "deno run --allow-read=. --allow-write=. scripts/create_plugin_file.ts", }, getTagVersion, - getPluginFileChecksum, { name: "Update Config Schema Version", run: `sed -i 's/exec\\/0.0.0/exec\\/${getTagVersion.outputs.TAG_VERSION}/' deployment/schema.json`, }, { - // must run before "Create release notes" — the notes embed the main - // npm tarball's sha256 from npm-dist/publish-manifest.json. name: "Build npm packages", run: "deno run -A scripts/create_npm_packages.ts", }, { name: "Create release notes", run: - `deno run -A ./scripts/generate_release_notes.ts ${getTagVersion.outputs.TAG_VERSION} ${getPluginFileChecksum.outputs.CHECKSUM} > \${{ github.workspace }}-CHANGELOG.txt`, + `deno run -A ./scripts/generate_release_notes.ts ${getTagVersion.outputs.TAG_VERSION} > \${{ github.workspace }}-CHANGELOG.txt`, }, { name: "Release", diff --git a/scripts/generate_release_notes.ts b/scripts/generate_release_notes.ts index ff339da..a96fc8d 100644 --- a/scripts/generate_release_notes.ts +++ b/scripts/generate_release_notes.ts @@ -1,23 +1,6 @@ import { generateChangeLog } from "jsr:@dprint/automation@0.11.2"; const version = Deno.args[0]; -const checksum = Deno.args[1]; - -// prefer the npm specifier, which is what `dprint add` outputs. it's only -// available once create_npm_packages.ts has run and produced a manifest with -// the main package's tarball checksum, so fall back to the plugin url. -let pluginSpecifier = `https://plugins.dprint.dev/exec-${version}.json@${checksum}`; -try { - const manifest = JSON.parse(await Deno.readTextFile("npm-dist/publish-manifest.json")) as { - mainPackageName: string; - mainPackageChecksum: string; - }; - pluginSpecifier = - `npm:${manifest.mainPackageName}@${version}/plugin.json@${manifest.mainPackageChecksum}`; -} catch (err) { - if (!(err instanceof Deno.errors.NotFound)) throw err; -} - const changelog = await generateChangeLog({ versionTo: version, }); @@ -34,15 +17,7 @@ Dependencies: Then: -1. Run \`dprint add exec\`, which will update the config file as follows: - \`\`\`jsonc - { - // etc... - "plugins": [ - "${pluginSpecifier}" - ] - } - \`\`\` +1. Run \`dprint add exec\`, which will add the plugin to your dprint configuration file. 2. Follow the configuration setup instructions found at https://github.com/dprint/dprint-plugin-exec#configuration `;