diff --git a/packages/cli/src/lib/make/utils/write-package-json.ts b/packages/cli/src/lib/make/utils/write-package-json.ts index c8b10868..d8e4acc1 100644 --- a/packages/cli/src/lib/make/utils/write-package-json.ts +++ b/packages/cli/src/lib/make/utils/write-package-json.ts @@ -98,7 +98,7 @@ export function writePackageJson(response: prompts.Answers): void { }, "devDependencies": { "@bedframe/cli": "0.0.90", - "@bedframe/core": "0.0.44", + "@bedframe/core": "0.0.45", ${ changesets ? `"@changesets/cli": "^2.27.1", diff --git a/packages/core/src/lib/get-manifest.ts b/packages/core/src/lib/get-manifest.ts index 7c6e3297..7c16f593 100644 --- a/packages/core/src/lib/get-manifest.ts +++ b/packages/core/src/lib/get-manifest.ts @@ -8,8 +8,12 @@ import { lightYellow, } from 'kolorist' import type { PluginOption } from 'vite' -import { Browser, type BuildConfig, type BuildTarget } from './types' -import { AnyCase } from './utils' +import { + Browser, + type BuildConfig, + type BuildTarget, + type BuildOptions, +} from './types' /** * Given the {@link Mode} i.e. {@link Browser} target, @@ -25,10 +29,8 @@ import { AnyCase } from './utils' export function getManifest( { command, mode }: BuildConfig, targets: BuildTarget[], - options?: CrxOptions, - // PluginOption[] - // biome-ignore lint: @typescript-eslint/no-explicit-any -): any { + options?: BuildOptions, +): ReturnType { const _mode = `${(mode as string).charAt(0).toUpperCase()}${( mode as string ).slice(1)}` @@ -76,13 +78,3 @@ export function getManifest( ...options, }) } - -interface CrxOptions { - contentScripts?: { - preambleCode?: string | false - hmrTimeout?: number - injectCss?: boolean - } - fastGlobOptions?: any // fast-glob Options - browser?: any // 'firefox' | 'chrome' -} diff --git a/packages/core/src/lib/types.ts b/packages/core/src/lib/types.ts index 2af4d294..6c7cdd3d 100644 --- a/packages/core/src/lib/types.ts +++ b/packages/core/src/lib/types.ts @@ -1,4 +1,4 @@ -import type { ManifestV3Export } from '@crxjs/vite-plugin' +import type { crx, ManifestV3Export } from '@crxjs/vite-plugin' import { type AnyCase, createEnum } from './utils' export const FrameworkEnum = { @@ -74,6 +74,26 @@ export type BuildConfig = { command?: 'build' | 'serve' mode?: AnyCase | string | undefined } +/** + * Extract the first parameter of the `crx` function + * and Override the `browser` key to allow `any` + * + * interface CrxOptions { + * contentScripts?: { + * preambleCode?: string | false + * hmrTimeout?: number + * injectCss?: boolean + * } + * fastGlobOptions?: any // fast-glob Options + * browser?: any // 'firefox' | 'chrome' + * } + */ +export type BuildOptions = Omit< + Omit[0], 'manifest'>, + 'browser' +> & { + browser?: any // 'firefox' | 'chrome' // AnyCase +} export interface Repository { type: string