Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/build/rolldown/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ export async function buildProduction(nitro: Nitro, config: RolldownOptions) {
const rewriteRelativePaths = (input: string) => {
return input.replace(/([\s:])\.\/(\S*)/g, `$1${rOutput}/$2`);
};
nitro.logger.success("You can preview this build using `npx nitro preview`");
const previewCommand = nitro.options.framework.previewCommand || "npx nitro preview";
nitro.logger.success(`You can preview this build using \`${previewCommand}\``);
if (buildInfo.commands!.deploy) {
const deployCommand = nitro.options.framework.deployCommand || "npx nitro deploy --prebuilt";
nitro.logger.success(
rewriteRelativePaths("You can deploy this build using `npx nitro deploy --prebuilt`")
rewriteRelativePaths(`You can deploy this build using \`${deployCommand}\``)
);
}
}
6 changes: 4 additions & 2 deletions src/build/vite/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ export async function buildEnvironments(ctx: NitroPluginContext, builder: ViteBu

// Show deploy and preview commands
if (!isTest && !isCI) console.log();
nitro.logger.success("You can preview this build using `npx vite preview`");
const previewCommand = nitro.options.framework.previewCommand || "npx vite preview";
nitro.logger.success(`You can preview this build using \`${previewCommand}\``);
if (nitro.options.commands.deploy) {
nitro.logger.success("You can deploy this build using `npx nitro deploy --prebuilt`");
const deployCommand = nitro.options.framework.deployCommand || "npx nitro deploy --prebuilt";
nitro.logger.success(`You can deploy this build using \`${deployCommand}\``);
}
}

Expand Down
16 changes: 16 additions & 0 deletions src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ export type NitroTypes = {
export interface NitroFrameworkInfo {
name?: "nitro" | (string & {});
version?: string;
/**
* Command shown in build output as the suggested preview command.
*
* Display-only: Nitro never executes this. Use this when the framework
* wraps `nitro preview` with its own CLI (e.g. `npx nuxt preview`).
* Defaults to `npx nitro preview`.
*/
previewCommand?: string;
/**
* Command shown in build output as the suggested deploy command.
*
* Display-only: Nitro never executes this. Use this when the framework
* wraps `nitro deploy` with its own CLI (e.g. `npx nuxt deploy`).
* Defaults to `npx nitro deploy --prebuilt`.
*/
deployCommand?: string;
}

/**
Expand Down
Loading