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

Allow an absolute path as dist directory #318

Merged
merged 2 commits into from Jan 7, 2020
Merged

Conversation

okuryu
Copy link
Contributor

@okuryu okuryu commented Oct 4, 2019

It allows using an absolute path to start with / as the dist directory. The use case is it can be used the dist directory as a path not be under the current directory.

It might be a breaking change because of behavior changes on a pass a path to start with /. Please bump a major version if needed.

Fixes: #317

Copy link

@ftm ftm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of manually handling the absolute path case, you could consider using path.resolve instead of path.join:

> process.cwd()
'/home/user'
> path.join(process.cwd(), "/tmp/hello")
'/home/user/tmp/hello'  // incorrect, just joins the paths together in a platform-agnostic way
> path.resolve(process.cwd(), "/tmp/hello")
'/tmp/hello'  // correct, actually resolves the absolute path
> path.resolve(process.cwd(), "tmp/hello")
'/home/user/tmp/hello'

@okuryu
Copy link
Contributor Author

okuryu commented Dec 6, 2019

@ftm Good catch! I just have changed.

@tschaub tschaub merged commit 5bf8204 into tschaub:master Jan 7, 2020
@tschaub
Copy link
Owner

tschaub commented Jan 7, 2020

Thanks @okuryu and @ftm.

@tschaub
Copy link
Owner

tschaub commented Jan 7, 2020

Published with gh-pages@2.2.0.

@okuryu
Copy link
Contributor Author

okuryu commented Jan 7, 2020

Thanks!

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.

absolute path as base directory (-d option)
3 participants