@cardstack/cli
Version:
Command line tools for Cardstack.
88 lines • 3.2 kB
JavaScript
;
// This rule is confused by us being TypeScript (the package.json file points at
// our JS output, so we are not technically a "binary" in package.json).
/* eslint-disable node/shebang */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const yargs_1 = __importDefault(require("yargs"));
const console_ui_1 = __importDefault(require("console-ui"));
const os_1 = require("os");
const path_1 = require("path");
const ui = new console_ui_1.default();
yargs_1.default
.scriptName("cardstack")
.command("start", "Start your local Cardstack Hub", args => {
return args.option("hub-dir", {
alias: "d",
describe: "path to your local running cardstack hub",
type: "string",
default: path_1.join(os_1.homedir(), ".cardstack"),
});
}, async function (argv) {
let run = await Promise.resolve().then(() => __importStar(require("../start")));
await run.default(Object.assign({ ui }, argv));
})
.command("pre-build", "Generate new blueprints", args => {
return args.option("dir", {
alias: "d",
describe: "destination directory for the blueprints",
type: "string",
default: process.cwd()
});
}, async function (argv) {
let preBuild = await Promise.resolve().then(() => __importStar(require("../pre-build")));
await preBuild.default(Object.assign({ ui }, argv));
})
.command('new <card-name>', 'Create a card', (args) => {
return args.positional('card-name', {
describe: 'the name for the new Card',
type: 'string',
demandOption: true,
normalize: true
});
}, async function (argv) {
let newCard = await Promise.resolve().then(() => __importStar(require('../new-card')));
await newCard.default(Object.assign({ ui }, argv));
})
.command('load', 'Load a card into your Cardstack Hub', (args) => {
return args.option('card-dir', {
alias: "c",
describe: 'The path to the card you want to load',
type: 'string',
normalize: true,
default: process.cwd(),
}).option("hub-dir", {
alias: "d",
describe: "The location of your running hub",
type: "string",
default: path_1.join(os_1.homedir(), ".cardstack"),
});
}, async function (argv) {
let load = await Promise.resolve().then(() => __importStar(require('../load')));
return load.default(Object.assign({ ui }, argv));
})
.demandCommand(1, 'Use any of the commands below.\n')
.strict()
.fail((msg, err) => {
if (msg) {
ui.write(msg + "\n", "ERROR");
}
if (err) {
ui.writeError(err);
}
else {
yargs_1.default.showHelp();
}
process.exit(-1);
}).argv;
//# sourceMappingURL=cardstack.js.map