Skip to content

Commit 5946611

Browse files
committed
fix(astro): apply fast-glob Windows work-around for all \@ matches
1 parent b57a764 commit 5946611

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

packages/theme/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
],
2929
"scripts": {
3030
"build": "tsc -b",
31-
"dev": "pnpm run build --watch --preserveWatchOutput"
31+
"dev": "pnpm run build --watch --preserveWatchOutput",
32+
"test": "vitest"
3233
},
3334
"dependencies": {
3435
"@iconify-json/ph": "^1.1.13",
@@ -38,6 +39,7 @@
3839
},
3940
"devDependencies": {
4041
"@types/node": "^22.4.1",
41-
"typescript": "^5.4.5"
42+
"typescript": "^5.4.5",
43+
"vitest": "^2.1.1"
4244
}
4345
}

packages/theme/src/index.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { fileURLToPath, URL } from 'node:url';
2+
import { expect, test } from 'vitest';
3+
import { getInlineContentForPackage } from './index.js';
4+
5+
const root = fileURLToPath(new URL('../../template', import.meta.url));
6+
7+
test('getInlineContentForPackage finds files from @tutorialkit/astro', () => {
8+
const content = getInlineContentForPackage({
9+
name: '@tutorialkit/astro',
10+
pattern: '/dist/default/**/*.astro',
11+
root,
12+
});
13+
14+
expect(content.length).toBeGreaterThan(0);
15+
});

packages/theme/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function getInlineContentForPackage({ name, pattern, root }: { name: stri
4949
const packageRoot = resolve(require.resolve(`${name}/package.json`, { paths: [root] }), '..');
5050

5151
// work-around for https://github.com/mrmlnc/fast-glob/issues/452
52-
const packagePattern = convertPathToPattern(packageRoot.replace('\\@', '/@'));
52+
const packagePattern = convertPathToPattern(packageRoot.replaceAll('\\@', '/@'));
5353

5454
return globSync(`${packagePattern}${pattern}`).map((filePath) => () => fs.readFile(filePath, { encoding: 'utf8' }));
5555
} catch {

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)