@fragment-dev/cli
Version:
55 lines (52 loc) • 1.19 kB
JavaScript
import {
AuthenticatedCommand
} from "./chunk-SHTFFJEV.js";
import {
require_lib
} from "./chunk-IH6BCA6S.js";
import {
getParsedSchema
} from "./chunk-UDU5PBTV.js";
import {
__toESM,
init_cjs_shims
} from "./chunk-7GH3YGSC.js";
// src/commands/store-schema.ts
init_cjs_shims();
var import_core = __toESM(require_lib(), 1);
var StoreSchema = class extends AuthenticatedCommand {
static {
this.description = "Store schema within your Fragment workspace";
}
static {
this.examples = ["<%= config.bin %> <%= command.id %>"];
}
static {
this.flags = {
path: import_core.Flags.string({
char: "p",
description: "Path to schema file (e.g. fragment.jsonc)",
default: "fragment.jsonc"
// TODO: Update to use DEFAULT_SCHEMA_PATH constant
})
};
}
async run() {
const schema = getParsedSchema({
command: this,
schemaPath: this.flags.path
});
const res = await this.sdk.storeSchema({
schema: {
...schema,
name: schema.name ?? schema.key
}
});
if (res.storeSchema.__typename !== "StoreSchemaResult") {
this.exit(1);
}
}
};
export {
StoreSchema
};