From 60853352422bb9902c557415ef4100972230e882 Mon Sep 17 00:00:00 2001 From: Innei Date: Fri, 14 Nov 2025 00:31:32 +0800 Subject: [PATCH] chore(builder): update package version and adjust module exports - Bumped package version from 0.1.3 to 0.2.2 for the builder. - Changed main entry point and module exports from `.js` to `.mjs` and updated type definitions to `.d.mts` for better compatibility with ES modules. - Modified GitHub repository synchronization plugin options to allow an optional `enable` flag, enhancing configuration flexibility. Signed-off-by: Innei --- packages/builder/package.json | 12 ++++++------ packages/builder/src/plugins/github-repo-sync.ts | 13 +++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/builder/package.json b/packages/builder/package.json index f53d77f7..51585f81 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,7 +1,7 @@ { "name": "@afilmory/builder", "type": "module", - "version": "0.1.3", + "version": "0.2.2", "exports": { ".": "./src/index.ts", "./*": "./src/*" @@ -30,15 +30,15 @@ }, "publishConfig": { "access": "public", - "main": "./dist/index.js", + "main": "./dist/index.mjs", "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js" + "types": "./dist/index.d.mts", + "import": "./dist/index.mjs" }, "./*": { - "types": "./dist/*.d.ts", - "import": "./dist/*.js" + "types": "./dist/*.d.mts", + "import": "./dist/*.mjs" } } } diff --git a/packages/builder/src/plugins/github-repo-sync.ts b/packages/builder/src/plugins/github-repo-sync.ts index 6fa79793..7e9131b7 100644 --- a/packages/builder/src/plugins/github-repo-sync.ts +++ b/packages/builder/src/plugins/github-repo-sync.ts @@ -10,8 +10,8 @@ import type { BuilderPlugin } from './types.js' const RUN_SHARED_ASSETS_DIR = 'assetsGitDir' export interface GitHubRepoSyncPluginOptions { + enable?: boolean repo: { - enable: boolean url: string token?: string branch?: string @@ -20,6 +20,7 @@ export interface GitHubRepoSyncPluginOptions { } export default function githubRepoSyncPlugin(options: GitHubRepoSyncPluginOptions): BuilderPlugin { + const enable = options.enable ?? true const autoPush = options.autoPush ?? true const repoConfig = options.repo @@ -33,7 +34,7 @@ export default function githubRepoSyncPlugin(options: GitHubRepoSyncPluginOption name: 'afilmory:github-repo-sync', hooks: { beforeBuild: async (context) => { - if (!repoConfig.enable) { + if (!enable) { return } @@ -77,7 +78,7 @@ export default function githubRepoSyncPlugin(options: GitHubRepoSyncPluginOption logger.main.success('✅ 远程仓库同步完成') }, afterBuild: async (context) => { - if (!autoPush || !repoConfig.enable) { + if (!autoPush || !enable) { return } @@ -148,11 +149,7 @@ async function prepareRepositoryLayout({ assetsGitDir, logger }: PrepareReposito interface PushRemoteOptions { assetsGitDir: string logger: typeof import('../logger/index.js').logger - repoConfig: { - enable: boolean - url: string - token?: string - } + repoConfig: GitHubRepoSyncPluginOptions['repo'] branchName: string }