mirror of
https://github.com/Afilmory/afilmory
synced 2026-02-01 22:48:17 +00:00
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 <tukon479@gmail.com>
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user