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

feat: zero dependencies #9

Merged
merged 6 commits into from
Nov 27, 2023
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
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
],
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
Expand All @@ -47,15 +46,13 @@
"test:watch": "vitest --watch",
"coverage": "vitest run --coverage"
},
"dependencies": {
"ofetch": "^1.3.3"
},
"devDependencies": {
"@antfu/eslint-config": "2.1.0",
"@vitest/coverage-v8": "^0.34.6",
"bumpp": "^9.2.0",
"eslint": "^8.54.0",
"lint-staged": "^15.1.0",
"ofetch": "^1.3.3",
"simple-git-hooks": "^2.9.0",
"tsup": "^8.0.1",
"typescript": "^5.3.2",
Expand Down
12 changes: 7 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ofetch } from 'ofetch'
import { $fetch } from 'ofetch'
import type { ClientConfig, ClientResponse, NoResponse, UserRes } from './types'
import { monitorManager, projectsManager, servicesManager, settingsManager } from './managers'
import { Routes } from './utils/Routes'
Expand All @@ -8,7 +8,7 @@ let token = ''
function client(config: ClientConfig): ClientResponse {
token = config.token

const customClient = ofetch.create({
const customClient = $fetch.create({
headers: {
'Content-Type': 'application/json',
'Authorization': config.token,
Expand Down
12 changes: 4 additions & 8 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import type { Options } from 'tsup'

import pkg from './package.json'

const external = [
...Object.keys(pkg.dependencies || {}),
]

export default <Options>{
entryPoints: ['src/index.ts'],
outDir: 'dist',
format: ['esm', 'cjs'],
sourcemap: true,
sourcemap: false,
clean: true,
dts: true,
minify: true,
external,
noExternal: [
'ofetch',
],
}