Skip to content

feat(pack-cli): support JS config (utoopack.config.mjs/js) and defineConfig#2666

Open
yuzheng14 wants to merge 3 commits intonextfrom
feat/js-config
Open

feat(pack-cli): support JS config (utoopack.config.mjs/js) and defineConfig#2666
yuzheng14 wants to merge 3 commits intonextfrom
feat/js-config

Conversation

@yuzheng14
Copy link
Contributor

Summary

Support JS config files and defineConfig helper.

Changes

  • pack-cli: resolveFromConfigFile for json/mjs/js, async resolveBuildOptions
  • pack: defineConfig() and UserConfig type in pack-shared
  • examples/config-js: example project for JS config

Note

TypeScript config (utoopack.config.ts) is supported only on Node.js v24+ (native TS execution). See packages/pack-cli/src/utils/common.ts for CONFIG_FILE_NAMES and TS extension.

Made with Cursor

…Config

- pack-cli: resolveFromConfigFile with json/mjs/js, async resolveBuildOptions
- pack: defineConfig() and UserConfig type in pack-shared
- examples/config-js: add example project for JS config

Co-authored-by: Cursor <cursoragent@cursor.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 flexibility of the utoopack build system by enabling the use of JavaScript files for configuration. This change allows users to define their build settings with dynamic logic and leverage the full power of JavaScript, moving beyond static JSON configurations. The addition of a defineConfig helper also improves the developer experience by providing type safety and better IDE support for these new configuration formats.

Highlights

  • JS Config Support: Introduced support for JavaScript configuration files (utoopack.config.mjs and utoopack.config.js), allowing for more dynamic and programmatic build configurations.
  • defineConfig Helper: Added a defineConfig helper function to provide type-safe configuration with editor support, similar to other modern build tools.
  • Asynchronous Config Resolution: Refactored the resolveBuildOptions function in pack-cli to be asynchronous, enabling the dynamic import of JS/MJS configuration files.
  • New Example Project: Included a new example project, examples/config-js, to demonstrate the usage of JavaScript-based configuration.
Changelog
  • examples/config-js
    • Created a new example project to demonstrate JS config usage.
  • pack
    • Introduced defineConfig() helper for type-safe configuration.
    • Added UserConfig type in pack-shared.
  • pack-cli
    • Added resolveFromConfigFile to support JSON, MJS, and JS config files.
    • Made resolveBuildOptions asynchronous to handle dynamic config imports.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for JavaScript configuration files (utoopack.config.mjs/js) and a defineConfig helper, which is a valuable enhancement for providing more dynamic and type-safe configurations. The implementation is well-structured, including a new example project and necessary updates to the CLI logic. My review includes one suggestion to improve the file reading logic to be fully asynchronous, aligning with best practices for Node.js applications.

yuzheng14 and others added 2 commits March 6, 2026 17:41
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants