Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for deno.config.ts or Extending Configuration in deno.json #26361

Closed
mikoloism opened this issue Oct 13, 2024 · 1 comment
Closed

Support for deno.config.ts or Extending Configuration in deno.json #26361

mikoloism opened this issue Oct 13, 2024 · 1 comment
Labels
declined thank you, but respectfully declined duplicate a duplicate of another issue

Comments

@mikoloism
Copy link

I propose an enhancement to the Deno configuration system that introduces two options for configuration management:

  1. Support for TypeScript Configuration Files: Allow users to define their Deno configuration in a TypeScript file (deno.config.ts), enabling the use of module imports for shared configurations.

  2. Extending JSON Configuration Files: Enable deno.json to reference and extend configurations from other JSON files, reducing redundancy and improving maintainability.

Motivation:

  1. Avoiding Redundancy: Currently, when configuring properties like fmt, users must rewrite all properties in deno.json. This can lead to duplication and increased maintenance overhead. By allowing configuration files to extend other files, users can manage shared settings more efficiently.

  2. Modular Configuration: Using a TypeScript configuration file allows developers to import shared configurations as modules. This promotes code reuse and makes it easier to manage complex configurations across multiple projects.

  3. Improved Developer Experience: Both options would enhance the developer experience by simplifying configuration management and reducing the likelihood of errors due to duplication.

Proposed Implementation:

TypeScript Configuration:

// deno.config.ts
import fmtConfig from "./configs/deno.fmt.ts";

const config = {
  fmt: fmtConfig,
};

export default config;

Extending JSON Configuration:

// deno.json(c)
{
  "fmt": "./configs/deno.fmt.json"
}

// ./configs/deno.fmt.json
{
  "printWidth": 80
}
@dsherret dsherret transferred this issue from denoland/deno_config Oct 17, 2024
@dsherret
Copy link
Member

dsherret commented Oct 17, 2024

Support for TypeScript Configuration Files: Allow users to define their Deno configuration in a TypeScript file (deno.config.ts), enabling the use of module imports for shared configurations.

This was discussed when initially adding a configuration file to Deno and it was rejected because it will greatly negatively impact startup performance.

Extending JSON Configuration Files: Enable deno.json to reference and extend configurations from other JSON files, reducing redundancy and improving maintainability.

Follow #18132 for extending configs.

(Marked this as duplciate of #18132, but then declined for deno.config.ts since this is two issues in one)

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
@dsherret dsherret added duplicate a duplicate of another issue declined thank you, but respectfully declined labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
declined thank you, but respectfully declined duplicate a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants