jok
Version:
Bundle of utility functions for code generation related to nodejs and graphql
60 lines (59 loc) • 3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.start = exports.copying = exports.installError = exports.installing = exports.alreadyExists = exports.missingProjectName = exports.exampleHelp = exports.help = void 0;
var chalk_1 = require("chalk");
// const getInstallCmd = require('./utils/get-install-cmd')
var output = require("../../integration/output");
var program = {
name: 'jok',
};
function help() {
return "\n Only " + chalk_1.default.green('<project-directory>') + " is required.\n\n If you have any problems, do not hesitate to file an issue:\n " + chalk_1.default.cyan('https://github.com/jokio/jok-cli/issues/new') + "\n ";
}
exports.help = help;
function exampleHelp() {
return "Example from https://github.com/jokio/jok-cli/tree/master/examples/ " + output.param('example-path');
}
exports.exampleHelp = exampleHelp;
function missingProjectName() {
return "\nPlease specify the project directory:\n\n " + chalk_1.default.cyan(program.name) + " " + chalk_1.default.green('<project-directory>') + "\n\nFor example:\n\n " + chalk_1.default.cyan(program.name) + " " + chalk_1.default.green('my-jokio-app') + "\n " + chalk_1.default.cyan(program.name) + " " + chalk_1.default.cyan('--example custom-server') + " " + chalk_1.default.green('custom-server-app') + "\n\nRun " + chalk_1.default.cyan(program.name + " --help") + " to see all options.\n";
}
exports.missingProjectName = missingProjectName;
function alreadyExists(projectName) {
return ("\nUh oh! Looks like there's already a" +
(" directory called " + chalk_1.default.red(projectName) + ". Please try a different name or delete that folder."));
}
exports.alreadyExists = alreadyExists;
function installing(packages) {
var pkgText = packages
.map(function (pkg) {
return " " + chalk_1.default.cyan(chalk_1.default.bold(pkg));
})
.join('\n');
return "\n Installing npm modules:\n" + pkgText + "\n";
}
exports.installing = installing;
function installError(packages) {
var pkgText = packages
.map(function (pkg) {
return "" + chalk_1.default.cyan(chalk_1.default.bold(pkg));
})
.join(', ');
output.error("Failed to install " + pkgText + ", try again.");
}
exports.installError = installError;
function copying(projectName, templateName) {
return "\nCreating " + chalk_1.default.bold(chalk_1.default.green(projectName)) + " " + chalk_1.default.gray('(template: ' + templateName + ')') + "...\n";
}
exports.copying = copying;
function start(projectName) {
// const cmd = getInstallCmd()
// const commands = {
// install: cmd === 'npm' ? 'npm install' : 'yarn',
// build: cmd === 'npm' ? 'npm run build' : 'yarn build',
// start: cmd === 'npm' ? 'npm run start' : 'yarn start',
// dev: cmd === 'npm' ? 'npm run dev' : 'yarn dev',
// }
return "\n Next steps:\n\n $ " + output.cmd("code " + projectName) + "\n";
}
exports.start = start;