mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-26 00:33:12 +09:00
Merge pull request #520 from Hornwitser/vs-code-config
Add VSCode workspace config
This commit is contained in:
23 files changed
+59
-45
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
|
!settings.json
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"editor.detectIndentation": false,
|
||||||
|
"editor.insertSpaces": false,
|
||||||
|
"files.eol": "\n",
|
||||||
|
"files.insertFinalNewline": true,
|
||||||
|
"files.trimFinalNewlines": true,
|
||||||
|
"[markdown]": {
|
||||||
|
"editor.indentSize": 4,
|
||||||
|
"editor.insertSpaces": true,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -164,7 +164,7 @@ async function handleBootstrapCommand(
|
|||||||
userManager.signUserToken(admin.name),
|
userManager.signUserToken(admin.name),
|
||||||
);
|
);
|
||||||
|
|
||||||
let content = JSON.stringify(controlConfig.serialize(), null, 4);
|
let content = JSON.stringify(controlConfig.serialize(), null, "\t");
|
||||||
if (args.output === "-") {
|
if (args.output === "-") {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(content);
|
console.log(content);
|
||||||
@@ -343,7 +343,7 @@ async function initialize(): Promise<InitializeParameters> {
|
|||||||
let bytes = await asyncRandomBytes(256);
|
let bytes = await asyncRandomBytes(256);
|
||||||
controllerConfig.set("controller.auth_secret", bytes.toString("base64"));
|
controllerConfig.set("controller.auth_secret", bytes.toString("base64"));
|
||||||
await lib.safeOutputFile(
|
await lib.safeOutputFile(
|
||||||
controllerConfigPath, JSON.stringify(controllerConfig.serialize(), null, 4)
|
controllerConfigPath, JSON.stringify(controllerConfig.serialize(), null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ export default class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Saving config");
|
logger.info("Saving config");
|
||||||
await lib.safeOutputFile(this.configPath, JSON.stringify(this.config.serialize(), null, 4));
|
await lib.safeOutputFile(this.configPath, JSON.stringify(this.config.serialize(), null, "\t"));
|
||||||
|
|
||||||
if (this.devMiddleware) {
|
if (this.devMiddleware) {
|
||||||
await new Promise((resolve, reject) => { this.devMiddleware.close(resolve); });
|
await new Promise((resolve, reject) => { this.devMiddleware.close(resolve); });
|
||||||
@@ -384,7 +384,7 @@ export default class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async saveHosts(filePath: string, hosts: Map<number, HostInfo>) {
|
static async saveHosts(filePath: string, hosts: Map<number, HostInfo>) {
|
||||||
await lib.safeOutputFile(filePath, JSON.stringify([...hosts.entries()], null, 4));
|
await lib.safeOutputFile(filePath, JSON.stringify([...hosts.entries()], null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static async loadInstances(filePath: string): Promise<Map<number, InstanceInfo>> {
|
static async loadInstances(filePath: string): Promise<Map<number, InstanceInfo>> {
|
||||||
@@ -420,7 +420,7 @@ export default class Controller {
|
|||||||
serialized.push(instance.config.serialize());
|
serialized.push(instance.config.serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
await lib.safeOutputFile(filePath, JSON.stringify(serialized, null, 4));
|
await lib.safeOutputFile(filePath, JSON.stringify(serialized, null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static async loadModPacks(filePath: string): Promise<Map<number, lib.ModPack>> {
|
static async loadModPacks(filePath: string): Promise<Map<number, lib.ModPack>> {
|
||||||
@@ -437,7 +437,7 @@ export default class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async saveModPacks(filePath: string, modPacks: Map<number, lib.ModPack>) {
|
static async saveModPacks(filePath: string, modPacks: Map<number, lib.ModPack>) {
|
||||||
await lib.safeOutputFile(filePath, JSON.stringify([...modPacks.values()], null, 4));
|
await lib.safeOutputFile(filePath, JSON.stringify([...modPacks.values()], null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static async loadModInfos(modsDirectory: string): Promise<Map<string, lib.ModInfo>> {
|
static async loadModInfos(modsDirectory: string): Promise<Map<string, lib.ModInfo>> {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default class UserManager {
|
|||||||
users: serializedUsers,
|
users: serializedUsers,
|
||||||
roles: serializedRoles,
|
roles: serializedRoles,
|
||||||
};
|
};
|
||||||
await lib.safeOutputFile(filePath, JSON.stringify(serialized, null, 4));
|
await lib.safeOutputFile(filePath, JSON.stringify(serialized, null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ async function migrateRename(args) {
|
|||||||
async function migrateConfig(source, destination) {
|
async function migrateConfig(source, destination) {
|
||||||
if (await fs.pathExists(source) && !await fs.pathExists(destination)) {
|
if (await fs.pathExists(source) && !await fs.pathExists(destination)) {
|
||||||
await safeOutputFile(destination, JSON.stringify(
|
await safeOutputFile(destination, JSON.stringify(
|
||||||
renameConfig(JSON.parse(await fs.readFile(source))), null, 4
|
renameConfig(JSON.parse(await fs.readFile(source))), null, "\t"
|
||||||
));
|
));
|
||||||
logger.info(`Migrated ${source} to ${destination}`);
|
logger.info(`Migrated ${source} to ${destination}`);
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,7 @@ async function migrateRename(args) {
|
|||||||
let instancesFile = path.join("database", "instances.json");
|
let instancesFile = path.join("database", "instances.json");
|
||||||
if (await fs.pathExists(instancesFile)) {
|
if (await fs.pathExists(instancesFile)) {
|
||||||
await safeOutputFile(instancesFile, JSON.stringify(
|
await safeOutputFile(instancesFile, JSON.stringify(
|
||||||
JSON.parse(await fs.readFile(instancesFile)).map(renameConfig), null, 4
|
JSON.parse(await fs.readFile(instancesFile)).map(renameConfig), null, "\t"
|
||||||
));
|
));
|
||||||
logger.info(`Migrated ${instancesFile}`);
|
logger.info(`Migrated ${instancesFile}`);
|
||||||
}
|
}
|
||||||
@@ -222,7 +222,7 @@ async function migrateRename(args) {
|
|||||||
for (let role of users["roles"]) {
|
for (let role of users["roles"]) {
|
||||||
role["permissions"] = role["permissions"].map(rename);
|
role["permissions"] = role["permissions"].map(rename);
|
||||||
}
|
}
|
||||||
await safeOutputFile(usersFile, JSON.stringify(users, null, 4));
|
await safeOutputFile(usersFile, JSON.stringify(users, null, "\t"));
|
||||||
logger.info(`Migrated ${usersFile}`);
|
logger.info(`Migrated ${usersFile}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ async function installClusterio(mode, plugins) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await safeOutputFile("plugin-list.json", JSON.stringify([...pluginList], null, 4));
|
await safeOutputFile("plugin-list.json", JSON.stringify([...pluginList], null, "\t"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new InstallError(`Error writing plugin-list.json: ${err.message}`);
|
throw new InstallError(`Error writing plugin-list.json: ${err.message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -324,7 +324,7 @@ I version of clusterio. Expect things to break. I
|
|||||||
);
|
);
|
||||||
startControl().catch(err => {
|
startControl().catch(err => {
|
||||||
if (err.errors) {
|
if (err.errors) {
|
||||||
logger.fatal(JSON.stringify(err.errors, null, 4));
|
logger.fatal(JSON.stringify(err.errors, null, "\t"));
|
||||||
}
|
}
|
||||||
if (!(err instanceof lib.StartupError)) {
|
if (!(err instanceof lib.StartupError)) {
|
||||||
logger.fatal(`
|
logger.fatal(`
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ hostCommands.add(new lib.Command({
|
|||||||
new lib.HostConfigCreateRequest(args.id, args.name, args.generateToken)
|
new lib.HostConfigCreateRequest(args.id, args.name, args.generateToken)
|
||||||
);
|
);
|
||||||
|
|
||||||
let content = JSON.stringify(rawConfig.serializedConfig, null, 4);
|
let content = JSON.stringify(rawConfig.serializedConfig, null, "\t");
|
||||||
if (args.output === "-") {
|
if (args.output === "-") {
|
||||||
print(content);
|
print(content);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ class HostRouter {
|
|||||||
}
|
}
|
||||||
logger.warn(`Failed to deliver ${(message as any).name || "message"} (${message.type}): ${err.message}`);
|
logger.warn(`Failed to deliver ${(message as any).name || "message"} (${message.type}): ${err.message}`);
|
||||||
if (err instanceof lib.InvalidMessage && err.errors) {
|
if (err instanceof lib.InvalidMessage && err.errors) {
|
||||||
logger.warn(JSON.stringify(err.errors, null, 4));
|
logger.warn(JSON.stringify(err.errors, null, "\t"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -484,7 +484,7 @@ export default class Host extends lib.Link {
|
|||||||
};
|
};
|
||||||
await lib.safeOutputFile(
|
await lib.safeOutputFile(
|
||||||
path.join(instanceInfo.path, "instance.json"),
|
path.join(instanceInfo.path, "instance.json"),
|
||||||
JSON.stringify(warnedOutput, null, 4)
|
JSON.stringify(warnedOutput, null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
|||||||
let content = JSON.stringify({
|
let content = JSON.stringify({
|
||||||
players: [...this.playerStats],
|
players: [...this.playerStats],
|
||||||
player_autosave_slot: this._playerAutosaveSlot,
|
player_autosave_slot: this._playerAutosaveSlot,
|
||||||
}, null, 4);
|
}, null, "\t");
|
||||||
await lib.safeOutputFile(this.path("instance-stats.json"), content);
|
await lib.safeOutputFile(this.path("instance-stats.json"), content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
|||||||
};
|
};
|
||||||
await lib.safeOutputFile(
|
await lib.safeOutputFile(
|
||||||
this.server.writePath("server-settings.json"),
|
this.server.writePath("server-settings.json"),
|
||||||
JSON.stringify(serverSettings, null, 4)
|
JSON.stringify(serverSettings, null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
|||||||
// Write mod-list.json
|
// Write mod-list.json
|
||||||
await fs.outputFile(this.path("mods", "mod-list.json"), JSON.stringify({
|
await fs.outputFile(this.path("mods", "mod-list.json"), JSON.stringify({
|
||||||
mods: [...this.activeModPack.mods.values()],
|
mods: [...this.activeModPack.mods.values()],
|
||||||
}, null, 2));
|
}, null, "\t"));
|
||||||
|
|
||||||
// Write mod-settings.dat
|
// Write mod-settings.dat
|
||||||
await fs.outputFile(this.path("mods", "mod-settings.dat"), this.activeModPack.toModSettingsDat());
|
await fs.outputFile(this.path("mods", "mod-settings.dat"), this.activeModPack.toModSettingsDat());
|
||||||
@@ -706,7 +706,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
|||||||
this.logger.verbose("Writing server-adminlist.json");
|
this.logger.verbose("Writing server-adminlist.json");
|
||||||
lib.safeOutputFile(
|
lib.safeOutputFile(
|
||||||
this.server.writePath("server-adminlist.json"),
|
this.server.writePath("server-adminlist.json"),
|
||||||
JSON.stringify([...this._host.adminlist], null, 4)
|
JSON.stringify([...this._host.adminlist], null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +716,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
|||||||
this.server.writePath("server-banlist.json"),
|
this.server.writePath("server-banlist.json"),
|
||||||
JSON.stringify([...this._host.banlist].map(
|
JSON.stringify([...this._host.banlist].map(
|
||||||
([username, reason]) => ({ username, reason })
|
([username, reason]) => ({ username, reason })
|
||||||
), null, 4),
|
), null, "\t"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,7 +724,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
|||||||
this.logger.verbose("Writing server-whitelist.json");
|
this.logger.verbose("Writing server-whitelist.json");
|
||||||
lib.safeOutputFile(
|
lib.safeOutputFile(
|
||||||
this.server.writePath("server-whitelist.json"),
|
this.server.writePath("server-whitelist.json"),
|
||||||
JSON.stringify([...this._host.whitelist], null, 4)
|
JSON.stringify([...this._host.whitelist], null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export class SaveModule {
|
|||||||
if (!lib.ModuleInfo.validate(moduleJson)) {
|
if (!lib.ModuleInfo.validate(moduleJson)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`module/module.json in plugin ${plugin.info.name} failed validation:\n` +
|
`module/module.json in plugin ${plugin.info.name} failed validation:\n` +
|
||||||
`${JSON.stringify(lib.ModuleInfo.validate.errors, null, 4)}`
|
`${JSON.stringify(lib.ModuleInfo.validate.errors, null, "\t")}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ export class SaveModule {
|
|||||||
if (!lib.ModuleInfo.validate(moduleJson)) {
|
if (!lib.ModuleInfo.validate(moduleJson)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${name}/module.json failed validation:\n` +
|
`${name}/module.json failed validation:\n` +
|
||||||
`${JSON.stringify(lib.ModuleInfo.validate.errors, null, 4)}`
|
`${JSON.stringify(lib.ModuleInfo.validate.errors, null, "\t")}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1194,12 +1194,12 @@ export class FactorioServer extends events.EventEmitter {
|
|||||||
async _writeMapSettings(mapGenSettings?: object, mapSettings?: object) {
|
async _writeMapSettings(mapGenSettings?: object, mapSettings?: object) {
|
||||||
if (mapGenSettings) {
|
if (mapGenSettings) {
|
||||||
await lib.safeOutputFile(
|
await lib.safeOutputFile(
|
||||||
this.writePath("map-gen-settings.json"), JSON.stringify(mapGenSettings, null, 4)
|
this.writePath("map-gen-settings.json"), JSON.stringify(mapGenSettings, null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (mapSettings) {
|
if (mapSettings) {
|
||||||
await lib.safeOutputFile(
|
await lib.safeOutputFile(
|
||||||
this.writePath("map-settings.json"), JSON.stringify(mapSettings, null, 4)
|
this.writePath("map-settings.json"), JSON.stringify(mapSettings, null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ async function buildMod(args, info) {
|
|||||||
}
|
}
|
||||||
delete info.additional_files;
|
delete info.additional_files;
|
||||||
|
|
||||||
zip.file(path.posix.join(modName, "info.json"), JSON.stringify(info, null, 4));
|
zip.file(path.posix.join(modName, "info.json"), JSON.stringify(info, null, "\t"));
|
||||||
|
|
||||||
let modPath = path.join(args.outputDir, `${modName}.zip`);
|
let modPath = path.join(args.outputDir, `${modName}.zip`);
|
||||||
console.log(`Writing ${modPath}`);
|
console.log(`Writing ${modPath}`);
|
||||||
@@ -62,7 +62,7 @@ async function buildMod(args, info) {
|
|||||||
}
|
}
|
||||||
delete info.additional_files;
|
delete info.additional_files;
|
||||||
|
|
||||||
await fs.writeFile(path.join(modDir, "info.json"), JSON.stringify(info, null, 4));
|
await fs.writeFile(path.join(modDir, "info.json"), JSON.stringify(info, null, "\t"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export async function loadJsonAsMap(filePath: string): Promise<Map<string, unkno
|
|||||||
*/
|
*/
|
||||||
export async function saveMapAsJson(filePath: string, map: Map<string, unknown>) {
|
export async function saveMapAsJson(filePath: string, map: Map<string, unknown>) {
|
||||||
let obj = mapToObject(map);
|
let obj = mapToObject(map);
|
||||||
await libFileOps.safeOutputFile(filePath, JSON.stringify(obj, null, 4));
|
await libFileOps.safeOutputFile(filePath, JSON.stringify(obj, null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +138,7 @@ export async function loadJsonArrayAsMap(filePath: string): Promise<Map<unknown,
|
|||||||
* @throws {Error} if an error occured writing to the file.
|
* @throws {Error} if an error occured writing to the file.
|
||||||
*/
|
*/
|
||||||
export async function saveMapAsJsonArray(filePath: string, map: Map<unknown, { id: unknown }>) {
|
export async function saveMapAsJsonArray(filePath: string, map: Map<unknown, { id: unknown }>) {
|
||||||
await libFileOps.safeOutputFile(filePath, JSON.stringify([...map.values()], null, 4));
|
await libFileOps.safeOutputFile(filePath, JSON.stringify([...map.values()], null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ export abstract class WebSocketBaseConnector extends BaseConnector {
|
|||||||
}
|
}
|
||||||
if (!libData.Message.validate(json)) {
|
if (!libData.Message.validate(json)) {
|
||||||
logger.error(`Received malformed message: ${text}`);
|
logger.error(`Received malformed message: ${text}`);
|
||||||
// logger.error(JSON.stringify(libData.Message.validate.errors, null, 4));
|
// logger.error(JSON.stringify(libData.Message.validate.errors, null, "\t"));
|
||||||
this.close(4000, "Malformed message");
|
this.close(4000, "Malformed message");
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export class Link {
|
|||||||
if (err instanceof libErrors.InvalidMessage) {
|
if (err instanceof libErrors.InvalidMessage) {
|
||||||
logger.error(err.message);
|
logger.error(err.message);
|
||||||
if (err.errors) {
|
if (err.errors) {
|
||||||
logger.error(JSON.stringify(err.errors, null, 4));
|
logger.error(JSON.stringify(err.errors, null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -364,7 +364,7 @@ export class Link {
|
|||||||
response = handler(entry.requestFromJSON(message.data), message.src, message.dst);
|
response = handler(entry.requestFromJSON(message.data), message.src, message.dst);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
if (err.errors) {
|
if (err.errors) {
|
||||||
logger.error(JSON.stringify(err.errors, null, 4));
|
logger.error(JSON.stringify(err.errors, null, "\t"));
|
||||||
}
|
}
|
||||||
this.connector.sendResponseError(
|
this.connector.sendResponseError(
|
||||||
new libData.ResponseError(err.message, err.code, err.stack), message.src
|
new libData.ResponseError(err.message, err.code, err.stack), message.src
|
||||||
@@ -392,7 +392,7 @@ export class Link {
|
|||||||
if (err instanceof libErrors.InvalidMessage) {
|
if (err instanceof libErrors.InvalidMessage) {
|
||||||
logger.error(err.message);
|
logger.error(err.message);
|
||||||
if (err.errors) {
|
if (err.errors) {
|
||||||
logger.error(JSON.stringify(err.errors, null, 4));
|
logger.error(JSON.stringify(err.errors, null, "\t"));
|
||||||
}
|
}
|
||||||
} else if (!(err instanceof libErrors.RequestError)) {
|
} else if (!(err instanceof libErrors.RequestError)) {
|
||||||
logger.error(`Unexpected error responding to ${message.name}:\n${err.stack}`);
|
logger.error(`Unexpected error responding to ${message.name}:\n${err.stack}`);
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ export class LogIndex {
|
|||||||
async save() {
|
async save() {
|
||||||
await libFileOps.safeOutputFile(
|
await libFileOps.safeOutputFile(
|
||||||
path.join(this.logDirectory, "index.json"),
|
path.join(this.logDirectory, "index.json"),
|
||||||
JSON.stringify(this.serialize(), null, 4)
|
JSON.stringify(this.serialize(), null, "\t")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export async function handlePluginCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pluginList.set(pluginInfo.name, pluginPath);
|
pluginList.set(pluginInfo.name, pluginPath);
|
||||||
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
|
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, "\t"));
|
||||||
print(`Added ${pluginInfo.name}`);
|
print(`Added ${pluginInfo.name}`);
|
||||||
|
|
||||||
} else if (command === "remove") {
|
} else if (command === "remove") {
|
||||||
@@ -83,7 +83,7 @@ export async function handlePluginCommand(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
|
await libFileOps.safeOutputFile(pluginListPath, JSON.stringify([...pluginList], null, "\t"));
|
||||||
print(`Removed ${args.name}`);
|
print(`Removed ${args.name}`);
|
||||||
|
|
||||||
} else if (command === "list") {
|
} else if (command === "list") {
|
||||||
@@ -162,7 +162,7 @@ export async function handleConfigCommand(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
instance.set(args.field as string, args.value);
|
instance.set(args.field as string, args.value);
|
||||||
await libFileOps.safeOutputFile(configPath, JSON.stringify(instance.serialize(), null, 4));
|
await libFileOps.safeOutputFile(configPath, JSON.stringify(instance.serialize(), null, "\t"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof libConfig.InvalidField || err instanceof libConfig.InvalidValue) {
|
if (err instanceof libConfig.InvalidField || err instanceof libConfig.InvalidValue) {
|
||||||
logger.error(err.message);
|
logger.error(err.message);
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ export default function CreateSaveModal(props: CreateSaveModalProps) {
|
|||||||
}
|
}
|
||||||
form.setFields([{ name: "exchangeString", errors: [], value: "" }]);
|
form.setFields([{ name: "exchangeString", errors: [], value: "" }]);
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
mapGenSettings: JSON.stringify(result.map_gen_settings, null, 4),
|
mapGenSettings: JSON.stringify(result.map_gen_settings, null, "\t"),
|
||||||
mapSettings: JSON.stringify(result.map_settings, null, 4),
|
mapSettings: JSON.stringify(result.map_settings, null, "\t"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ export default function LoadScenarioModal(props: LoadScenarioModalProps) {
|
|||||||
}
|
}
|
||||||
form.setFields([{ name: "exchangeString", errors: [], value: "" }]);
|
form.setFields([{ name: "exchangeString", errors: [], value: "" }]);
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
mapGenSettings: JSON.stringify(result.map_gen_settings, null, 4),
|
mapGenSettings: JSON.stringify(result.map_gen_settings, null, "\t"),
|
||||||
mapSettings: JSON.stringify(result.map_settings, null, 4),
|
mapSettings: JSON.stringify(result.map_settings, null, "\t"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ async function saveTechnologies(
|
|||||||
) {
|
) {
|
||||||
let filePath = path.join(controllerConfig.get("controller.database_directory"), "technologies.json");
|
let filePath = path.join(controllerConfig.get("controller.database_directory"), "technologies.json");
|
||||||
logger.verbose(`writing ${filePath}`);
|
logger.verbose(`writing ${filePath}`);
|
||||||
await lib.safeOutputFile(filePath, JSON.stringify([...technologies.entries()], null, 4));
|
await lib.safeOutputFile(filePath, JSON.stringify([...technologies.entries()], null, "\t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ControllerPlugin extends lib.BaseControllerPlugin {
|
export class ControllerPlugin extends lib.BaseControllerPlugin {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ describe("Integration of host/src/server", function() {
|
|||||||
let settings = await server.exampleSettings();
|
let settings = await server.exampleSettings();
|
||||||
settings.visibility = { public: false, lan: true };
|
settings.visibility = { public: false, lan: true };
|
||||||
settings.require_user_verification = false;
|
settings.require_user_verification = false;
|
||||||
await fs.outputFile(server.writePath("server-settings.json"), JSON.stringify(settings, null, 4));
|
await fs.outputFile(server.writePath("server-settings.json"), JSON.stringify(settings, null, "\t"));
|
||||||
|
|
||||||
// Make sure the test does not fail due to create() failing.
|
// Make sure the test does not fail due to create() failing.
|
||||||
let mapPath = server.writePath("saves", "test.zip");
|
let mapPath = server.writePath("saves", "test.zip");
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ describe("lib/database", function() {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await fs.readFile(testFile, { encoding: "utf-8" }),
|
await fs.readFile(testFile, { encoding: "utf-8" }),
|
||||||
'{\n "c": {},\n "d": "foo"\n}'
|
'{\n\t"c": {},\n\t"d": "foo"\n}'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -155,7 +155,7 @@ describe("lib/database", function() {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await fs.readFile(testFile, { encoding: "utf-8" }),
|
await fs.readFile(testFile, { encoding: "utf-8" }),
|
||||||
'[\n {\n "id": "c"\n },\n {\n "id": "d"\n }\n]'
|
'[\n\t{\n\t\t"id": "c"\n\t},\n\t{\n\t\t"id": "d"\n\t}\n]'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user