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
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ jobs:
- name: Run lint
run: yarn lint

types:
name: Type check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

- name: Setup node
uses: ./.github/actions/setup-node

- name: Run type check
run: yarn types

build:
name: Build
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions .lintstagedrc

This file was deleted.

7 changes: 7 additions & 0 deletions .lintstagedrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Configuration } from 'lint-staged';

const config: Configuration = {
'*': () => ['oxlint', 'oxfmt'],
};

export default config;
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import type { Config } from 'jest';

import packageJson from './package.json' with { type: 'json' };

const config: Config = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/src/**/*.test.{js,jsx,ts,tsx}'],
globals: {
__VERSION__: JSON.stringify(packageJson.version),
},
};

export default config;
61 changes: 35 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@
"description": "Sigma Computing Plugin Client API",
"license": "MIT",
"homepage": "https://github.com/sigmacomputing/plugin",
"main": "./dist/index.js",
"type": "module",
"main": "./dist/cjs/index.cjs",
"module": "./dist/esm/index.js",
"types": "./dist/cjs/index.d.cts",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
}
},
"./package.json": "./package.json"
},
"repository": {
"type": "git",
"url": "https://github.com/sigmacomputing/plugin.git"
Expand All @@ -15,55 +31,48 @@
},
"packageManager": "yarn@4.13.0",
"files": [
"dist/**/*"
"dist/**/*",
"src/**/*",
"!src/**/__tests__/**/*"
],
"typesVersions": {
"*": {
"react": [
"dist/react/index.d.ts"
]
}
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "yarn tsc --build tsconfig.build.json",
"build:watch": "yarn build --watch",
"build": "tsdown",
"build:watch": "tsdown --watch",
"format": "yarn oxfmt",
"lint": "yarn oxlint",
"precommit": "lint-staged",
"publish": "yarn build && yarn npm publish",
"test": "jest --ci",
"test:watch": "yarn test --watch"
"test:watch": "yarn test --watch",
"types": "tsc --noEmit"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
},
"devDependencies": {
"@jest/types": "^27.5.1",
"@types/jest": "^27.5.1",
"@types/node": "^18.7.14",
"@arethetypeswrong/core": "^0.18.2",
"@types/jest": "^30.0.0",
"@types/node": "^24.0.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"jest": "^30.3.0",
"jest-environment-jsdom": "^30.3.0",
"jest-watch-typeahead": "^2.1.1",
"lint-staged": "^13.0.3",
"jest-watch-typeahead": "^3.0.1",
"lint-staged": "^16.4.0",
"oxfmt": "^0.38.0",
"oxlint": "^1.53.0",
"oxlint-tsgolint": "^0.16.0",
"ts-jest": "^29.4.6",
"ts-node": "^10.9.2",
"typescript": "^4.8.2"
"publint": "^0.3.18",
"ts-jest": "^29.4.9",
"tsdown": "^0.21.10",
"typescript": "^6.0.2",
"unplugin-unused": "^0.5.7"
}
}
5 changes: 1 addition & 4 deletions src/client/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ export function initialize<T = {}>(): PluginInstance<T> {
});

// send initialize event
void execPromise(
'wb:plugin:init',
require('../../package.json').version,
).then(config => {
void execPromise('wb:plugin:init', __VERSION__).then(config => {
Object.assign(pluginConfig, config);
emit('init', pluginConfig);
emit('config', pluginConfig.config);
Expand Down
1 change: 1 addition & 0 deletions src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const __VERSION__: string;
6 changes: 2 additions & 4 deletions src/react.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export * from './react/hooks';
export {
SigmaClientProviderProps,
SigmaClientProvider,
} from './react/Provider';
export type { SigmaClientProviderProps } from './react/Provider';
export { SigmaClientProvider } from './react/Provider';
17 changes: 6 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
{
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "CommonJS",
"moduleResolution": "node",
"target": "ES2015",
"lib": ["DOM", "ESNext"],

"baseUrl": "./",

"declaration": true,
"declarationMap": true,
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ESNext",

"jsx": "react-jsx",
"downlevelIteration": true,
"noImplicitAny": true,
"strict": true,

"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"resolveJsonModule": true
"types": ["jest"]
},
"include": ["src", "jest.config.ts"]
"include": ["src", "jest.config.ts", "tsdown.config.ts"]
}
34 changes: 34 additions & 0 deletions tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineConfig } from 'tsdown';

import packageJson from './package.json' with { type: 'json' };

export default defineConfig({
clean: true,
failOnWarn: true,
logLevel: 'warn',

dts: true,
entry: ['src/index.ts'],
format: {
esm: {
outputOptions: {
dir: 'dist/esm',
},
},
cjs: {
outputOptions: {
dir: 'dist/cjs',
},
},
},
platform: 'browser',
sourcemap: true,

define: {
__VERSION__: JSON.stringify(packageJson.version),
},

publint: true,
attw: true,
unused: true,
});
Loading