Open
Conversation
… a route to it from json anyways
p2r3
requested changes
Mar 22, 2026
|
|
||
| async init() { | ||
| this.supportedFormats = [ | ||
| CommonFormats.JSON.builder("json").markLossless().allowFrom(true).allowTo(true), |
Owner
There was a problem hiding this comment.
I don't think lossless applies here - JSON has some type information that plaintext configs don't.
Comment on lines
+110
to
+114
| if (outputFiles.length === 0) { | ||
| throw new Error( | ||
| `configHandler does not support route: ${inputFormat.internal} -> ${outputFormat.internal}`, | ||
| ); | ||
| } |
Owner
There was a problem hiding this comment.
Wouldn't it make sense to support config->config by simply renaming the file? I get that this handler assumes all text-based configs are ini anyways.
| import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; | ||
| import CommonFormats from "src/CommonFormats.ts"; | ||
| import * as ini from 'ini'; | ||
| import * as yaml from 'yaml'; |
| import * as yaml from 'yaml'; | ||
|
|
||
| class configHandler implements FormatHandler { | ||
| public name: string = "cfg"; |
Owner
There was a problem hiding this comment.
Handler name should be the same as the file and class name. In this case, config, not cfg.
| const encoder = new TextEncoder(); | ||
|
|
||
| const cfgRegex = new RegExp(`\\.(${this.cfgExt.join('|')})$`, 'i'); | ||
| const yamlRegex = new RegExp(`\\.(${this.yamlExt.join('|')})$`, 'i'); |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add support for all the main configuration file formats