Skip to content

Commit e260d81

Browse files
chore(client-core): Move client codebase to typescript (#9562)
* rename to ts * Move to TS whole codebase * Move to TS tests * side fix :) * fix tools settings * temp comment out rollup for client-core * update ts config and remove babel * a few more type fixes * versions sync * return back rollup * another try to fix rollup * build fixes * fix quotes * fix ts config * return back lint plugin * delete removed rule * fix lint errors * fix lint error in BaseDriver * fix linting in api-gateway * fix linting in BaseQueueDriver * fix linting in QueryTestAbstract * more fixes * more type fixes * Fix more types * fix load() * fix vue clients * fix getNormalizedPivotConfig() * trying to fix dev docker img * exclude index.umd.js from coverage * trying to fix dev docker img * revert all docker changes in docker file * fix client builds * entry point fixes * fix quotes * module fix * updated uuid * trying to fix jest tests + client core build * remove module * unit tests * fix coverage * fix entry point * ws fix * resolve fix * cleanup * fix yarn.lock * some configs polishment * fix after rebasing * improve ts config for jest * more tests for resultset * fix test for cubeApi * few more tests --------- Co-authored-by: Alex Vasilev <[email protected]>
1 parent 21ba79d commit e260d81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4941
-3532
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
**
22
!package.json
33
!tsconfig.base.json
4+
!tsconfig.json
45
!rollup.config.js
56
!yarn.lock
67
!lerna.json

jest.base-ts.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const base = require('./jest.base.config');
2+
3+
/** @type {import('jest').Config} */
4+
module.exports = {
5+
...base,
6+
preset: 'ts-jest',
7+
testMatch: ['<rootDir>/test/**/*.test.ts'],
8+
moduleFileExtensions: ['ts', 'js', 'json'],
9+
transform: {
10+
'^.+\\.ts$': ['ts-jest', { tsconfig: '../../tsconfig.jest.json' }],
11+
},
12+
collectCoverageFrom: [
13+
'<rootDir>/src/**/*.{ts,tsx}',
14+
'!<rootDir>/src/**/*.d.ts',
15+
]
16+
};

jest.base.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
'^uuid$': require.resolve('uuid'),
1717
'^yaml$': require.resolve('yaml'),
1818
},
19+
setupFiles: ['../../jest.setup.js'],
1920
snapshotFormat: {
2021
escapeString: true, // To keep existing variant of snapshots
2122
printBasicPrototype: true

jest.setup.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const { webcrypto } = require('node:crypto');
2+
3+
if (!globalThis.crypto) {
4+
globalThis.crypto = webcrypto;
5+
}

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
]
1515
},
1616
"scripts": {
17-
"build": "rollup -c",
17+
"build": "yarn lerna run build:client-core && rollup -c",
1818
"watch": "rollup -c -w",
1919
"watch-local": "CUBEJS_API_URL=http://localhost:6020/cubejs-api/v1 rollup -c -w",
2020
"lint:npm": "yarn npmPkgJsonLint packages/*/package.json rust/package.json",
@@ -26,7 +26,6 @@
2626
},
2727
"author": "Cube Dev, Inc.",
2828
"dependencies": {
29-
"@typescript-eslint/eslint-plugin": "^4.17.0",
3029
"core-js": "^3.34.0",
3130
"lerna": "^8.2.1"
3231
},
@@ -44,7 +43,9 @@
4443
"@rollup/plugin-alias": "^3.1.2",
4544
"@rollup/plugin-babel": "^5.3.0",
4645
"@rollup/plugin-commonjs": "^17.1.0",
46+
"@rollup/plugin-json": "^6.1.0",
4747
"@rollup/plugin-node-resolve": "^11.2.0",
48+
"@typescript-eslint/eslint-plugin": "^6.12.0",
4849
"@types/fs-extra": "^9.0.1",
4950
"@types/jest": "^27",
5051
"flush-promises": "^1.0.2",
@@ -57,6 +58,7 @@
5758
"rimraf": "^3.0.2",
5859
"rollup": "2.53.1",
5960
"rollup-plugin-peer-deps-external": "^2.2.4",
61+
"rollup-plugin-tsconfig-paths": "^1.5.2",
6062
"typescript": "~5.2.2"
6163
},
6264
"repository": {

packages/cubejs-api-gateway/test/helpers/prepareAnnotation.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
/* globals describe,test,expect */
88
/* eslint-disable import/no-duplicates */
9-
/* eslint-disable @typescript-eslint/no-duplicate-imports */
109

1110
import { MemberType } from '../../src/types/enums';
1211
import prepareAnnotationDef

packages/cubejs-base-driver/src/BaseDriver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@ export abstract class BaseDriver implements DriverInterface {
375375
return undefined;
376376
}
377377

378-
abstract testConnection(): Promise<void>;
378+
public abstract testConnection(): Promise<void>;
379379

380-
abstract query<R = unknown>(_query: string, _values?: unknown[], _options?: QueryOptions): Promise<R[]>;
380+
public abstract query<R = unknown>(_query: string, _values?: unknown[], _options?: QueryOptions): Promise<R[]>;
381381

382382
// eslint-disable-next-line @typescript-eslint/no-unused-vars
383383
public async streamQuery(sql: string, values: string[]): Promise<stream.Readable> {

packages/cubejs-client-core/.eslintrc.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

packages/cubejs-client-core/babel.config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)