Skip to content

Commit 26652ac

Browse files
fix(dev-tools): various bug fixes (#47)
1 parent 06cb71c commit 26652ac

8 files changed

Lines changed: 61 additions & 272 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,21 @@ jobs:
2121
uses: actions/setup-node@v4
2222
with:
2323
node-version: ${{ matrix.node-version }}
24-
cache: yarn
25-
cache-dependency-path: yarn.lock
24+
25+
- name: Enable pinned Yarn
26+
run: |
27+
corepack enable
28+
corepack install
29+
yarn --version
30+
31+
- name: Cache Yarn Berry artifacts
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.yarn/berry/cache
35+
key: ${{ runner.os }}-yarn4-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'package.json') }}
36+
37+
- name: Install dependencies
38+
run: yarn install --immutable
2639

2740
- name: Bootstrap
2841
run: |

‎modules/dev-tools/package.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@
4848
"@vitest/browser-playwright": "^4.0.18",
4949
"@vitest/coverage-v8": "^4.0.18",
5050
"deepmerge": "^4.2.2",
51-
"esbuild": "^0.16.7",
51+
"esbuild": "^0.28.1",
5252
"esbuild-plugin-external-global": "^1.0.1",
5353
"glob": "^7.1.4",
5454
"lerna": "^8.1.0",
5555
"minimatch": "^3.0.0",
56-
"playwright": "^1.58.0",
5756
"semver": "^7.6.0",
5857
"ts-node": "~10.9.0",
5958
"ts-patch": "^3.1.2",
@@ -62,6 +61,9 @@
6261
"vite": "^7.3.1",
6362
"vitest": "^4.0.18"
6463
},
64+
"peerDependencies": {
65+
"playwright": "^1.58.0"
66+
},
6567
"engines": {
6668
"node": ">= 22"
6769
}

‎modules/dev-tools/src/configuration/biome.jsonc‎

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,7 @@
77
"useIgnoreFile": true
88
},
99
"files": {
10-
"ignoreUnknown": true,
11-
"includes": [
12-
"**/*.js",
13-
"**/*.jsx",
14-
"**/*.mjs",
15-
"**/*.cjs",
16-
"**/*.ts",
17-
"**/*.tsx",
18-
"**/*.mts",
19-
"**/*.cts"
20-
]
10+
"ignoreUnknown": true
2111
},
2212
"formatter": {
2313
"enabled": true,
@@ -31,19 +21,12 @@
3121
"recommended": true,
3222
"correctness": {
3323
"noUnusedImports": "error",
34-
"noUnusedVariables": "error",
35-
"useIsNan": "error"
24+
"noUnusedVariables": "error"
3625
},
3726
"style": {
3827
"noInferrableTypes": "off",
3928
"noNonNullAssertion": "off",
40-
"useConst": "off",
41-
"useNamingConvention": {
42-
"level": "warn",
43-
"options": {
44-
"strictCase": false
45-
}
46-
}
29+
"useConst": "off"
4730
},
4831
"suspicious": {
4932
"noConsole": "error",
@@ -63,8 +46,7 @@
6346
"quoteStyle": "single",
6447
"semicolons": "always",
6548
"trailingCommas": "none"
66-
},
67-
"globals": ["__VERSION__"]
49+
}
6850
},
6951
"assist": {
7052
"enabled": false,

‎modules/dev-tools/src/configuration/get-vitest-config.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,6 @@ function getTsconfigAliases(tsconfigProjects: string[]) {
191191
});
192192
} else {
193193
const replacement = path.resolve(configDirectory, baseUrl, firstTarget).replace(/\\/g, '/');
194-
// TypeScript treats an exact package path as the base for subpath imports too.
195-
aliases.push({
196-
key: `${aliasPattern}/*`,
197-
find: new RegExp(`^${escapeRegExp(aliasPattern)}/(.+)$`),
198-
replacement: `${replacement}/$1`
199-
});
200194
aliases.push({
201195
key: aliasPattern,
202196
find: aliasPattern,

‎modules/dev-tools/test/configuration.spec.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {expect, test} from 'vitest';
22
import type {TestProjectInlineConfiguration} from 'vitest/config';
33
import {getOcularConfig, getVitestConfig} from '@vis.gl/dev-tools';
4+
import path from 'node:path';
5+
import {fileURLToPath} from 'node:url';
46

57
test('dev-tools#getConfig', () => {
68
expect(getOcularConfig).toBeTypeOf('function');
@@ -53,3 +55,17 @@ test('dev-tools#getVitestConfig supports legacy project overrides', () => {
5355
include: ['test/legacy.spec.ts']
5456
});
5557
});
58+
59+
test('dev-tools#getVitestConfig resolves explicit wildcard aliases to their wildcard target', () => {
60+
const fixturePath = fileURLToPath(new URL('./fixtures/tsconfig-aliases.json', import.meta.url));
61+
const config = getVitestConfig({tsconfigProjects: [fixturePath]});
62+
const aliases = config.resolve?.alias as Array<{find: string | RegExp; replacement: string}>;
63+
const subpath = '@example/package/feature';
64+
const matchingAlias = aliases.find(({find}) =>
65+
typeof find === 'string' ? find === subpath : find.test(subpath)
66+
);
67+
68+
expect(matchingAlias?.replacement).toBe(
69+
path.resolve(path.dirname(fixturePath), 'src/$1').replace(/\\/g, '/')
70+
);
71+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"@example/package": ["./src/index.ts"],
6+
"@example/package/*": ["./src/*"]
7+
}
8+
}
9+
}

‎package.json‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@
77
"modules/*"
88
],
99
"scripts": {
10-
"bootstrap": "yarn && ocular-bootstrap && npm run build",
11-
"build": "ocular-clean && tspc -b modules/dev-tools/tsconfig.json && ocular-build",
10+
"bootstrap": "ocular-bootstrap && npm run build",
11+
"build": "ocular-clean && yarn workspace @vis.gl/dev-tools exec tspc -b tsconfig.json && ocular-build",
1212
"cover": "ocular-test node --coverage",
1313
"lint": "ocular-lint",
1414
"test": "ocular-test node headless",
1515
"test-browser": "ocular-test browser",
1616
"test-headless": "ocular-test headless",
1717
"publish-beta": "npm run build && ocular-publish beta",
1818
"publish-prod": "npm run build && ocular-publish prod",
19-
"pre-commit": "yarn lint",
20-
"pre-push": "ocular-lint pre-commit && ocular-test node"
19+
"pre-commit": "ocular-lint && ocular-test node"
2120
},
2221
"devDependencies": {
2322
"@luma.gl/constants": "^9.0.0-beta",
23+
"@vis.gl/dev-tools": "workspace:*",
24+
"playwright": "^1.58.0",
2425
"pre-commit": "^1.2.2",
2526
"pre-push": "^0.1.1",
2627
"ts-morph": "^21.0.0"
2728
},
2829
"pre-commit": "pre-commit",
29-
"pre-push": "pre-push"
30+
"packageManager": "yarn@4.18.0+sha512.fcb8716fe7cd0eece141ffc18b92193a9df9204c1ba83189c288835223fc0bbe64af473bab0d5e9927a7daeb5caf2bb07eb2787cc9338ca040ea125f2a1f2f7e"
3031
}

0 commit comments

Comments
 (0)