MCPcopy Create free account
hub / github.com/appium/appium / write

Function write

packages/schema/scripts/generate-schema-json.mjs:44–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42const OUTPUT_PATH = path.join(OUTPUT_DIR, JSON_FILENAME);
43
44async function write() {
45 /** @type {typeof import('../lib/appium-config-schema.js').AppiumConfigJsonSchema} */
46 let schema;
47 try {
48 ({AppiumConfigJsonSchema: schema} = await import(pathToFileURL(SCHEMA_SRC).href));
49 } catch (e) {
50 throw new Error(`${error} Failed to read ${SCHEMA_SRC}; did you execute \`npm run build\` first?`, {cause: e});
51 }
52
53 const json = `${JSON.stringify(schema, null, 2)}\n`;
54
55 try {
56 await mkdir(OUTPUT_DIR, {recursive: true});
57 await writeFile(OUTPUT_PATH, json);
58 console.log(`${info} Wrote JSON schema to ${OUTPUT_PATH}`);
59 } catch (err) {
60 const message = err instanceof Error ? err.message : String(err);
61 throw new Error(`${error} Failed to write JSON schema to ${OUTPUT_PATH}: ${message}`, {
62 cause: err,
63 });
64 }
65}
66
67async function main() {
68 try {

Callers 1

mainFunction · 0.70

Calls 2

mkdirFunction · 0.85
logMethod · 0.65

Tested by

no test coverage detected