How to use the signale.warn function in signale

To help you get started, we’ve selected a few signale 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 umijs / father / src / preCommit.ts View on Github external
export function install() {
  const usePreCommit: boolean = !!Object.keys(preCommitConfig).length;

  const hookPath = join(cwd, '.git/hooks');
  const preCommitHooks = join(hookPath, 'pre-commit');
  const existHooks = existsSync(preCommitHooks);
  const isFatherPreCommit = existHooks && readFileSync(preCommitHooks, 'utf8').includes(HOOK_MARK);

  // Check if exist other hooks
  if (usePreCommit && existHooks && !isFatherPreCommit) {
    signale.warn('Another pre-commit hooks is in using. Father pre-commit hook will not work.');
    return;
  }

  if (usePreCommit && !existHooks) {
    // Create hook path
    ensureDirSync(hookPath);

    writeFileSync(preCommitHooks, getPreCommitTemplate(), 'utf8');
    try {
      chmodSync(preCommitHooks, '777');
    } catch (e) {
      signale.warn(`chmod ${chalk.cyan(preCommitHooks)} failed: ${e.message}`);
    }

    signale.info('Create pre-commit hook');
  }
github staart / api / src / helpers / errors.ts View on Github external
export const sendError = (error: string) => {
  if (error.includes("/")) {
    let status = parseInt(error.split("/")[0]);
    if (isNaN(status)) status = 500;
    const code = error.split("/")[1];
    return { status, code } as HTTPError;
  }
  warn(error);
  return { status: 500, code: error } as HTTPError;
};
github blurHY / HorizonSpider / App.js View on Github external
if (!(admin && admin.inited)) {
            continue_ = false
            try {
                signale.fatal("Failed to connect admin site. Sending a request to zeronet")
                let body = await rp({
                    url: `http://${SettingsLoader.ZeroNetHost}`,
                    headers: { "Accept": "text/html", "Accept-Encoding": "gzip, deflate, br", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36", "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6,ru;q=0.5,ja;q=0.4,de;q=0.3" },
                    followRedirect: true
                })
                try {
                    signale.info(/\[^<>]+\<\/title\>/g.exec(body)[0])
                } catch{
                    signale.info(body)
                }
            } catch (e) {
                signale.warn(e)
                continue_ = true
            }
        }
        if (continue_)
            await delay(1000 * 60 * 3)
    }
}
github staart / api / setup / check-update.js View on Github external
const checkUpdate = async () => {
  const pkg = (await axios.get(packageUrl)).data;
  const v = yourPkg["staart-version"];
  info("Most recent version is", pkg.version);
  info("Your version is", v);
  if (v !== pkg.version) {
    warn("🚨  Staart update required");
  }
  const i = JSON.parse(
    (await fs.readFile(path.join(__dirname, "..", "package.json"))).toString()
  );
  if (
    i.name !== "@staart/manager" &&
    !Object.keys(i.devDependencies).includes("@staart/manager")
  ) {
    if (process.env.USE_NPM || !hasYarn()) {
      shell.exec("npm install --save-dev @staart/manager");
    } else {
      shell.exec("yarn add -D @staart/manager");
    }
  }
  return;
};
github doczjs / docz / core / docz-core / src / utils / docgen / typescript.ts View on Github external
function getPropsOnCache(): any {
  const cache = readCacheFile()
  if (_.isEmpty(cache)) {
    logger.warn('No cache was found with your props definitions')
    logger.warn("We'll parse your components to get props from them")
    logger.warn('Depending on your components, this could take while...')
    return []
  }

  return Object.entries(cache).map(([key, value]) => ({
    key: unixPath(key),
    value: _.get('props', value),
  }))
}
github blurHY / HorizonSpider / App.js View on Github external
process.on("exit", () => {
    signale.warn("Exited")
})
github hummal / crittr / src / classes / Crittr.class.js View on Github external
.catch(err => {
                                if (retryCounter-- > 0) {
                                    log.warn("Could not get page from browser. Retry " + retryCounter + " times.");
                                    resolve(getPage());
                                } else {
                                    log.warn("Tried to get page but failed. Abort now ...");
                                    reject(err);
                                }
                            });
                    } catch (err) {
github doczjs / docz / core / docz-core / src / utils / docgen / typescript.ts View on Github external
function getPropsOnCache(): any {
  const cache = readCacheFile()
  if (_.isEmpty(cache)) {
    logger.warn('No cache was found with your props definitions')
    logger.warn("We'll parse your components to get props from them")
    logger.warn('Depending on your components, this could take while...')
    return []
  }

  return Object.entries(cache).map(([key, value]) => ({
    key: unixPath(key),
    value: _.get('props', value),
  }))
}