當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript execa.stdout函數代碼示例

本文整理匯總了TypeScript中execa.stdout函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript stdout函數的具體用法?TypeScript stdout怎麽用?TypeScript stdout使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了stdout函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: async

const ensureMasterBranch = async () => {
  const currentBranch = await execa.stdout('git', ['symbolic-ref', '--short', 'HEAD']);
  const status = await execa.stdout('git', ['status', '--porcelain']);

  if (currentBranch !== 'master' && status !== '') {
    console.error(chalk.red.bold('You need to be on clean master branch to release @grafana/ui'));
    process.exit(1);
  }
};
開發者ID:johntdyer,項目名稱:grafana,代碼行數:9,代碼來源:grafanaui.release.ts

示例2: catch

 const availableCommands = await Promise.all(commands.map(async command => {
     try {
         await execa.stdout('which', [command.command]);
         return command;
     } catch (error) {
         return false;
     }
 }));
開發者ID:arnellebalane,項目名稱:open-image,代碼行數:8,代碼來源:factory.ts

示例3: async

export const runImageOptim: AppRunner = async (options) => {
  info(`Running ${IMAGEOPTIM.name}...`);
  if (!(await pathExists(IMAGEOPTIM_BIN_PATH))) {
    return warning(`ImageOptim.app is not installed (${IMAGEOPTIM_URL})`);
  }
  await stdout(IMAGEOPTIM_BIN_PATH, [options.tmpDir]);
  verbose(`${IMAGEOPTIM.name} has finished`);
};
開發者ID:JamieMason,項目名稱:ImageOptim-CLI,代碼行數:8,代碼來源:run-imageoptim.ts

示例4: async

    async ({ log }) => {
      const files = await execa.stdout('git', ['ls-tree', '--name-only', '-r', 'HEAD'], {
        cwd: REPO_ROOT,
      });

      const isNotInTsProject: File[] = [];
      const isInMultipleTsProjects: File[] = [];

      for (const lineRaw of files.split('\n')) {
        const line = lineRaw.trim();

        if (!line) {
          continue;
        }

        const file = new File(resolve(REPO_ROOT, line));
        if (!file.isTypescript() || file.isFixture()) {
          continue;
        }

        log.verbose('Checking %s', file.getAbsolutePath());

        const projects = PROJECTS.filter(p => p.isAbsolutePathSelected(file.getAbsolutePath()));
        if (projects.length === 0) {
          isNotInTsProject.push(file);
        }
        if (projects.length > 1 && !file.isTypescriptAmbient()) {
          isInMultipleTsProjects.push(file);
        }
      }

      if (!isNotInTsProject.length && !isInMultipleTsProjects.length) {
        log.success('All ts files belong to a single ts project');
        return;
      }

      if (isNotInTsProject.length) {
        log.error(
          `The following files do not belong to a tsconfig.json file, or that tsconfig.json file is not listed in src/dev/typescript/projects.ts\n${isNotInTsProject
            .map(file => ` - ${file.getRelativePath()}`)
            .join('\n')}`
        );
      }

      if (isInMultipleTsProjects.length) {
        log.error(
          `The following files belong to multiple tsconfig.json files listed in src/dev/typescript/projects.ts\n${isInMultipleTsProjects
            .map(file => ` - ${file.getRelativePath()}`)
            .join('\n')}`
        );
      }

      process.exit(1);
    },
開發者ID:elastic,項目名稱:kibana,代碼行數:54,代碼來源:run_check_ts_projects_cli.ts

示例5: async

  async () => {
    await expect(
      execa.stdout('tsc', ['--noEmit'], {
        cwd: resolve(__dirname, '__fixtures__/frozen_object_mutation'),
      })
    ).rejects.toThrowErrorMatchingInlineSnapshot(`
"Command failed: tsc --noEmit

index.ts(30,11): error TS2540: Cannot assign to 'baz' because it is a read-only property.
index.ts(40,10): error TS2540: Cannot assign to 'bar' because it is a read-only property.
"
`);
  },
開發者ID:elastic,項目名稱:kibana,代碼行數:13,代碼來源:deep_freeze.test.ts

示例6: execa

execa('foo')
    .catch(error => {
        assert(error.cmd === 'foo');
        assert(error.code === 128);
        assert(error.failed === true);
        assert(error.killed === false);
        assert(error.signal === 'SIGINT');
        assert(error.stderr === 'stderr');
        assert(error.stdout === 'stdout');
        assert(error.timedOut === false);
    });

execa('noop', ['foo'])
    .then(result => result.stderr.toLocaleLowerCase());

execa.stdout('unicorns')
    .then(stdout => stdout.toLocaleLowerCase());
execa.stdout('echo', ['unicorns'])
    .then(stdout => stdout.toLocaleLowerCase());

execa.stderr('unicorns')
    .then(stderr => stderr.toLocaleLowerCase());
execa.stderr('echo', ['unicorns'])
    .then(stderr => stderr.toLocaleLowerCase());

execa.shell('echo unicorns')
    .then(result => result.stdout.toLocaleLowerCase());

{
    let result: string;
    result = execa.shellSync('foo').stderr;
開發者ID:DanCorder,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:execa-tests.ts

示例7: async

export const runImageOptim: AppRunner = async (options) => {
  info(`Running ${IMAGEOPTIM.name}...`);
  await stdout(IMAGEOPTIM_BIN_PATH, [options.tmpDir]);
  verbose(`${IMAGEOPTIM.name} has finished`);
};
開發者ID:jamesstout,項目名稱:ImageOptim-CLI,代碼行數:5,代碼來源:run-imageoptim.ts

示例8: stdout

export const osascript = (filePath: string, ...args: string[]): Promise<string> =>
  stdout('osascript', [filePath, ...args]);
開發者ID:JamieMason,項目名稱:ImageOptim-CLI,代碼行數:2,代碼來源:osascript.ts


注:本文中的execa.stdout函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。