Skip to content

Commit

Permalink
fix: add module aware package dir determination
Browse files Browse the repository at this point in the history
  • Loading branch information
dv-usama-ansari committed Feb 23, 2024
1 parent 3e2bc72 commit 8fedbca
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/postinstall-mantine-6-interoperability.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const fs = require('fs');
const path = require('path');

// Define the directory of the package
const packageDir = path.join(__dirname, '..','node_modules', '@mantine6');
// Check if __dirname contains a node_modules directory
const nodeModulesIndex = __dirname.indexOf('node_modules');
const packageDir =
nodeModulesIndex !== -1
? path.join(__dirname.slice(0, nodeModulesIndex), 'node_modules', '@mantine6')
: path.join(__dirname, '..', 'node_modules', '@mantine6');

// Define a recursive function to read directories and files
function replaceInFiles(dir) {
Expand All @@ -22,4 +26,4 @@ function replaceInFiles(dir) {
}

// Call the function on the package directory
replaceInFiles(packageDir);
replaceInFiles(packageDir);

0 comments on commit 8fedbca

Please sign in to comment.