Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix: #1075 package logo font for vscode extension
hippietraile78cb26f4e17
diff --git a/packages/vscode-plugin/.vscodeignore b/packages/vscode-plugin/.vscodeignoreindex 3ed678c86..ce6ea5652 100644--- a/packages/vscode-plugin/.vscodeignore+++ b/packages/vscode-plugin/.vscodeignore@@ -5,3 +5,12 @@!CHANGELOG.md!bin!icon.png++# Ignore build files+build/++# Ignore test files+tests/++# Include media directory+!media/diff --git a/packages/vscode-plugin/package.json b/packages/vscode-plugin/package.jsonindex f4c75b138..486a375f0 100644--- a/packages/vscode-plugin/package.json+++ b/packages/vscode-plugin/package.json@@ -1843,5 +1843,8 @@},"dependencies": {"vscode-languageclient": "^9.0.1"- }+ },+ "media": [+ "media/harper.woff"+ ]}diff --git a/packages/vscode-plugin/src/tests/suite/font.test.ts b/packages/vscode-plugin/src/tests/suite/font.test.tsnew file mode 100644index 000000000..c60db9312--- /dev/null+++ b/packages/vscode-plugin/src/tests/suite/font.test.ts@@ -0,0 +1,29 @@+import * as path from 'node:path';+import * as fs from 'node:fs/promises';+import { workspace } from 'vscode';++describe('Font >', () => {+ it('font file is included in extension package', async () => {+ // Get the workspace folder path+ const workspacePath = workspace.workspaceFolders![0].uri.fsPath;++ // Get the extension root path by going up to the package.json location+ const extensionRootPath = path.join(workspacePath, '..', '..', '..');++ // Check if the media directory exists in the extension root+ const mediaPath = path.join(extensionRootPath, 'media');+ try {+ await fs.access(mediaPath);+ } catch (error) {+ throw new Error(`Media directory not found at ${mediaPath}. This indicates that the media directory may not have been properly included in the extension package.`);+ }++ // Check if the font file exists in the media directory+ const fontPath = path.join(mediaPath, 'harper.woff');+ try {+ await fs.access(fontPath);+ } catch (error) {+ throw new Error(`Font file not found at ${fontPath}. This indicates that the font file may not have been properly included in the extension package.`);+ }+ });+});\ No newline at end of filediff --git a/packages/vscode-plugin/src/tests/suite/vsix.test.ts b/packages/vscode-plugin/src/tests/suite/vsix.test.tsnew file mode 100644index 000000000..631466461--- /dev/null+++ b/packages/vscode-plugin/src/tests/suite/vsix.test.ts@@ -0,0 +1,50 @@+import * as path from 'node:path';+import * as fsPromises from 'node:fs/promises';+import { workspace } from 'vscode';+import * as child_process from 'child_process';++describe('VSIX Package >', () => {+ it('contains the font file', async () => {+ // Get the workspace folder path+ const workspacePath = workspace.workspaceFolders![0].uri.fsPath;++ // Get the extension root path by going up to the package.json location+ const extensionRootPath = path.join(workspacePath, '..', '..', '..');++ // Verify the VSIX package contents+ const vsixPath = path.join(extensionRootPath, 'harper-0.29.0.vsix');+ try {+ // Check if the VSIX file exists+ await fsPromises.access(vsixPath);++ // Create a temporary directory to extract the VSIX+ const tempDir = path.join(extensionRootPath, 'temp-vsix-extract');+ await fsPromises.mkdir(tempDir, { recursive: true });++ // Extract the VSIX using the system unzip command with -o flag to overwrite+ const unzipResult = child_process.spawnSync('unzip', [+ '-o', // Overwrite existing files without prompting+ vsixPath,+ '-d',+ tempDir+ ]);++ if (unzipResult.status !== 0) {+ throw new Error(`Failed to extract VSIX package: ${unzipResult.stderr.toString()}`);+ }++ // Verify the font file exists in the extracted VSIX+ const fontPath = path.join(tempDir, 'extension', 'media', 'harper.woff');+ try {+ await fsPromises.access(fontPath);+ } catch (error) {+ throw new Error(`Font file not found in VSIX package at ${fontPath}`);+ }++ // Clean up+ await fsPromises.rm(tempDir, { recursive: true, force: true });+ } catch (error) {+ throw new Error(`Failed to verify VSIX package contents: ${error}`);+ }+ });+});\ No newline at end of file