Skip to content

Allow an absolute path as dist directory#318

Merged
tschaub merged 2 commits intotschaub:masterfrom
okuryu:dist
Jan 7, 2020
Merged

Allow an absolute path as dist directory#318
tschaub merged 2 commits intotschaub:masterfrom
okuryu:dist

Conversation

@okuryu
Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
Owner

tschaub commented Jan 7, 2020

Thanks @okuryu and @ftm.

@tschaub
Copy link
Copy Markdown
Owner

tschaub commented Jan 7, 2020

Published with gh-pages@2.2.0.

@okuryu
Copy link
Copy Markdown
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