Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,21 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache-dependency-path: yarn.lock

- name: Enable pinned Yarn
run: |
corepack enable
corepack install
yarn --version

- name: Cache Yarn Berry artifacts
uses: actions/cache@v4
with:
path: ~/.yarn/berry/cache
key: ${{ runner.os }}-yarn4-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'package.json') }}

- name: Install dependencies
run: yarn install --immutable

- name: Bootstrap
run: |
Expand Down
6 changes: 4 additions & 2 deletions modules/dev-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@
"@vitest/browser-playwright": "^4.0.18",
"@vitest/coverage-v8": "^4.0.18",
"deepmerge": "^4.2.2",
"esbuild": "^0.16.7",
"esbuild": "^0.28.1",
"esbuild-plugin-external-global": "^1.0.1",
"glob": "^7.1.4",
"lerna": "^8.1.0",
"minimatch": "^3.0.0",
"playwright": "^1.58.0",
"semver": "^7.6.0",
"ts-node": "~10.9.0",
"ts-patch": "^3.1.2",
Expand All @@ -62,6 +61,9 @@
"vite": "^7.3.1",
"vitest": "^4.0.18"
},
"peerDependencies": {
"playwright": "^1.58.0"
},
"engines": {
"node": ">= 22"
}
Expand Down
26 changes: 4 additions & 22 deletions modules/dev-tools/src/configuration/biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,7 @@
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": true,
"includes": [
"**/*.js",
"**/*.jsx",
"**/*.mjs",
"**/*.cjs",
"**/*.ts",
"**/*.tsx",
"**/*.mts",
"**/*.cts"
]
"ignoreUnknown": true
},
"formatter": {
"enabled": true,
Expand All @@ -31,19 +21,12 @@
"recommended": true,
"correctness": {
"noUnusedImports": "error",
"noUnusedVariables": "error",
"useIsNan": "error"
"noUnusedVariables": "error"
},
"style": {
"noInferrableTypes": "off",
"noNonNullAssertion": "off",
"useConst": "off",
"useNamingConvention": {
"level": "warn",
"options": {
"strictCase": false
}
}
"useConst": "off"
},
"suspicious": {
"noConsole": "error",
Expand All @@ -63,8 +46,7 @@
"quoteStyle": "single",
"semicolons": "always",
"trailingCommas": "none"
},
"globals": ["__VERSION__"]
}
},
"assist": {
"enabled": false,
Expand Down
6 changes: 0 additions & 6 deletions modules/dev-tools/src/configuration/get-vitest-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@ function getTsconfigAliases(tsconfigProjects: string[]) {
});
} else {
const replacement = path.resolve(configDirectory, baseUrl, firstTarget).replace(/\\/g, '/');
// TypeScript treats an exact package path as the base for subpath imports too.
aliases.push({
key: `${aliasPattern}/*`,
find: new RegExp(`^${escapeRegExp(aliasPattern)}/(.+)$`),
replacement: `${replacement}/$1`
});
aliases.push({
key: aliasPattern,
find: aliasPattern,
Expand Down
16 changes: 16 additions & 0 deletions modules/dev-tools/test/configuration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {expect, test} from 'vitest';
import type {TestProjectInlineConfiguration} from 'vitest/config';
import {getOcularConfig, getVitestConfig} from '@vis.gl/dev-tools';
import path from 'node:path';
import {fileURLToPath} from 'node:url';

test('dev-tools#getConfig', () => {
expect(getOcularConfig).toBeTypeOf('function');
Expand Down Expand Up @@ -53,3 +55,17 @@ test('dev-tools#getVitestConfig supports legacy project overrides', () => {
include: ['test/legacy.spec.ts']
});
});

test('dev-tools#getVitestConfig resolves explicit wildcard aliases to their wildcard target', () => {
const fixturePath = fileURLToPath(new URL('./fixtures/tsconfig-aliases.json', import.meta.url));
const config = getVitestConfig({tsconfigProjects: [fixturePath]});
const aliases = config.resolve?.alias as Array<{find: string | RegExp; replacement: string}>;
const subpath = '@example/package/feature';
const matchingAlias = aliases.find(({find}) =>
typeof find === 'string' ? find === subpath : find.test(subpath)
);

expect(matchingAlias?.replacement).toBe(
path.resolve(path.dirname(fixturePath), 'src/$1').replace(/\\/g, '/')
);
});
9 changes: 9 additions & 0 deletions modules/dev-tools/test/fixtures/tsconfig-aliases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@example/package": ["./src/index.ts"],
"@example/package/*": ["./src/*"]
}
}
}
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@
"modules/*"
],
"scripts": {
"bootstrap": "yarn && ocular-bootstrap && npm run build",
"build": "ocular-clean && tspc -b modules/dev-tools/tsconfig.json && ocular-build",
"bootstrap": "ocular-bootstrap && npm run build",
"build": "ocular-clean && yarn workspace @vis.gl/dev-tools exec tspc -b tsconfig.json && ocular-build",
"cover": "ocular-test node --coverage",
"lint": "ocular-lint",
"test": "ocular-test node headless",
"test-browser": "ocular-test browser",
"test-headless": "ocular-test headless",
"publish-beta": "npm run build && ocular-publish beta",
"publish-prod": "npm run build && ocular-publish prod",
"pre-commit": "yarn lint",
"pre-push": "ocular-lint pre-commit && ocular-test node"
"pre-commit": "ocular-lint && ocular-test node"
},
"devDependencies": {
"@luma.gl/constants": "^9.0.0-beta",
"@vis.gl/dev-tools": "workspace:*",
"playwright": "^1.58.0",
"pre-commit": "^1.2.2",
"pre-push": "^0.1.1",
"ts-morph": "^21.0.0"
},
"pre-commit": "pre-commit",
"pre-push": "pre-push"
"packageManager": "yarn@4.18.0+sha512.fcb8716fe7cd0eece141ffc18b92193a9df9204c1ba83189c288835223fc0bbe64af473bab0d5e9927a7daeb5caf2bb07eb2787cc9338ca040ea125f2a1f2f7e"
}
Loading
Loading