Expose Configuration API and Refactor CLI Script #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive, user-configurable system for code formatting and sorting in the project. It adds support for a TypeScript-based configuration file (
core.config.ts), enables deep customization of Prettier, package.json, tsconfig.json, and code sorting behaviors, and refactors the CLI and config loading logic to support these features. The changes establish a robust foundation for flexible formatting and sorting workflows.Key changes:
Configuration System
core.config.example.ts) allowing users to customize formatting and sorting behaviors (Prettier, package.json, tsconfig.json, class members, React components, and file declarations) via a TypeScript config file.src/config/types.ts, supporting deep merging of user and default configs.Configuration Loading and Utilities
core.config.ts(TypeScript) file at runtime, falling back to defaults if not present or invalid, insrc/config/loader.ts.src/config/index.tsto expose types, config loading, and utility functions.CLI Refactor
src/cli.ts) to support the new configuration system, including command-line argument parsing, dry-run support, and stepwise invocation of formatting and sorting based on the config. It also adds logic to detect existing Prettier configs and skip formatting if configured to do so.Build and Format Scripts
package.jsonscripts to separate building and formatting steps, and added a combined script for both.Type Exports
SortClassMembersConfigtype fromsrc/sortClassMembersfor external use.