chore(root): migrate to biome
This commit is contained in:
@@ -3,25 +3,11 @@
|
||||
"version": "0.0.1",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"with-env": "dotenv -e ../../.env -c --"
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openpanel/eslint-config": "workspace:*",
|
||||
"@openpanel/prettier-config": "workspace:*",
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"prisma": "^5.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@openpanel/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@openpanel/prettier-config"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { OpenPanel } from '@openpanel/sdk';
|
||||
export * from '@openpanel/sdk';
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Express {
|
||||
export interface Request {
|
||||
op: OpenPanel;
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
"module": "index.ts",
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsup",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -16,21 +14,10 @@
|
||||
"express": "^3.0.0 || ^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openpanel/eslint-config": "workspace:*",
|
||||
"@openpanel/prettier-config": "workspace:*",
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/request-ip": "^0.0.41",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@openpanel/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@openpanel/prettier-config"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert {
|
||||
type: 'json',
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
...(config as any),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import Script from 'next/script';
|
||||
import React from 'react';
|
||||
|
||||
import type {
|
||||
DecrementPayload,
|
||||
@@ -100,7 +100,7 @@ export function useOpenPanel() {
|
||||
}
|
||||
|
||||
function track(name: string, properties?: TrackProperties) {
|
||||
window.op && window.op('track', name, properties);
|
||||
window.op?.('track', name, properties);
|
||||
}
|
||||
|
||||
function screenView(properties: TrackProperties) {
|
||||
@@ -108,11 +108,11 @@ function screenView(properties: TrackProperties) {
|
||||
}
|
||||
|
||||
function identify(payload: IdentifyPayload) {
|
||||
window.op && window.op('identify', payload);
|
||||
window.op?.('identify', payload);
|
||||
}
|
||||
|
||||
function increment(payload: IncrementPayload) {
|
||||
window.op && window.op('increment', payload);
|
||||
window.op?.('increment', payload);
|
||||
}
|
||||
|
||||
function decrement(payload: DecrementPayload) {
|
||||
@@ -120,5 +120,5 @@ function decrement(payload: DecrementPayload) {
|
||||
}
|
||||
|
||||
function clear() {
|
||||
window.op && window.op('clear');
|
||||
window.op?.('clear');
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
"module": "index.ts",
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsup",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -17,20 +15,9 @@
|
||||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openpanel/eslint-config": "workspace:*",
|
||||
"@openpanel/prettier-config": "workspace:*",
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
"@types/react": "^18.2.20",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@openpanel/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@openpanel/prettier-config"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert {
|
||||
type: 'json',
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
...(config as any),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AppState, Platform } from 'react-native';
|
||||
import * as Application from 'expo-application';
|
||||
import Constants from 'expo-constants';
|
||||
import { AppState, Platform } from 'react-native';
|
||||
|
||||
import type { OpenPanelOptions, TrackProperties } from '@openpanel/sdk';
|
||||
import { OpenPanel as OpenPanelBase } from '@openpanel/sdk';
|
||||
|
||||
@@ -4,20 +4,14 @@
|
||||
"module": "index.ts",
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsup",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openpanel/sdk": "1.0.0-local"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openpanel/eslint-config": "workspace:*",
|
||||
"@openpanel/prettier-config": "workspace:*",
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
"@types/node": "^20.14.12",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
@@ -25,12 +19,5 @@
|
||||
"expo-application": "^5",
|
||||
"expo-constants": "14 - 16",
|
||||
"react-native": "0.73 - 0.74"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@openpanel/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@openpanel/prettier-config"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert {
|
||||
type: 'json',
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
...(config as any),
|
||||
|
||||
@@ -4,26 +4,13 @@
|
||||
"module": "index.ts",
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsup",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@openpanel/eslint-config": "workspace:*",
|
||||
"@openpanel/prettier-config": "workspace:*",
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
"@types/node": "^20.14.12",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@openpanel/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@openpanel/prettier-config"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export class Api {
|
||||
url: string,
|
||||
data: ReqBody,
|
||||
options: FetchOptions,
|
||||
attempt: number
|
||||
attempt: number,
|
||||
): Promise<ResBody | null> {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
@@ -65,7 +65,7 @@ export class Api {
|
||||
return responseText ? JSON.parse(responseText) : null;
|
||||
} catch (error) {
|
||||
if (attempt < this.maxRetries) {
|
||||
const delay = this.initialRetryDelay * Math.pow(2, attempt);
|
||||
const delay = this.initialRetryDelay * 2 ** attempt;
|
||||
await new Promise((resolve) => setTimeout(resolve, delay));
|
||||
return this.post<ReqBody, ResBody>(url, data, options, attempt + 1);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export class Api {
|
||||
async fetch<ReqBody, ResBody>(
|
||||
path: string,
|
||||
data: ReqBody,
|
||||
options: FetchOptions = {}
|
||||
options: FetchOptions = {},
|
||||
): Promise<ResBody | null> {
|
||||
const url = `${this.baseUrl}${path}`;
|
||||
return this.post<ReqBody, ResBody>(url, data, options, 0);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert {
|
||||
type: 'json',
|
||||
};
|
||||
|
||||
export default defineConfig(config as any);
|
||||
|
||||
@@ -4,28 +4,15 @@
|
||||
"module": "index.ts",
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsup",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openpanel/sdk": "1.0.0-local"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openpanel/eslint-config": "workspace:*",
|
||||
"@openpanel/prettier-config": "workspace:*",
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
"@types/node": "^20.14.12",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@openpanel/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@openpanel/prettier-config"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
|
||||
import type {
|
||||
OpenPanelOptions as OpenPanelBaseOptions,
|
||||
TrackProperties,
|
||||
@@ -18,7 +16,7 @@ export type OpenPanelOptions = OpenPanelBaseOptions & {
|
||||
|
||||
function toCamelCase(str: string) {
|
||||
return str.replace(/([-_][a-z])/gi, ($1) =>
|
||||
$1.toUpperCase().replace('-', '').replace('_', '')
|
||||
$1.toUpperCase().replace('-', '').replace('_', ''),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +106,7 @@ export class OpenPanel extends OpenPanelBase {
|
||||
return ret;
|
||||
};
|
||||
|
||||
window.addEventListener('popstate', function () {
|
||||
window.addEventListener('popstate', () => {
|
||||
window.dispatchEvent(new Event('locationchange'));
|
||||
});
|
||||
|
||||
@@ -155,7 +153,7 @@ export class OpenPanel extends OpenPanelBase {
|
||||
screenView(path: string, properties?: TrackProperties): void;
|
||||
screenView(
|
||||
pathOrProperties?: string | TrackProperties,
|
||||
propertiesOrUndefined?: TrackProperties
|
||||
propertiesOrUndefined?: TrackProperties,
|
||||
): void {
|
||||
if (this.isServer()) {
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
|
||||
import config from '@openpanel/tsconfig/tsup.config.json' assert {
|
||||
type: 'json',
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
...(config as any),
|
||||
|
||||
Reference in New Issue
Block a user