Skip to content

Commit 197cc4e

Browse files
committed
fix: WIP attempt to fix path resolution for windows
1 parent 077bd47 commit 197cc4e

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.github/workflows/tests.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
runs-on: ${{ matrix.os }}
1919
strategy:
2020
matrix:
21-
os: [ubuntu-latest, macos-latest, windows-latest]
21+
# os: [ubuntu-latest, macos-latest, windows-latest]
22+
os: [windows-latest]
2223
timeout-minutes: 5
2324
steps:
2425
- name: Checkout repository

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"prepublishOnly": "publint",
4545
"lint": "eslint src/**/*",
4646
"test": "vitest --coverage",
47-
"ci:test": "vitest run --coverage",
47+
"ci:test": "vitest run --coverage --allowOnly",
4848
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
4949
"ci:publish": "changeset publish && pnpm install"
5050
},

src/plugin.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import fs from 'fs';
2+
import os from 'os';
3+
import path from 'path';
24

35
import { icons } from '@phosphor-icons/core';
46
import { resolve } from 'import-meta-resolve';
@@ -55,6 +57,11 @@ export default createPlugin.withOptions(
5557
`@phosphor-icons/core/assets/${weight}/${name}${weight === 'regular' ? '' : `-${weight}`}.svg`,
5658
import.meta.url,
5759
).replace('file://', '');
60+
if (os.platform() === 'win32') filepath = filepath.slice(1);
61+
filepath = path.resolve(filepath);
62+
63+
console.log('dirname: ', import.meta.dirname);
64+
console.log('icon:', filepath);
5865

5966
if (fs.existsSync(filepath)) {
6067
const svgStr = fs.readFileSync(filepath, { encoding: 'base64' });

tests/plugin.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface Run {
1616
}
1717

1818
function tests(run: Run, version: number) {
19-
test('default', async function ({ expect }) {
19+
test.only('default', async function ({ expect }) {
2020
const result = await run([...COMMON_CANDIDATES, 'ph', 'ph-[info]']);
2121
await expect(result).toMatchFileSnapshot(
2222
path.resolve(import.meta.dirname, '__snapshots__', `v${version}/default.css`),

0 commit comments

Comments
 (0)