Skip to content

Commit

Permalink
feat: show meta framework name on server build success (#1955)
Browse files Browse the repository at this point in the history
Co-authored-by: Pooya Parsa <pooya@pi0.io>
  • Loading branch information
ayoayco and pi0 authored Nov 30, 2023
1 parent cbb44d5 commit 745630a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
parseNodeModulePath,
resolvePath,
} from "mlly";
import { upperFirst } from "scule";
import { version as nitroVersion } from "../package.json";
import { generateFSTree } from "./utils/tree";
import { getRollupConfig, RollupConfig } from "./rollup/config";
Expand Down Expand Up @@ -482,10 +483,19 @@ function startRollupWatcher(nitro: Nitro, rollupConfig: RollupConfig) {
// Finished building all bundles
case "END": {
nitro.hooks.callHook("compiled", nitro);
nitro.logger.success(
"Nitro built",
start ? `in ${Date.now() - start} ms` : ""
);

if (nitro.options.logging.devBuildSuccess) {
let message = `Nitro Server`;
if (nitro.options.framework.name !== "nitro") {
const _name = upperFirst(nitro.options.framework.name);
message = `${_name} ${message}`;
}
nitro.logger.success(
`${message} built`,
start ? `in ${Date.now() - start} ms` : ""
);
}

nitro.hooks.callHook("dev:reload");
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const NitroDefaults: NitroConfig = {
// Logging
logging: {
compressedSizes: true,
devBuildSuccess: true,
},

// Routing
Expand Down
1 change: 1 addition & 0 deletions src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export interface NitroOptions extends PresetOptions {
// Logging
logging: {
compressedSizes: boolean;
devBuildSuccess: boolean;
};

// Routing
Expand Down

0 comments on commit 745630a

Please sign in to comment.