Add shared port registry workflow and improve scaffold tooling
This commit is contained in:
@@ -205,6 +205,16 @@ function parseJsonc(input, label) {
|
||||
}
|
||||
|
||||
function parseJsoncAst(input, label) {
|
||||
if (!input.trim()) {
|
||||
return {
|
||||
type: "object",
|
||||
start: 0,
|
||||
end: 0,
|
||||
properties: [],
|
||||
value: {},
|
||||
};
|
||||
}
|
||||
|
||||
let index = 0;
|
||||
|
||||
function fail(message) {
|
||||
@@ -780,9 +790,10 @@ function main() {
|
||||
const allManagedServerNames = new Set(Object.keys(managedConfig[options.serverKey]));
|
||||
const desiredServerNames = new Set(Object.keys(managedServers));
|
||||
|
||||
const targetText = fs.existsSync(options.target)
|
||||
const existingTargetText = fs.existsSync(options.target)
|
||||
? fs.readFileSync(options.target, "utf8")
|
||||
: "{}\n";
|
||||
: "";
|
||||
const targetText = existingTargetText.trim() ? existingTargetText : "{}\n";
|
||||
const targetAst = parseJsoncAst(targetText, options.target);
|
||||
const cleanedTargetText = removeStaleManagedServers(
|
||||
targetText,
|
||||
|
||||
Reference in New Issue
Block a user