Skip to content

Commit

Permalink
fix: --download option should affect getDefine (#1937)
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX authored Nov 10, 2024
1 parent b1f3cd4 commit 688e9cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions packages/slidev/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ cli.command(
const { build } = await import('./commands/build')

for (const entryFile of entry as unknown as string[]) {
const options = await resolveOptions({ entry: entryFile, theme, inspect }, 'build')
if (download && !options.data.config.download)
options.data.config.download = download
const options = await resolveOptions({ entry: entryFile, theme, inspect, download }, 'build')

printInfo(options)
await build(
Expand Down
3 changes: 3 additions & 0 deletions packages/slidev/node/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export async function resolveOptions(
const addonRoots = await resolveAddons(config.addons)
const roots = uniq([...themeRoots, ...addonRoots, rootsInfo.userRoot])

if (entryOptions.download)
config.download ||= entryOptions.download

debug({
...rootsInfo,
...entryOptions,
Expand Down
5 changes: 5 additions & 0 deletions packages/types/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export interface SlidevEntryOptions {
* Enable inspect plugin
*/
inspect?: boolean

/**
* Build with --download option
*/
download?: boolean
}

export interface ResolvedSlidevOptions extends RootsInfo, SlidevEntryOptions {
Expand Down

0 comments on commit 688e9cf

Please sign in to comment.