package.dist.packageIsDevDependency.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of patch-package Show documentation
Show all versions of patch-package Show documentation
Fix broken node modules with no fuss
The newest version!
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageIsDevDependency = void 0;
const path_1 = require("./path");
const fs_1 = require("fs");
function packageIsDevDependency({ appPath, patchDetails, }) {
const packageJsonPath = path_1.join(appPath, "package.json");
if (!fs_1.existsSync(packageJsonPath)) {
return false;
}
const { devDependencies } = require(packageJsonPath);
return Boolean(devDependencies && devDependencies[patchDetails.packageNames[0]]);
}
exports.packageIsDevDependency = packageIsDevDependency;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZUlzRGV2RGVwZW5kZW5jeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9wYWNrYWdlSXNEZXZEZXBlbmRlbmN5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLGlDQUE2QjtBQUM3QiwyQkFBK0I7QUFFL0IsU0FBZ0Isc0JBQXNCLENBQUMsRUFDckMsT0FBTyxFQUNQLFlBQVksR0FJYjtJQUNDLE1BQU0sZUFBZSxHQUFHLFdBQUksQ0FBQyxPQUFPLEVBQUUsY0FBYyxDQUFDLENBQUE7SUFDckQsSUFBSSxDQUFDLGVBQVUsQ0FBQyxlQUFlLENBQUMsRUFBRTtRQUNoQyxPQUFPLEtBQUssQ0FBQTtLQUNiO0lBQ0QsTUFBTSxFQUFFLGVBQWUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxlQUFlLENBQUMsQ0FBQTtJQUNwRCxPQUFPLE9BQU8sQ0FDWixlQUFlLElBQUksZUFBZSxDQUFDLFlBQVksQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FDakUsQ0FBQTtBQUNILENBQUM7QUFmRCx3REFlQyIsInNvdXJjZXNDb250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