From 5c2b3a93b0142095af5a751b5f5a14df035792b7 Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Mon, 8 Jul 2024 20:56:00 +0800 Subject: [PATCH] feat: add the root path fix. --- biome.json | 52 ++++++++++++++++++++++++------------------------- build.config.ts | 13 ++++--------- package.json | 12 +++--------- src/index.ts | 6 +----- 4 files changed, 34 insertions(+), 49 deletions(-) diff --git a/biome.json b/biome.json index b8277af..349ad31 100644 --- a/biome.json +++ b/biome.json @@ -1,28 +1,28 @@ { - "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", - "formatter": { - "enabled": true, - "formatWithErrors": false, - "indentStyle": "space", - "indentWidth": 2, - "lineEnding": "lf", - "lineWidth": 120, - "attributePosition": "auto" - }, - "organizeImports": { "enabled": true }, - "linter": { "enabled": true, "rules": { "recommended": true } }, - "javascript": { - "formatter": { - "jsxQuoteStyle": "double", - "quoteProperties": "asNeeded", - "trailingCommas": "all", - "semicolons": "always", - "arrowParentheses": "always", - "bracketSpacing": true, - "bracketSameLine": false, - "quoteStyle": "single", - "attributePosition": "auto" - } - }, - "overrides": [{ "include": ["**/*.astro"] }] + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 120, + "attributePosition": "auto" + }, + "organizeImports": { "enabled": true }, + "linter": { "enabled": true, "rules": { "recommended": true } }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "quoteStyle": "single", + "attributePosition": "auto" + } + }, + "overrides": [{ "include": ["**/*.astro"] }] } diff --git a/build.config.ts b/build.config.ts index f235abd..b782c08 100644 --- a/build.config.ts +++ b/build.config.ts @@ -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'], +}); diff --git a/package.json b/package.json index 8ffc8b7..ad5ab32 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/index.ts b/src/index.ts index 4347839..f10cf5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 { - await this.operator.delete(key); - } - async isExist(key: string, size: number): Promise { const exist = await this.operator.isExist(key); if (exist) {