Skip to content

Commit

Permalink
util: new XIVAPI CLI query tool (#41)
Browse files Browse the repository at this point in the history
Adds a new XIVAPI CLI query tool to util. It's a lightweight script that
fetches endpoint data, filters it based on a user-specified filter
string, and outputs it as JSON to the console. I put an early version of
this together for looking into some of the data issues during the util
script cleanup, and it was pretty helpful. It's grown a bit since. 👀

More info on usage available by running `npm run query -- -h`.

Since it uses regex on user-supplied inputs, there's a lot of error
handling needed to capture wonky user input. I *think* I've accounted
for most of the possibilities, but open to anything I missed.

Comments/suggestions welcome!
  • Loading branch information
wexxlee authored Jan 11, 2024
1 parent cafcf25 commit 066107d
Show file tree
Hide file tree
Showing 6 changed files with 586 additions and 8 deletions.
5 changes: 5 additions & 0 deletions docs/PatchUpdateChecklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ in the console as the scripts are run.
It is recommended that you choose at least the 'Alert' level to ensure you are notified
of any problems that require manual intervetion before merging the file changes.

If you run into collisions or other data issues that require resolution before merge,
you can use the XIVAPI CLI helper utility to request and filter XIVAPI data --
and see it as JSON console output -- by running `npm run query`.
Use `npm run query -- -h` for info on how to use the utility.

#### effect_id data

As new status effects are added to the game, those names may conflict with existing names.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"find-translations": "npm run util -- findTranslations",
"translate-timeline": "npm run util -- translateTimeline",
"generate": "npm run util -- generate",
"query": "npm run util -- query",
"process-triggers": "node --loader=ts-node/esm util/process_triggers_folder.ts",
"generate-log-guide": "node --loader=ts-node/esm util/gen_log_guide.ts",
"validate-versions": "node --loader=ts-node/esm util/validate_versions.ts",
Expand Down
4 changes: 4 additions & 0 deletions util/console_logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ export class ConsoleLogger {
console.log(`ERROR: ${msg} Exiting...`);
process.exit(1);
}

printNoHeader(msg: string): void {
console.log(`${msg}`);
}
}
2 changes: 2 additions & 0 deletions util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import inquirerFuzzyPath, { FuzzyPathQuestionOptions } from 'inquirer-fuzzy-path

import { registerFindMissingTranslations } from './find_missing_translations_action';
import { registerGenerateDataFiles } from './generate_data_files';
import { registerQueryXivApi } from './query_xivapi';
import { registerTranslateTimeline } from './translate_timeline';

declare module 'inquirer' {
Expand Down Expand Up @@ -34,6 +35,7 @@ const subparsers = argumentParser.addSubparsers({
registerTranslateTimeline(actionChoices, subparsers);
registerGenerateDataFiles(actionChoices, subparsers);
registerFindMissingTranslations(actionChoices, subparsers);
registerQueryXivApi(actionChoices, subparsers);

inquirer.registerPrompt('fuzzypath', inquirerFuzzyPath);

Expand Down
Loading

0 comments on commit 066107d

Please sign in to comment.