UNPKG

@rxap/plugin-library

Version:

This package provides generators and executors for managing and maintaining Nx plugin libraries. It includes functionality for generating index exports, fixing dependencies, generating JSON schemas, and more. It helps streamline the development process fo

53 lines 2.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = runExecutor; const tslib_1 = require("tslib"); const plugin_utilities_1 = require("@rxap/plugin-utilities"); const semver_1 = require("semver"); function runExecutor(options, context) { return tslib_1.__awaiter(this, void 0, void 0, function* () { var _a, _b, _c; console.log('Executor ran for CheckVersion', options); const projectJson = yield (0, plugin_utilities_1.readPackageJsonForProjectWithRetry)(context); const rootPackageJson = yield (0, plugin_utilities_1.readRootPackageJson)(context); let targetVersion = (_b = (_a = rootPackageJson.devDependencies) === null || _a === void 0 ? void 0 : _a[options.packageName]) !== null && _b !== void 0 ? _b : (_c = rootPackageJson.dependencies) === null || _c === void 0 ? void 0 : _c[options.packageName]; if (!targetVersion) { console.error(`The package ${options.packageName} is not installed in the root package.json`); return { success: false, }; } targetVersion = targetVersion.replace(/^[~^]/, ''); console.log(`Current '${options.packageName}' version: ${targetVersion}`); console.log(`Project version: ${projectJson.version}`); const version = (0, semver_1.parse)(targetVersion); if (!version) { console.error(`Can't parse version: ${targetVersion}`); return { success: false, }; } const versionRange = `>=${version.major}`; if (!projectJson.version) { console.error(`The project version is not defined`); return { success: false, }; } const normalizedVersion = projectJson.version.replace(/-.*$/, ''); if (!(0, semver_1.satisfies)(normalizedVersion, versionRange)) { console.error(`The project version '${projectJson.version}' normalized '${normalizedVersion}' is not compatible with the '${options.packageName}' version '${targetVersion}' with the range '${versionRange}'`); if (process.env.WORKSPACE_UPGRADE) { console.warn('Detecting workspace upgrade mode'); return { success: true }; } return { success: false, }; } return { success: true, }; }); } //# sourceMappingURL=executor.js.map