diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index a727df3..0000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = tab -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.yml] -indent_style = space diff --git a/.prettierrc b/.prettierrc index ff28e12..abadfaa 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,7 +1,7 @@ { - "printWidth": 100, - "singleQuote": false, - "semi": false, - "useTabs": false, - "tabWidth": 2 + "printWidth": 100, + "singleQuote": false, + "semi": false, + "useTabs": false, + "tabWidth": 2 } diff --git a/package.json b/package.json index b8da2cd..e45ce9d 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,19 @@ { - "name": "uniapi-monitor", - "version": "0.0.0", - "private": true, - "scripts": { - "deploy": "wrangler deploy", - "dev": "wrangler dev", - "start": "wrangler dev", - "test": "vitest", - "cf-typegen": "wrangler types" - }, - "devDependencies": { - "@cloudflare/vitest-pool-workers": "^0.8.19", - "prettier": "^3.6.2", - "typescript": "^5.5.2", - "vitest": "~3.2.0", - "wrangler": "^4.22.0" - } + "name": "uniapi-monitor", + "version": "0.0.0", + "private": true, + "scripts": { + "deploy": "wrangler deploy", + "dev": "wrangler dev", + "start": "wrangler dev", + "test": "vitest", + "cf-typegen": "wrangler types" + }, + "devDependencies": { + "@cloudflare/vitest-pool-workers": "^0.8.19", + "prettier": "^3.6.2", + "typescript": "^5.5.2", + "vitest": "~3.2.0", + "wrangler": "^4.22.0" + } } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index ca1f83e..d48544e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,45 +1,46 @@ { - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ - /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "target": "es2021", - /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - "lib": ["es2021"], - /* Specify what JSX code is generated. */ - "jsx": "react-jsx", - - /* Specify what module code is generated. */ - "module": "es2022", - /* Specify how TypeScript looks up a file from a given module specifier. */ - "moduleResolution": "Bundler", - /* Enable importing .json files */ - "resolveJsonModule": true, - - /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ - "allowJs": true, - /* Enable error reporting in type-checked JavaScript files. */ - "checkJs": false, - - /* Disable emitting files from a compilation. */ - "noEmit": true, - - /* Ensure that each file can be safely transpiled without relying on other imports. */ - "isolatedModules": true, - /* Allow 'import x from y' when a module doesn't have a default export. */ - "allowSyntheticDefaultImports": true, - /* Ensure that casing is correct in imports. */ - "forceConsistentCasingInFileNames": true, - - /* Enable all strict type-checking options. */ - "strict": true, - - /* Skip type checking all .d.ts files. */ - "skipLibCheck": true, - "types": [ - "./worker-configuration.d.ts" - ] - }, - "exclude": ["test"], - "include": ["worker-configuration.d.ts", "src/**/*.ts"] + /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es2021", + /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "lib": [ + "es2021" + ], + /* Specify what JSX code is generated. */ + "jsx": "react-jsx", + /* Specify what module code is generated. */ + "module": "es2022", + /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "Bundler", + /* Enable importing .json files */ + "resolveJsonModule": true, + /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "allowJs": true, + /* Enable error reporting in type-checked JavaScript files. */ + "checkJs": false, + /* Disable emitting files from a compilation. */ + "noEmit": true, + /* Ensure that each file can be safely transpiled without relying on other imports. */ + "isolatedModules": true, + /* Allow 'import x from y' when a module doesn't have a default export. */ + "allowSyntheticDefaultImports": true, + /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true, + /* Enable all strict type-checking options. */ + "strict": true, + /* Skip type checking all .d.ts files. */ + "skipLibCheck": true, + "types": [ + "./worker-configuration.d.ts" + ] + }, + "exclude": [ + "test" + ], + "include": [ + "worker-configuration.d.ts", + "src/**/*.ts" + ] } diff --git a/vitest.config.mts b/vitest.config.mts index 977f64c..526bdca 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -1,11 +1,11 @@ -import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config'; +import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config" export default defineWorkersConfig({ - test: { - poolOptions: { - workers: { - wrangler: { configPath: './wrangler.jsonc' }, - }, - }, - }, -}); + test: { + poolOptions: { + workers: { + wrangler: { configPath: "./wrangler.jsonc" }, + }, + }, + }, +}) diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 45d6d8a..e8de8a8 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -3,6 +3,9 @@ // Runtime types generated with workerd@1.20250617.0 2025-06-28 declare namespace Cloudflare { interface Env { + LARK_BOT_ID: string + LARK_SIGN_KEY: string + UNIAPI_TOKEN: string } } interface Env extends Cloudflare.Env {} diff --git a/wrangler.jsonc b/wrangler.jsonc index 4696ed8..ed0c1a6 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -3,45 +3,45 @@ * https://developers.cloudflare.com/workers/wrangler/configuration/ */ { - "$schema": "node_modules/wrangler/config-schema.json", - "name": "uniapi-monitor", - "main": "src/index.ts", - "compatibility_date": "2025-06-28", - "observability": { - "enabled": true - } - /** - * Smart Placement - * Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement - */ - // "placement": { "mode": "smart" }, + "$schema": "node_modules/wrangler/config-schema.json", + "name": "uniapi-monitor", + "main": "src/index.ts", + "compatibility_date": "2025-06-28", + "observability": { + "enabled": true + } + /** + * Smart Placement + * Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement + */ + // "placement": { "mode": "smart" }, - /** - * Bindings - * Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including - * databases, object storage, AI inference, real-time communication and more. - * https://developers.cloudflare.com/workers/runtime-apis/bindings/ - */ + /** + * Bindings + * Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including + * databases, object storage, AI inference, real-time communication and more. + * https://developers.cloudflare.com/workers/runtime-apis/bindings/ + */ - /** - * Environment Variables - * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables - */ - // "vars": { "MY_VARIABLE": "production_value" }, - /** - * Note: Use secrets to store sensitive data. - * https://developers.cloudflare.com/workers/configuration/secrets/ - */ + /** + * Environment Variables + * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables + */ + // "vars": { "MY_VARIABLE": "production_value" }, + /** + * Note: Use secrets to store sensitive data. + * https://developers.cloudflare.com/workers/configuration/secrets/ + */ - /** - * Static Assets - * https://developers.cloudflare.com/workers/static-assets/binding/ - */ - // "assets": { "directory": "./public/", "binding": "ASSETS" }, + /** + * Static Assets + * https://developers.cloudflare.com/workers/static-assets/binding/ + */ + // "assets": { "directory": "./public/", "binding": "ASSETS" }, - /** - * Service Bindings (communicate between multiple Workers) - * https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings - */ - // "services": [{ "binding": "MY_SERVICE", "service": "my-service" }] + /** + * Service Bindings (communicate between multiple Workers) + * https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings + */ + // "services": [{ "binding": "MY_SERVICE", "service": "my-service" }] }