depatcher 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,9 @@ const PACKAGE_MANAGER_MAP = {
|
|
|
13
13
|
patchCommit: "pnpm patch-commit"
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
+
function detectPackageManager() {
|
|
17
|
+
return process.env.npm_config_user_agent.match(/^[^/]+/)[0];
|
|
18
|
+
}
|
|
16
19
|
function run(command) {
|
|
17
20
|
console.log(`> ${command}`);
|
|
18
21
|
return execSync(command, {
|
|
@@ -21,7 +24,7 @@ function run(command) {
|
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
async function applyPatch_(packageName, patchMap) {
|
|
24
|
-
const packageManager =
|
|
27
|
+
const packageManager = detectPackageManager();
|
|
25
28
|
console.log(`🔄 Start patching "${packageName}"`);
|
|
26
29
|
const tempDir = run(`${PACKAGE_MANAGER_MAP[packageManager].patch} ${packageName}`).split("\n")[1].slice(49);
|
|
27
30
|
for (const [originalFile, patchPath] of Object.entries(patchMap)) {
|