Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basePath option #18

Merged
merged 13 commits into from
Jun 13, 2020
Merged

Add basePath option #18

merged 13 commits into from
Jun 13, 2020

Conversation

silverwind
Copy link
Contributor

@silverwind silverwind commented Jun 8, 2020

Decided to implement #17 as it'd be rather useful to have the ability to convert irrelevant absolute paths in stack traces to relative ones. It also gives me a tiny security benefit of not having to reveal absolute paths.

The implementation is basically a string replacement, no path resolution is attempted and trailing slash handling is also left to the user. In the simplest use case, one would specify basePath: __dirname in a file in the project root to get all paths below it trimmed.

basePath is applied before pretty because it yields shorter paths which should be preferred (unless the user runs the script inside their home directory).

readme.md Outdated Show resolved Hide resolved
test.js Outdated Show resolved Hide resolved
test.js Outdated Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
@sindresorhus sindresorhus changed the title add basePath option Add basePath option Jun 9, 2020
silverwind and others added 4 commits June 9, 2020 11:09
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
silverwind and others added 6 commits June 11, 2020 11:09
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
@silverwind
Copy link
Contributor Author

all done, thanks

@sindresorhus sindresorhus merged commit 3a5a101 into sindresorhus:master Jun 13, 2020
@silverwind silverwind deleted the basepath branch June 13, 2020 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants