webalys-hq / streamlinehq-npm

The deprecated Streamline NPM package, which will be deleted on 1st November 2022.
https://medium.com/streamline-icons/how-streamline-narrows-down-its-focus-eac6fdb5c6f2
24 stars 5 forks source link

Resolve project root through process.cwd() #43

Closed kesne closed 3 years ago

kesne commented 3 years ago

This changes to resolve the project root through process.cwd(), which is a much more reliable way to resolve it. I tested locally and this seems to work. This should also fix #20 and #22.

height[bot] commented 3 years ago

Link Height tasks by mentioning a task ID in the pull request title or description, commit messages, or comments.

đź’ˇTip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

timc13 commented 3 years ago

đź‘Ť to this change. what's holding this back?

cbrwizard commented 3 years ago

Thank you for opening this pr, but unfortunately it doesn't seem to work right. The goal is in the install.ts script to tell dotenv to read .env file in the parent project folder. process.cwd() will return the path to the npm package project folder. Needed result: /apps/streamline/streamlinehq/docs/latest/example-app/node_modules/@streamlinehq/streamlinehq/build/../../../.. Result from process.cwd(): /apps/streamline/streamlinehq/docs/latest/example-app/node_modules/@streamlinehq/streamlinehq

I wish there was a function which would return /apps/streamline/streamlinehq/docs/latest/example-app when called from the install script inside the npm package, but this doesn't seem to exist. Looks like the solution here is to set the path via an env var which is set outside of .env file

kesne commented 3 years ago

Interestingly, this seemed to work fine for me. I wonder if different package managers (npm vs yarn vs pnpm) have different behavior around this? I unfortunately don’t have time to work on or debug this so I’ll just going to close this out.

cbrwizard commented 3 years ago

Please check out my implementation of this https://github.com/webalys-hq/streamlinehq-npm/pull/45. Maybe there is a cleaner way?

cbrwizard commented 3 years ago

Hey, please check if this release solves your problem https://github.com/webalys-hq/streamlinehq-npm/releases/tag/3.0.4