feat: add the root path fix.

This commit is contained in:
Yufan Sheng 2024-07-08 20:56:00 +08:00
parent 3ac1810435
commit 5c2b3a93b0
Signed by: syhily
GPG Key ID: DEB186763C308C31
4 changed files with 34 additions and 49 deletions

View File

@ -1,16 +1,11 @@
import { defineBuildConfig } from 'unbuild'
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
entries: [
'src/index',
],
entries: ['src/index'],
clean: true,
declaration: true,
rollup: {
emitCJS: true,
},
externals: [
'astro',
'astro/zod'
],
})
externals: ['astro', 'astro/zod'],
});

View File

@ -2,11 +2,7 @@
"name": "astro-uploader",
"version": "1.0.1",
"description": "A uploader for uploading the Astro generated files through the S3 API.",
"keywords": [
"Astro",
"S3",
"withastro"
],
"keywords": ["Astro", "S3", "withastro"],
"bugs": {
"url": "https://github.com/syhily/astro-uploader/issues"
},
@ -27,12 +23,10 @@
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build": "unbuild",
"format": "biome format src --write",
"format": "biome format . --write",
"stub": "unbuild --stub"
},
"dependencies": {

View File

@ -38,7 +38,7 @@ const S3Options = z
region: z.string().min(1).default('auto'),
endpoint: z.string().url().optional(),
bucket: z.string().min(1),
root: z.string().default('/'),
root: z.string().default(''),
accessKey: z.string().min(1),
secretAccessKey: z.string().min(1),
extraOptions: z.record(z.string(), z.string()).default({}),
@ -95,10 +95,6 @@ class Uploader {
this.override = override;
}
private async delete(key: string): Promise<void> {
await this.operator.delete(key);
}
async isExist(key: string, size: number): Promise<boolean> {
const exist = await this.operator.isExist(key);
if (exist) {