How to use the ora.default function in ora

To help you get started, we’ve selected a few ora examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adam-hanna / design-first / lib / handlers / gen / index.js View on Github external
exports.handler = (args) => __awaiter(this, void 0, void 0, function* () {
    let exit = 0;
    const designFile = `${process.env.PWD}/${args.file}`;
    const tmpDir = `${process.env.PWD}/tmp-${uuid_1.v4()}`; // TODO: use 'mkdtempSync'?
    const authenticationDir = `${process.env.PWD}/src/authentication`;
    const authorizationDir = `${process.env.PWD}/src/authorization`;
    const contextDir = `${process.env.PWD}/src/context`;
    const handlersDir = `${process.env.PWD}/src/handlers`;
    const internalDir = `${process.env.PWD}/src/internal`;
    const middlewareDir = `${process.env.PWD}/src/middleware`;
    const spinner = ora_1.default('Generating api...').start();
    try {
        // 1. check if design file exists
        if (yield !fs_extra_1.existsSync(designFile)) {
            throw new Error(`could not open ${designFile}. File does not exists`);
        }
        // 2. load design file into object
        const design = Object.assign(new design_1.default(), JSON.parse(yield fs_extra_1.readFileSync(designFile).toString()));
        const errors = design.Validate();
        if (errors && errors.length > 0) {
            throw errors.map((error) => `${error}\n`);
        }
        // 3. generate the temporary 'internal' files
        yield internal_1.genInternal(tmpDir, design);
        // 4. remove the existing internal route files and copy over the new ones
        if (yield !fs_extra_1.existsSync(internalDir)) {
            throw new Error("could not find directory './internal'. Did you '$ design-first init [name] && cd [name] && design-first gen '?");
github saberland / saber / packages / saber / lib / utils / spinner.js View on Github external
// @ts-check
const ora = require('ora').default

module.exports = ora()
github ablehq / firestore-explorer / firebase-seeds / dist / movies.js View on Github external
const kickVerification = (firebaseApp) => {
    const movieSpinner = ora_1.default(`Checking data consistency`).start();
    const moviesRef = firebaseApp.collection("movies");
    const obs1 = rxjs_1.from(moviesRef.get()).pipe(operators_1.map(snapshot => {
        return snapshot.size === exports.localMoviesJSON.length;
    }));
    const obs2 = rxjs_1.from(exports.localMoviesJSON.filter(movie => exports.localTags.has(movie.movieId))).pipe(operators_1.mergeMap(movie => {
        return rxjs_1.from(firebaseApp
            .collection("movies")
            .doc(`${movie.movieId}`)
            .collection("tags")
            .get()).pipe(operators_1.map(snapshot => {
            const tags = exports.localTags.get(movie.movieId);
            if (tags && tags.length > 0) {
                if (tags.length === snapshot.size) {
                    return true;
                }
                return false;
github firebase / firebase-tools / src / commands / ext-uninstall.ts View on Github external
? " which had the following authorized roles in your project:\n" +
          instance.config.source.spec.roles
            .map((role: extensionsApi.Role) => `- ${role.role} \n`)
            .join("")
        : ". \n";
      const serviceAccountDeletionMessage = `This extension used service account ${clc.bold(
        instance.serviceAccountEmail
      )} ${rolesMessage}Do you want to delete this service account?`;
      confirmedServiceAccountDeletion = await promptOnce({
        type: "confirm",
        default: false,
        message: serviceAccountDeletionMessage,
      });
    }

    const spinner = ora.default(
      `Uninstalling ${clc.bold(instanceId)}. This usually takes 1 to 2 minutes...`
    );
    spinner.start();
    try {
      await extensionsApi.deleteInstance(projectId, instanceId);
      if (confirmedServiceAccountDeletion || options.force) {
        const saDeletionRes = await iam.deleteServiceAccount(
          projectId,
          instance.serviceAccountEmail
        );
        if (_.get(saDeletionRes, "body.error")) {
          if (_.get(saDeletionRes, "body.error.code") === 404) {
            spinner.succeed(
              ` ${clc.green.bold(logPrefix)}: service account ${clc.bold(
                instance.serviceAccountEmail
              )} was previously deleted.`
github firebase / firebase-tools / src / commands / ext-install.ts View on Github external
async function installMod(options: InstallModOptions): Promise {
  const { projectId, source, paramFilePath } = options;
  const spec = source.spec;
  const spinner = ora.default(
    "Installing your extension instance. This usually takes 3 to 5 minutes..."
  );
  try {
    await checkProjectBilling(projectId, spec.displayName || spec.name, spec.billingRequired);
    const roles = spec.roles ? spec.roles.map((role: modsApi.Role) => role.role) : [];
    await askUserForConsent.prompt(spec.displayName || spec.name, projectId, roles);

    const params = await paramHelper.getParams(projectId, _.get(spec, "params", []), paramFilePath);

    let instanceId = await getValidInstanceId(projectId, spec.name);
    spinner.start();
    let serviceAccountEmail;
    while (!serviceAccountEmail) {
      try {
        serviceAccountEmail = await createServiceAccountAndSetRoles(
          projectId,
github twilio / flex-plugin-builder / packages / flex-dev-utils / src / ora.ts View on Github external
export const _getSpinner = (text: string) => {
  const options: OraOptions = { text };
  if (process.env.DEBUG || process.env.TRACE) {
    options.isEnabled = false;
  }

  return ora.default(options);
};
github Pop-Code / nestjs-console / src / service.ts View on Github external
static createSpinner(text?: string) {
        return ora.default(text);
    }
github firebase / firebase-tools / src / commands / ext-update.ts View on Github external
.action(async (instanceId: string, options: any) => {
    const spinner = ora.default(
      `Updating ${clc.bold(instanceId)}. This usually takes 3 to 5 minutes...`
    );
    try {
      const projectId = getProjectId(options, false);
      let existingInstance;
      try {
        existingInstance = await extensionsApi.getInstance(projectId, instanceId);
      } catch (err) {
        if (err.status === 404) {
          return utils.reject(
            `No extension instance ${instanceId} found in project ${projectId}.`,
            {
              exit: 1,
            }
          );
        }

ora

Elegant terminal spinner

MIT
Latest version published 20 days ago

Package Health Score

91 / 100
Full package analysis