-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style(src): 🎨 simpler & improve conditions & functions
- Loading branch information
1 parent
739184c
commit 77fe22d
Showing
12 changed files
with
56 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
import { loadEnv } from "vite"; | ||
import type { ViteDevServer } from "vite"; | ||
|
||
import { appConfig } from "@config/constant"; | ||
import { highlighter } from "@utils/decorate"; | ||
import { getFrameworkVersion, getPluginVersion } from "@utils/version"; | ||
|
||
export const _handleLogger = (server: ViteDevServer): void => { | ||
const { placeholder } = appConfig; | ||
const { mode, envDir, logger } = server.config; | ||
const appUrl = { | ||
name: "App Url", | ||
version: loadEnv(mode, envDir || process.cwd(), "")[placeholder] ?? "undefined" | ||
}; | ||
|
||
setTimeout(() => { | ||
server.config.logger.info(""); | ||
logger.info(""); | ||
|
||
Promise.all([getFrameworkVersion(), getPluginVersion()]) | ||
.then((values) => { | ||
if (server.resolvedUrls) { | ||
for (const value of values) { | ||
server.config.logger.info(highlighter(value)); | ||
logger.info( | ||
highlighter({ | ||
name: value.name, | ||
version: `v${value.version.replace("v", "")}` | ||
}) | ||
); | ||
} | ||
} | ||
}) | ||
.catch((error) => { | ||
server.config.logger.error(error); | ||
logger.error(error); | ||
server.close(); | ||
}); | ||
}) | ||
.finally(() => logger.info("\n" + highlighter(appUrl))); | ||
}, 100); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
/* eslint-disable indent */ | ||
import type { AliasOptions, UserConfig } from "vite"; | ||
import { appConfig } from "@config/constant"; | ||
|
||
export const _resolveAliases = (config: UserConfig): AliasOptions => { | ||
if (Array.isArray(config.resolve?.alias)) { | ||
return [ | ||
...(config.resolve?.alias ?? []), | ||
...Object.keys(appConfig.alias).map((alias) => ({ | ||
find: alias, | ||
replacement: appConfig.alias[alias] | ||
})) | ||
]; | ||
} | ||
return { | ||
...appConfig.alias, | ||
...config.resolve?.alias | ||
}; | ||
}; | ||
export const _resolveAliases = (config: UserConfig): AliasOptions => | ||
Array.isArray(config.resolve?.alias) | ||
? [ | ||
...(config.resolve?.alias ?? []), | ||
...Object.keys(appConfig.alias).map((alias) => ({ | ||
find: alias, | ||
replacement: appConfig.alias[alias] | ||
})) | ||
] | ||
: { ...appConfig.alias, ...config.resolve?.alias }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": ["./tsconfig.json"], | ||
"compilerOptions": { "rootDir": "./src/" }, | ||
"exclude": ["tests"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters