| 1 | "use strict";
|
|---|
| 2 | // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|---|
| 3 | // See LICENSE in the project root for license information.
|
|---|
| 4 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
|---|
| 5 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
|---|
| 6 | };
|
|---|
| 7 | Object.defineProperty(exports, "__esModule", { value: true });
|
|---|
| 8 | exports.findAndConsoleLogPatchPathCli = findAndConsoleLogPatchPathCli;
|
|---|
| 9 | exports.getPathToLinterJS = getPathToLinterJS;
|
|---|
| 10 | exports.ensurePathToGeneratedPatch = ensurePathToGeneratedPatch;
|
|---|
| 11 | const node_fs_1 = __importDefault(require("node:fs"));
|
|---|
| 12 | const node_os_1 = __importDefault(require("node:os"));
|
|---|
| 13 | const _patch_base_1 = require("../_patch-base");
|
|---|
| 14 | const constants_1 = require("./constants");
|
|---|
| 15 | const package_json_1 = __importDefault(require("../../package.json"));
|
|---|
| 16 | const CURRENT_PACKAGE_VERSION = package_json_1.default.version;
|
|---|
| 17 | function findAndConsoleLogPatchPathCli() {
|
|---|
| 18 | const eslintBulkDetectEnvVarValue = process.env[constants_1.ESLINT_BULK_DETECT_ENV_VAR_NAME];
|
|---|
| 19 | if (eslintBulkDetectEnvVarValue !== 'true' && eslintBulkDetectEnvVarValue !== '1') {
|
|---|
| 20 | return;
|
|---|
| 21 | }
|
|---|
| 22 | const configuration = {
|
|---|
| 23 | /**
|
|---|
| 24 | * `@rushstack/eslint-bulk` should report an error if its package.json is older than this number
|
|---|
| 25 | */
|
|---|
| 26 | minCliVersion: '0.0.0',
|
|---|
| 27 | /**
|
|---|
| 28 | * `@rushstack/eslint-bulk` will invoke this entry point
|
|---|
| 29 | */
|
|---|
| 30 | cliEntryPoint: require.resolve('../exports/eslint-bulk')
|
|---|
| 31 | };
|
|---|
| 32 | console.log(constants_1.ESLINT_BULK_STDOUT_START_DELIMETER + JSON.stringify(configuration) + constants_1.ESLINT_BULK_STDOUT_END_DELIMETER);
|
|---|
| 33 | }
|
|---|
| 34 | function getPathToLinterJS() {
|
|---|
| 35 | if (!_patch_base_1.eslintFolder) {
|
|---|
| 36 | throw new Error('Cannot find ESLint installation to patch.');
|
|---|
| 37 | }
|
|---|
| 38 | return `${_patch_base_1.eslintFolder}/lib/linter/linter.js`;
|
|---|
| 39 | }
|
|---|
| 40 | function ensurePathToGeneratedPatch() {
|
|---|
| 41 | const patchesFolderPath = `${node_os_1.default.tmpdir()}/rushstack-eslint-bulk-${CURRENT_PACKAGE_VERSION}/patches`;
|
|---|
| 42 | node_fs_1.default.mkdirSync(patchesFolderPath, { recursive: true });
|
|---|
| 43 | const pathToGeneratedPatch = `${patchesFolderPath}/linter-patch-v${_patch_base_1.eslintPackageVersion}.js`;
|
|---|
| 44 | return pathToGeneratedPatch;
|
|---|
| 45 | }
|
|---|
| 46 | //# sourceMappingURL=path-utils.js.map |
|---|