mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Move src/dev/run
to @kbn/dev-utils (#43387)
* move src/dev/run into `@kbn/dev-utils` * forgot to save a replacement
This commit is contained in:
parent
5e14f9ec19
commit
e8409c0160
38 changed files with 43 additions and 35 deletions
|
@ -11,8 +11,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"chalk": "^2.4.1",
|
||||
"dedent": "^0.7.0",
|
||||
"execa": "^1.0.0",
|
||||
"exit-hook": "^2.2.0",
|
||||
"getopts": "^2.2.5",
|
||||
"moment": "^2.20.1",
|
||||
"rxjs": "^6.2.1",
|
||||
"tree-kill": "^1.2.0",
|
||||
|
|
|
@ -21,3 +21,4 @@ export { withProcRunner } from './proc_runner';
|
|||
export { ToolingLog, ToolingLogTextWriter, pickLevelFromFlags } from './tooling_log';
|
||||
export { createAbsolutePathSerializer } from './serializers';
|
||||
export { CA_CERT_PATH, ES_KEY_PATH, ES_CERT_PATH } from './certs';
|
||||
export { run, createFailError, createFlagError, combineErrors, isFailError } from './run';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# dev/run
|
||||
# @kbn/dev-utils > run()
|
||||
|
||||
Helper functions for writing little scripts for random build/ci/dev tasks.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Define the function that should validate the CLI arguments and call your task fn
|
|||
|
||||
```ts
|
||||
// dev/my_task/run_my_task.ts
|
||||
import { createFlagError, run } from '../run';
|
||||
import { createFlagError, run } from '@kbn/dev-utils';
|
||||
|
||||
run(
|
||||
async ({ flags, log }) => {
|
|
@ -20,7 +20,7 @@
|
|||
// @ts-ignore @types are outdated and module is super simple
|
||||
import exitHook from 'exit-hook';
|
||||
|
||||
import { pickLevelFromFlags, ToolingLog } from '@kbn/dev-utils';
|
||||
import { pickLevelFromFlags, ToolingLog } from '../tooling_log';
|
||||
import { createFlagError, isFailError } from './fail';
|
||||
import { Flags, getFlags, getHelp } from './flags';
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { run } from '../../../../src/dev/run';
|
||||
import { run } from '@kbn/dev-utils';
|
||||
import { FunctionalTestRunner } from './functional_test_runner';
|
||||
|
||||
export function runFtrCli() {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { CLIEngine } from 'eslint';
|
||||
|
||||
import { createFailError } from '../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
import { REPO_ROOT } from '../constants';
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ import {
|
|||
} from './extractors';
|
||||
import { globAsync, readFileAsync, normalizePath } from './utils';
|
||||
|
||||
import { createFailError, isFailError } from '../run';
|
||||
import { createFailError, isFailError } from '@kbn/dev-utils';
|
||||
|
||||
function addMessageToMap(targetMap, key, value, reporter) {
|
||||
const existingValue = targetMap.get(key);
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
import { extractI18nCallMessages } from './i18n_call';
|
||||
import { createParserErrorMessage, isI18nTranslateFunction, traverseNodes } from '../utils';
|
||||
import { extractIntlMessages, extractFormattedMessages } from './react';
|
||||
import { createFailError, isFailError } from '../../run';
|
||||
import { createFailError, isFailError } from '@kbn/dev-utils';
|
||||
|
||||
/**
|
||||
* Detect Intl.formatMessage() function call (React).
|
||||
|
|
|
@ -33,7 +33,7 @@ import {
|
|||
extractDescriptionValueFromNode,
|
||||
} from '../utils';
|
||||
import { DEFAULT_MESSAGE_KEY, DESCRIPTION_KEY, VALUES_KEY } from '../constants';
|
||||
import { createFailError, isFailError } from '../../run';
|
||||
import { createFailError, isFailError } from '@kbn/dev-utils';
|
||||
|
||||
/**
|
||||
* Find all substrings of "{{ any text }}" pattern allowing '{' and '}' chars in single quote strings
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
extractValuesKeysFromNode,
|
||||
} from '../utils';
|
||||
import { DEFAULT_MESSAGE_KEY, DESCRIPTION_KEY, VALUES_KEY } from '../constants';
|
||||
import { createFailError } from '../../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
|
||||
/**
|
||||
* Extract messages from `funcName('id', { defaultMessage: 'Message text' })` call expression AST
|
||||
|
|
|
@ -21,7 +21,7 @@ import { parse } from '@babel/parser';
|
|||
|
||||
import { extractI18nCallMessages } from './i18n_call';
|
||||
import { isI18nTranslateFunction, traverseNodes, createParserErrorMessage } from '../utils';
|
||||
import { createFailError, isFailError } from '../../run';
|
||||
import { createFailError, isFailError } from '@kbn/dev-utils';
|
||||
|
||||
/**
|
||||
* Matches `i18n(...)` in `#{i18n('id', { defaultMessage: 'Message text' })}`
|
||||
|
|
2
src/dev/i18n/extractors/react.js
vendored
2
src/dev/i18n/extractors/react.js
vendored
|
@ -30,7 +30,7 @@ import {
|
|||
checkValuesProperty,
|
||||
} from '../utils';
|
||||
import { DEFAULT_MESSAGE_KEY, VALUES_KEY, DESCRIPTION_KEY } from '../constants';
|
||||
import { createFailError } from '../../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
|
||||
/**
|
||||
* Extract default messages from ReactJS intl.formatMessage(...) AST
|
||||
|
|
|
@ -21,6 +21,7 @@ import { ToolingLog } from '@kbn/dev-utils';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import path from 'path';
|
||||
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
import {
|
||||
accessAsync,
|
||||
checkValuesProperty,
|
||||
|
@ -33,7 +34,6 @@ import {
|
|||
// @ts-ignore
|
||||
} from './utils';
|
||||
|
||||
import { createFailError } from '../run';
|
||||
import { I18nConfig } from './config';
|
||||
import { serializeToJson } from './serializers';
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { createFailError } from '../../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
import { ErrorReporter, extractMessagesFromPathToMap, filterConfigPaths, I18nConfig } from '..';
|
||||
|
||||
export function extractDefaultMessages(config: I18nConfig, inputPaths: string[]) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { createFailError } from '../../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
import {
|
||||
I18nConfig,
|
||||
matchEntriesWithExctractors,
|
||||
|
|
|
@ -36,7 +36,7 @@ import path from 'path';
|
|||
import chalk from 'chalk';
|
||||
import parser from 'intl-messageformat-parser';
|
||||
|
||||
import { createFailError } from '../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
|
||||
const ESCAPE_LINE_BREAK_REGEX = /(?<!\\)\\\n/g;
|
||||
const HTML_LINE_BREAK_REGEX = /[\s]*\n[\s]*/g;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { run } from '@kbn/dev-utils';
|
||||
import { getInstalledPackages } from '../npm';
|
||||
import { run } from '../run';
|
||||
|
||||
import { LICENSE_WHITELIST, DEV_ONLY_LICENSE_WHITELIST, LICENSE_OVERRIDES } from './config';
|
||||
import { assertLicensesValid } from './valid';
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import dedent from 'dedent';
|
||||
import { createFailError } from '../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
|
||||
interface Options {
|
||||
packages: Array<{
|
||||
|
|
|
@ -21,7 +21,7 @@ import { relative, basename } from 'path';
|
|||
|
||||
import { dim } from 'chalk';
|
||||
|
||||
import { createFailError } from '../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
import { matchesAnyGlob } from '../globs';
|
||||
|
||||
import {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import axios, { AxiosError, AxiosResponse } from 'axios';
|
||||
|
||||
import { createFailError } from '../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
|
||||
interface ResponseError extends AxiosError {
|
||||
request: any;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { createFlagError } from '../run';
|
||||
import { createFlagError } from '@kbn/dev-utils';
|
||||
|
||||
const isNum = (input: string) => {
|
||||
return /^\d+$/.test(input);
|
||||
|
|
|
@ -25,8 +25,8 @@ import chalk from 'chalk';
|
|||
import { first, tap } from 'rxjs/operators';
|
||||
import dedent from 'dedent';
|
||||
|
||||
import { run, createFlagError } from '@kbn/dev-utils';
|
||||
import { getLine$ } from './helpers';
|
||||
import { run, createFlagError } from '../run';
|
||||
import { Pr } from './pr';
|
||||
import { GithubApi } from './github_api';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { resolve } from 'path';
|
|||
import json5 from 'json5';
|
||||
import dedent from 'dedent';
|
||||
|
||||
import { run } from '../run';
|
||||
import { run } from '@kbn/dev-utils';
|
||||
import { REPO_ROOT } from '../constants';
|
||||
import { RENOVATE_CONFIG } from './config';
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import globby from 'globby';
|
||||
|
||||
import { run } from './run';
|
||||
import { run } from '@kbn/dev-utils';
|
||||
import { File } from './file';
|
||||
import { REPO_ROOT } from './constants';
|
||||
import { checkFileCasing } from './precommit_hook/check_file_casing';
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import chalk from 'chalk';
|
||||
import Listr from 'listr';
|
||||
|
||||
import { createFailError, run } from '@kbn/dev-utils';
|
||||
import { ErrorReporter, I18nConfig } from './i18n';
|
||||
import {
|
||||
extractDefaultMessages,
|
||||
|
@ -28,7 +29,6 @@ import {
|
|||
checkConfigs,
|
||||
mergeConfigs,
|
||||
} from './i18n/tasks';
|
||||
import { createFailError, run } from './run';
|
||||
|
||||
const skipNoTranslations = ({ config }: { config: I18nConfig }) => !config.translations.length;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import chalk from 'chalk';
|
|||
import Listr from 'listr';
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { createFailError, run } from '@kbn/dev-utils';
|
||||
import { ErrorReporter, serializeToJson, serializeToJson5, writeFileAsync } from './i18n';
|
||||
import { extractDefaultMessages, mergeConfigs } from './i18n/tasks';
|
||||
import { createFailError, run } from './run';
|
||||
|
||||
run(
|
||||
async ({
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
import chalk from 'chalk';
|
||||
import Listr from 'listr';
|
||||
|
||||
import { createFailError, run } from '@kbn/dev-utils';
|
||||
import { ErrorReporter, integrateLocaleFiles } from './i18n';
|
||||
import { extractDefaultMessages, mergeConfigs } from './i18n/tasks';
|
||||
import { createFailError, run } from './run';
|
||||
|
||||
run(
|
||||
async ({
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { run, combineErrors } from './run';
|
||||
import { run, combineErrors } from '@kbn/dev-utils';
|
||||
import * as Eslint from './eslint';
|
||||
import * as Sasslint from './sasslint';
|
||||
import { getFilesForCommit, checkFileCasing } from './precommit_hook';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { run, createFailError } from './run';
|
||||
import { run, createFailError } from '@kbn/dev-utils';
|
||||
import { registerPrecommitGitHook } from './register_git_hook';
|
||||
|
||||
run(async ({ log }) => {
|
||||
|
|
|
@ -21,7 +21,7 @@ import { resolve } from 'path';
|
|||
|
||||
import { toArray } from 'rxjs/operators';
|
||||
|
||||
import { createFailError } from '../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
import { findPluginSpecs } from '../../legacy/plugin_discovery';
|
||||
import { collectUiExports } from '../../legacy/ui';
|
||||
import { buildAll } from '../../legacy/server/sass/build_all';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { run } from '../run';
|
||||
import { run } from '@kbn/dev-utils';
|
||||
import { REPO_ROOT } from '../constants';
|
||||
import { buildSass } from './build_sass';
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import sassLint from 'sass-lint';
|
||||
import path from 'path';
|
||||
import { createFailError } from '../run';
|
||||
import { createFailError } from '@kbn/dev-utils';
|
||||
|
||||
/**
|
||||
* Lints a list of files with eslint. eslint reports are written to the log
|
||||
|
|
|
@ -21,7 +21,7 @@ import { resolve } from 'path';
|
|||
|
||||
import execa from 'execa';
|
||||
|
||||
import { run } from '../run';
|
||||
import { run } from '@kbn/dev-utils';
|
||||
|
||||
const REPO_ROOT = resolve(__dirname, '../../../');
|
||||
import { File } from '../file';
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
import { resolve } from 'path';
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
/* eslint-disable-next-line import/no-extraneous-dependencies */
|
||||
import madge from 'madge';
|
||||
|
||||
import { run, createFailError } from '../../../../../../src/dev/run';
|
||||
/* eslint-disable-next-line import/no-extraneous-dependencies */
|
||||
import { run, createFailError } from '@kbn/dev-utils';
|
||||
|
||||
run(
|
||||
async ({ log }) => {
|
||||
|
|
|
@ -13422,6 +13422,11 @@ getopts@^2.2.4:
|
|||
resolved "https://registry.yarnpkg.com/getopts/-/getopts-2.2.4.tgz#3137fe8a5fddf304904059a851bdc1c22f0f54fb"
|
||||
integrity sha512-Rz7DGyomZjrenu9Jx4qmzdlvJgvrEFHXHvjK0FcZtcTC1U5FmES7OdZHUwMuSnEE6QvBvwse1JODKj7TgbSEjQ==
|
||||
|
||||
getopts@^2.2.5:
|
||||
version "2.2.5"
|
||||
resolved "https://registry.yarnpkg.com/getopts/-/getopts-2.2.5.tgz#67a0fe471cacb9c687d817cab6450b96dde8313b"
|
||||
integrity sha512-9jb7AW5p3in+IiJWhQiZmmwkpLaR/ccTWdWQCtZM66HJcHHLegowh4q4tSD7gouUyeNvFWRavfK9GXosQHDpFA==
|
||||
|
||||
getos@3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/getos/-/getos-3.1.1.tgz#967a813cceafee0156b0483f7cffa5b3eff029c5"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue