Skip to content
Merged
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
21 changes: 20 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ jobs:
- name: Build extension
if: env.VS_EXISTS == 'false' || env.OVSX_EXISTS == 'false'
run: vsce package --no-dependencies -o postscript-preview-${{ steps.package-version.outputs.current-version }}.vsix
- name: Build Open VSX extension
if: env.OVSX_EXISTS == 'false'
run: |
cp package.json "$RUNNER_TEMP/postscript-preview-package.json"
trap 'cp "$RUNNER_TEMP/postscript-preview-package.json" package.json' EXIT
node scripts/prepare-open-vsx-manifest.mjs package.json
vsce package --no-dependencies -o postscript-preview-${{ steps.package-version.outputs.current-version }}-open-vsx.vsix
- name: Validate registry packages
if: env.OVSX_EXISTS == 'false'
run: |
unzip -p postscript-preview-${{ steps.package-version.outputs.current-version }}.vsix extension/package.json |
jq -e '.extensionDependencies | index("mxschmitt.postscript") != null'
unzip -p postscript-preview-${{ steps.package-version.outputs.current-version }}-open-vsx.vsix extension/package.json |
jq -e '(.extensionDependencies // []) | index("mxschmitt.postscript") == null'
if unzip -p postscript-preview-${{ steps.package-version.outputs.current-version }}-open-vsx.vsix extension.vsixmanifest |
grep --fixed-strings --quiet 'mxschmitt.postscript'; then
echo "Open VSX package still declares the unavailable dependency" >&2
exit 1
fi
- name: Upload a Build Artifact
if: env.VS_EXISTS == 'false' || env.OVSX_EXISTS == 'false'
uses: actions/upload-artifact@v7
Expand Down Expand Up @@ -136,7 +155,7 @@ jobs:
if: env.OVSX_EXISTS == 'false'
env:
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}
run: ovsx publish "postscript-preview-${{ steps.package-version.outputs.current-version }}.vsix" --pat "$OVSX_PAT"
run: ovsx publish "postscript-preview-${{ steps.package-version.outputs.current-version }}-open-vsx.vsix" --pat "$OVSX_PAT"
- name: Publish to Visual Studio Marketplace
if: env.VS_EXISTS == 'false'
env:
Expand Down
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ANTIGRAVITY.md
TESTING.md
docs/**
examples/**
scripts/**
CODE_OF_CONDUCT.md
CONTRIBUTING.md
generateEmojiShortcodeMap.js
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Fixes

- Published an Open VSX-specific package without the unavailable PostScript language dependency while preserving automatic dependency installation in the Visual Studio Marketplace.
- Made Windows PostScript conversion use the native Ghostscript executable without a command shell.
- Escaped filenames rendered in the preview and improved single-page and accessible pagination layouts.

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@
"compile": "yarn clean && tsc -p ./",
"lint": "eslint src",
"watch": "tsc -watch -p ./",
"test": "yarn compile && mocha --ui tdd --color --timeout 10000 \"out/test/unit/**/*.test.js\" && node ./out/test/runTest.js",
"test:unit": "yarn compile && mocha --ui tdd --color --timeout 10000 \"out/test/unit/**/*.test.js\"",
"test": "yarn compile && yarn test:tools && mocha --ui tdd --color --timeout 10000 \"out/test/unit/**/*.test.js\" && node ./out/test/runTest.js",
"test:tools": "node --test scripts/prepare-open-vsx-manifest.test.mjs",
"test:unit": "yarn compile && yarn test:tools && mocha --ui tdd --color --timeout 10000 \"out/test/unit/**/*.test.js\"",
"test:integration": "yarn compile && node ./out/test/runTest.js"
},
"devDependencies": {
Expand Down
40 changes: 40 additions & 0 deletions scripts/prepare-open-vsx-manifest.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { readFile, writeFile } from "node:fs/promises";
import { pathToFileURL } from "node:url";

const unavailableOpenVsxDependencies = new Set(["mxschmitt.postscript"]);

export function createOpenVsxManifest(manifest) {
const openVsxManifest = { ...manifest };
const availableDependencies = manifest.extensionDependencies?.filter(
(dependency) => !unavailableOpenVsxDependencies.has(dependency)
);

if (availableDependencies?.length) {
openVsxManifest.extensionDependencies = availableDependencies;
} else {
delete openVsxManifest.extensionDependencies;
}

return openVsxManifest;
}

async function prepareOpenVsxManifest(manifestPath) {
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
const openVsxManifest = createOpenVsxManifest(manifest);
await writeFile(
manifestPath,
`${JSON.stringify(openVsxManifest, null, "\t")}\n`,
"utf8"
);
}

if (
process.argv[1] &&
import.meta.url === pathToFileURL(process.argv[1]).href
) {
const manifestPath = process.argv[2];
if (!manifestPath) {
throw new Error("Usage: prepare-open-vsx-manifest.mjs <package.json>");
}
await prepareOpenVsxManifest(manifestPath);
}
37 changes: 37 additions & 0 deletions scripts/prepare-open-vsx-manifest.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import assert from "node:assert/strict";
import test from "node:test";
import { createOpenVsxManifest } from "./prepare-open-vsx-manifest.mjs";

test("removes unavailable extension dependencies from the Open VSX manifest", () => {
const marketplaceManifest = {
name: "postscript-preview",
version: "0.6.1",
extensionDependencies: ["mxschmitt.postscript"],
};

const openVsxManifest = createOpenVsxManifest(marketplaceManifest);

assert.deepEqual(openVsxManifest, {
name: "postscript-preview",
version: "0.6.1",
});
assert.deepEqual(marketplaceManifest.extensionDependencies, [
"mxschmitt.postscript",
]);
});

test("preserves dependencies that can be resolved by Open VSX", () => {
const marketplaceManifest = {
name: "postscript-preview",
extensionDependencies: [
"mxschmitt.postscript",
"example.available-extension",
],
};

const openVsxManifest = createOpenVsxManifest(marketplaceManifest);

assert.deepEqual(openVsxManifest.extensionDependencies, [
"example.available-extension",
]);
});
Loading