feat(cli): support custom config path via -c/--config option#3
feat(cli): support custom config path via -c/--config option#3bshy522 wants to merge 1 commit intoevaijs:mainfrom
Conversation
|
Someone is attempting to deploy a commit to the utooland Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the CLI's flexibility by introducing a mechanism to specify custom configuration file paths for Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a valuable feature for specifying a custom configuration path. The implementation is solid, with good test coverage and documentation updates. I have one suggestion to improve the accuracy of the configuration path logging, which involves a minor refactoring to pass the resolved path from loadConfig back to the caller. This will make the CLI output more precise and the related code cleaner.
| async function resolveWebpackConfig(cwd: string, configPath?: string) { | ||
| const { loadConfig } = await import("./load-config.js"); | ||
| const evjsConfig = await loadConfig(cwd); | ||
| const evjsConfig = await loadConfig(cwd, configPath); | ||
|
|
||
| const { createWebpackConfig } = await import("./create-webpack-config.js"); | ||
| logger.info`Using ${evjsConfig ? "ev.config.ts" : "zero-config defaults"}`; | ||
| if (configPath) { | ||
| logger.info`Using config: ${path.relative(cwd, path.resolve(cwd, configPath))}`; | ||
| } else { | ||
| logger.info`Using ${evjsConfig ? "ev.config.ts" : "zero-config defaults"}`; | ||
| } | ||
| const webpackConfig = createWebpackConfig(evjsConfig, cwd); | ||
|
|
||
| return { evjsConfig, webpackConfig }; |
There was a problem hiding this comment.
The logging for the configuration file path can be made more accurate. When no --config option is passed and a default configuration file like ev.config.js is used, the log message incorrectly states "Using ev.config.ts".
To fix this, loadConfig could return the resolved path along with the configuration object. resolveWebpackConfig can then use this path for a consistently accurate log message.
For example, you could change loadConfig in packages/cli/src/load-config.ts to return Promise<{ config: EvConfig; path: string } | undefined>.
With that change, resolveWebpackConfig can be simplified as follows:
async function resolveWebpackConfig(cwd: string, configPath?: string) {
const { loadConfig } = await import("./load-config.js");
const configResult = await loadConfig(cwd, configPath);
const evjsConfig = configResult?.config;
const { createWebpackConfig } = await import("./create-webpack-config.js");
if (configResult) {
logger.info`Using config: ${path.relative(cwd, configResult.path)}`;
} else {
logger.info`Using zero-config defaults`;
}
const webpackConfig = createWebpackConfig(evjsConfig, cwd);
return { evjsConfig, webpackConfig };
}756d54c to
0256c67
Compare
0256c67 to
63bf0f5
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| const TS_CONFIG_EXTENSIONS = new Set([".ts", ".mts", ".cts"]); | ||
|
|
||
| type LoadConfigDependencies = { | ||
| ensureTsLoader?: () => Promise<void>; |
|
我感觉不太可能存在 config 写在项目之外的场景,我们并不是 tsc 这类工具 |
也不是写在项目外,就是不是默认的名字。可以理解为写了两个配置文件这种场景 |
|
现阶段不会考虑多配置支持,主要是没想到什么场景会需要。目前的计划参考 Roadmap https://github.com/evaijs/evjs/blob/main/ROADMAP.md |
- Root AGENT.md: release workflow uses GitHub releases, add mutation args convention - Runtime AGENT.md: add mutation args rule (#3) to common mistakes - query.ts: void → undefined per biome lint
This PR adds support for a custom configuration file path using the
-cor--configoption in bothev devandev buildcommands.Key changes:
-c, --config <path>option to CLI.loadConfigto handle explicit paths and provide better testability.Closes #FIXME