Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch base tsconfig to github.com/tsconfig/bases #4325

Merged
merged 10 commits into from
Aug 30, 2024
Merged
14,445 changes: 3,660 additions & 10,785 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@swc/core": "~1.7.0",
"@swc/helpers": "~0.5.2",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@tsconfig/node20": "20.1.4",
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
"@types/execa": "^2.0.0",
"@types/jest": "29.5.12",
"@types/node": "20.14.12",
Expand Down
13 changes: 13 additions & 0 deletions packages/samples/headless-commerce-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Coveo Headless Commerce React Samples</title>
</head>
<body>
<div id="root"></div>
<!-- Vite uses ES module imports, so we reference the main entry file directly -->
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
21 changes: 13 additions & 8 deletions packages/samples/headless-commerce-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
"name": "@coveo/headless-commerce-react-samples",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@coveo/headless": "2.79.0",
"@testing-library/jest-dom": "6.4.8",
"@testing-library/react": "16.0.0",
"@testing-library/user-event": "14.5.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-scripts": "5.0.1"
"react-dom": "18.3.1"
},
"scripts": {
"dev": "react-scripts start",
"dev": "vite",
"build": "nx build",
"build:client": "tsc --noEmit && tsc --module commonjs --noEmit",
"test": "react-scripts test"
"build:client": "vite build",
"preview": "vite preview",
"test": "vitest"
},
"browserslist": {
"production": [
Expand All @@ -28,5 +26,12 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@testing-library/jest-dom": "6.5.0",
"@testing-library/react": "16.0.0",
"@vitejs/plugin-react": "4.3.1",
"vite": "5.4.2",
"vitest": "2.0.5"
}
}
8 changes: 6 additions & 2 deletions packages/samples/headless-commerce-react/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import {render} from '@testing-library/react';
import {vi, MockInstance} from 'vitest';
import App from './App';

let errorSpy: jest.SpyInstance;
let errorSpy: MockInstance<{
(...data: unknown[]): void;
(message?: unknown, ...optionalParams: unknown[]): void;
}>;

beforeEach(() => {
errorSpy = jest.spyOn(global.console, 'error');
errorSpy = vi.spyOn(global.console, 'error');
});

test('renders without error', async () => {
Expand Down
1 change: 0 additions & 1 deletion packages/samples/headless-commerce-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
Expand Down
15 changes: 15 additions & 0 deletions packages/samples/headless-commerce-react/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import react from '@vitejs/plugin-react';
import {defineConfig} from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
open: true,
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/setupTests.ts',
},
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const {resolve} = require('path');
const gtsPkgJsonPath = require.resolve('gts/package.json');
import {resolve} from 'path';
import {fileURLToPath} from 'url';

// Resolve the path to the gts package.json
const gtsPkgJsonPath = fileURLToPath(
new URL('gts/package.json', import.meta.url)
);
const gtsPath = resolve(gtsPkgJsonPath, '..');

module.exports = {
export default {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'react'],
Expand Down
13 changes: 13 additions & 0 deletions packages/samples/headless-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Coveo Headless React Samples</title>
</head>
<body>
<div id="root"></div>
<!-- Vite uses ES module imports, so we reference the main entry file directly -->
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
18 changes: 9 additions & 9 deletions packages/samples/headless-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Samples with @coveo/headless & React",
"version": "0.0.0",
"private": true,
"type": "module",
"dependencies": {
"@coveo/auth": "1.11.22",
"@coveo/headless": "2.79.0",
Expand All @@ -19,20 +20,18 @@
"escape-html": "1.0.3",
"express": "4.19.2",
"filesize": "10.1.4",
"jest-watch-typeahead": "2.2.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.26.0",
"react-scripts": "5.0.1",
"typescript": "5.4.5",
"web-vitals": "3.5.2"
},
"scripts": {
"dev": "react-scripts start",
"dev": "vite",
"build": "nx build",
"build:client": "tsc --noEmit && tsc --module commonjs --noEmit",
"build:server": "tsc --project ./tsconfig.server.json",
"test": "react-scripts test",
"build:client": "vite build",
"serve": "vite preview",
"test": "vitest run",
"prod:ssr": "node ./build/server/server/server.js"
},
"browserslist": {
Expand All @@ -49,11 +48,12 @@
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@vitejs/plugin-react": "3.1.0",
"cypress": "13.13.1",
"cypress-repeat": "2.3.5",
"gts": "5.3.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"patch-package": "6.4.7"
"patch-package": "6.4.7",
"vite": "4.5.3",
"vitest": "0.30.1"
}
}
8 changes: 6 additions & 2 deletions packages/samples/headless-react/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import {
getSampleSearchEngineConfiguration,
} from '@coveo/headless';
import {render} from '@testing-library/react';
import {vi, SpyInstance} from 'vitest';
import App from './App';

let errorSpy: jest.SpyInstance;
let errorSpy: SpyInstance<
[message?: unknown, ...optionalParams: unknown[]],
void
>;

beforeEach(() => {
errorSpy = jest.spyOn(global.console, 'error');
errorSpy = vi.spyOn(global.console, 'error');
});

test('renders without error', async () => {
Expand Down
17 changes: 17 additions & 0 deletions packages/samples/headless-react/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import react from '@vitejs/plugin-react';
import {defineConfig} from 'vite';

export default defineConfig({
plugins: [react()],
build: {
outDir: 'build',
},
server: {
open: true,
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/setupTests.ts',
},
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./node_modules/gts/tsconfig-google.json",
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"skipLibCheck": true
},
Expand Down
Loading