Skip to content

Commit 8e210e8

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

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
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: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'fs';
2+
import path from 'path';
23

34
import { icons } from '@phosphor-icons/core';
45
import { resolve } from 'import-meta-resolve';
@@ -51,10 +52,14 @@ export default createPlugin.withOptions(
5152

5253
let url = 'icon-not-found';
5354
if (ICON_SET.has(name) && VARIANTS.includes(weight)) {
54-
let filepath = resolve(
55-
`@phosphor-icons/core/assets/${weight}/${name}${weight === 'regular' ? '' : `-${weight}`}.svg`,
56-
import.meta.url,
57-
).replace('file://', '');
55+
let filepath = path.resolve(
56+
resolve(
57+
`@phosphor-icons/core/assets/${weight}/${name}${weight === 'regular' ? '' : `-${weight}`}.svg`,
58+
import.meta.url,
59+
).replace('file://', ''),
60+
);
61+
console.log('dirname: ', import.meta.dirname);
62+
console.log('icon:', filepath);
5863

5964
if (fs.existsSync(filepath)) {
6065
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)