Skip to content

Commit

Permalink
fix: compatibility with new PNPM path
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Nov 26, 2023
1 parent 7d60928 commit efcbe83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down

0 comments on commit efcbe83

Please sign in to comment.