Skip to content

Commit

Permalink
fix(pkg): use unbuild and fix drivers/* export
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 24, 2021
1 parent f6935f2 commit 251182b
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 164 deletions.
11 changes: 11 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
declaration: true,
entries: [
'src/index',
'src/server',
{ input: 'src/drivers/', outDir: 'drivers', format: 'esm' },
{ input: 'src/drivers/', outDir: 'drivers', format: 'cjs', declaration: false }
]
})
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"license": "MIT",
"sideEffects": false,
"exports": {
"./*": "./*",
"./drivers/*": {
"import": "./drivers/*.mjs",
"require": "./drivers/*.js"
},
".": {
"import": "./dist/unstorage.mjs",
"require": "./dist/unstorage.js"
Expand All @@ -26,11 +29,11 @@
"server*"
],
"scripts": {
"build": "siroc build && mkdist --src src/drivers --dist drivers -d",
"build": "unbuild",
"dev": "jest --watch",
"demo": "vite demo",
"lint": "eslint --ext .ts .",
"prepublishOnly": "yarn build",
"prepack": "yarn build",
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && jest",
"doctoc": "doctoc README.md --notitle --maxlevel 3",
Expand All @@ -39,6 +42,7 @@
"dependencies": {
"anymatch": "^3.1.1",
"chokidar": "^3.5.1",
"destr": "^1.1.0",
"h3": "^0.2.10",
"ioredis": "^4.27.3",
"listhen": "^0.2.4",
Expand All @@ -57,18 +61,17 @@
"@types/ws": "latest",
"@vitejs/plugin-vue": "latest",
"@vue/compiler-sfc": "latest",
"destr": "latest",
"doctoc": "latest",
"eslint": "latest",
"jest": "latest",
"jiti": "latest",
"jsdom": "latest",
"mkdist": "latest",
"monaco-editor": "latest",
"siroc": "latest",
"standard-version": "latest",
"ts-jest": "latest",
"typescript": "latest",
"unbuild": "latest",
"vite": "latest",
"vue": "^3.0.5"
}
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Driver } from 'unstorage'
import type { Driver } from '../../types'

type DriverFactory<T> = (opts?: T) => Driver

Expand Down
Loading

0 comments on commit 251182b

Please sign in to comment.