diff --git a/README.md b/README.md index 1fe5b0c..c7e61d0 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ With that setup the file is updated when `npm start` and `npm build` are run. | --root | root directory where your package.json is located | . | | --file | relative location of the output file (based on the root directory) | ./src/_versions.ts | false | | --git | relative location of the folder containing the .git folder (based on the root directory) | . | -| --pnpm | PNPM has a different folder structure, resulting in a different root level. Add this if you use PNPM to install your dependencies. If package.json is not found at the expected PNPM path, it will fall back to the default one. This setting is ignored if `--root` is an absolute path. | false | | --set-version | Set this to override the value of the version string fetched from package.json (set in `version` property) | | ## Receiving the versions diff --git a/dist/index.js b/dist/index.js index b1ba869..64713d8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -19,7 +19,11 @@ if (path.isAbsolute(rootPath)) { projectLocations.push(path.join(__dirname, rootPath)); // if loaded from node_modules folder, step back a few levels - if (__dirname.match('/.*node_modules\/@saithodev\/ts-appversion.*/')) { + if (__dirname.match(/.*node_modules\/.pnpm\/@saithodev\+ts-appversion.*/)) { + projectLocations.unshift( + path.join(__dirname, '..', '..', '..', rootPath) + ); + } else if (__dirname.match('/.*node_modules\/@saithodev\/ts-appversion.*/')) { projectLocations.unshift( path.join(__dirname, '..', '..', '..', '..', rootPath) );