mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
# Backport This will backport the following commits from `main` to `7.17`: - [Migrate from listr to listr2 (#182683)](https://github.com/elastic/kibana/pull/182683) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Larry Gregory","email":"larry.gregory@elastic.co"},"sourceCommit":{"committedDate":"2024-05-07T11:30:42Z","message":"Migrate from listr to listr2 (#182683)\n\n## Summary\r\n\r\nMigrates CLI tasks from `listr` to `listr2`. The former hasn't been\r\nupdated in a long time, and the community has moved on to `listr2`.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"40a16413572140b857e52dc45b206558ee0f1c9c","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","Team:Security","release_note:skip","backport missing","backport:all-open","ci:project-deploy-observability","Team:obs-ux-infra_services","apm:review","v8.15.0"],"number":182683,"url":"https://github.com/elastic/kibana/pull/182683","mergeCommit":{"message":"Migrate from listr to listr2 (#182683)\n\n## Summary\r\n\r\nMigrates CLI tasks from `listr` to `listr2`. The former hasn't been\r\nupdated in a long time, and the community has moved on to `listr2`.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"40a16413572140b857e52dc45b206558ee0f1c9c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.15.0","labelRegex":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/182683","number":182683,"mergeCommit":{"message":"Migrate from listr to listr2 (#182683)\n\n## Summary\r\n\r\nMigrates CLI tasks from `listr` to `listr2`. The former hasn't been\r\nupdated in a long time, and the community has moved on to `listr2`.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"40a16413572140b857e52dc45b206558ee0f1c9c"}}]}] BACKPORT--> --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
96 lines
2.5 KiB
JavaScript
96 lines
2.5 KiB
JavaScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
/* eslint-disable no-console*/
|
|
/* eslint-disable import/no-extraneous-dependencies*/
|
|
|
|
const execa = require('execa');
|
|
const { Listr } = require('listr2');
|
|
const { resolve } = require('path');
|
|
const { argv } = require('yargs');
|
|
|
|
const root = resolve(__dirname, '../../../..');
|
|
|
|
const execaOpts = { cwd: root, stderr: 'pipe' };
|
|
|
|
const useOptimizedTsConfig = !!argv.optimizeTs;
|
|
|
|
const tsconfig = useOptimizedTsConfig
|
|
? resolve(root, 'tsconfig.json')
|
|
: resolve(root, 'x-pack/plugins/apm/tsconfig.json');
|
|
|
|
const testTsconfig = resolve(root, 'x-pack/test/tsconfig.json');
|
|
|
|
const tasks = new Listr(
|
|
[
|
|
{
|
|
title: 'Lint',
|
|
task: () => execa('node', [resolve(__dirname, 'eslint.js')], execaOpts),
|
|
},
|
|
{
|
|
title: 'Typescript',
|
|
task: () =>
|
|
execa(
|
|
'node',
|
|
[
|
|
resolve(
|
|
__dirname,
|
|
useOptimizedTsConfig ? './optimize-tsconfig.js' : './unoptimize-tsconfig.js'
|
|
),
|
|
],
|
|
execaOpts
|
|
).then(() =>
|
|
Promise.all([
|
|
execa(
|
|
require.resolve('typescript/bin/tsc'),
|
|
['--project', tsconfig, '--pretty', '--noEmit'],
|
|
execaOpts
|
|
),
|
|
execa(
|
|
require.resolve('typescript/bin/tsc'),
|
|
['--project', testTsconfig, '--pretty', '--noEmit'],
|
|
execaOpts
|
|
),
|
|
])
|
|
),
|
|
},
|
|
{
|
|
title: 'Jest',
|
|
task: () =>
|
|
execa(
|
|
'node',
|
|
[
|
|
resolve(__dirname, '../../../../scripts/jest.js'),
|
|
'--config',
|
|
resolve(__dirname, '../jest.config.js'),
|
|
'--reporters',
|
|
resolve(__dirname, '../../../../node_modules/jest-silent-reporter'),
|
|
'--collect-coverage',
|
|
'false',
|
|
'--maxWorkers',
|
|
4,
|
|
],
|
|
execaOpts
|
|
),
|
|
},
|
|
],
|
|
{
|
|
exitOnError: true,
|
|
concurrent: false,
|
|
renderer: process.env.CI ? 'verbose' : 'default',
|
|
}
|
|
);
|
|
|
|
tasks.run().catch((error) => {
|
|
// from src/dev/typescript/exec_in_projects.ts
|
|
process.exitCode = 1;
|
|
const errors = error.errors || [error];
|
|
|
|
for (const e of errors) {
|
|
process.stderr.write(e.stderr || e.stdout);
|
|
}
|
|
});
|