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({ export default defineBuildConfig({
entries: [ entries: ['src/index'],
'src/index',
],
clean: true, clean: true,
declaration: true, declaration: true,
rollup: { rollup: {
emitCJS: true, emitCJS: true,
}, },
externals: [ externals: ['astro', 'astro/zod'],
'astro', });
'astro/zod'
],
})

View File

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

View File

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