feat: add find-id
parent
03166a3e19
commit
3ddf181560
|
|
@ -1,4 +1,4 @@
|
||||||
*.json
|
profile.json
|
||||||
.vscode/
|
.vscode/
|
||||||
export/
|
export/
|
||||||
cache/
|
cache/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"tasks": {
|
||||||
|
"check": "deno check s3si.ts",
|
||||||
|
"fmt": "deno fmt",
|
||||||
|
"fmt:check": "deno fmt --check",
|
||||||
|
"lint": "deno lint",
|
||||||
|
"run": "deno run -A"
|
||||||
|
},
|
||||||
|
"fmt": {
|
||||||
|
"files": {
|
||||||
|
"exclude": [
|
||||||
|
"export/",
|
||||||
|
"cache/",
|
||||||
|
".vscode/",
|
||||||
|
"profile.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { base64 } from "../deps.ts";
|
||||||
|
import { FileExporterType } from "../src/exporters/file.ts";
|
||||||
|
|
||||||
|
const dirs = Deno.args;
|
||||||
|
|
||||||
|
const files: string[] = [];
|
||||||
|
|
||||||
|
for (const dir of dirs) {
|
||||||
|
for await (const entry of Deno.readDir(dir)) {
|
||||||
|
if (entry.isFile) {
|
||||||
|
files.push(`${dir}/${entry.name}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ids = new Map<string, string>();
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
try {
|
||||||
|
const content: FileExporterType = JSON.parse(await Deno.readTextFile(file));
|
||||||
|
const id = content.data.detail.id;
|
||||||
|
const rawId = base64.decode(id);
|
||||||
|
const uuid = new TextDecoder().decode(rawId.slice(rawId.length - 36));
|
||||||
|
if (ids.has(uuid)) {
|
||||||
|
console.log(
|
||||||
|
`Duplicate: ${uuid}:${id} in ${file} and ${uuid}:${ids.get(uuid)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ids.set(uuid, id);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Failed to process file", file, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ import { BattleExporter, VsBattle } from "../types.ts";
|
||||||
import { base64, path } from "../../deps.ts";
|
import { base64, path } from "../../deps.ts";
|
||||||
import { NSOAPP_VERSION, S3SI_VERSION } from "../constant.ts";
|
import { NSOAPP_VERSION, S3SI_VERSION } from "../constant.ts";
|
||||||
|
|
||||||
type FileExporterType = {
|
export type FileExporterType = {
|
||||||
type: "VS" | "COOP";
|
type: "VS" | "COOP";
|
||||||
nsoVersion: string;
|
nsoVersion: string;
|
||||||
s3siVersion: string;
|
s3siVersion: string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue