本文整理汇总了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;未经允许,请勿转载。 |
请发表评论