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 path resolution helpers #687

Closed
SBoudrias opened this issue Oct 29, 2014 · 2 comments
Closed

Add path resolution helpers #687

SBoudrias opened this issue Oct 29, 2014 · 2 comments

Comments

@SBoudrias
Copy link
Member

Using the new file system, I opted to not automatically resolves path. I think experiences this year proved me it's better to be a bit more descriptive than hiding too much logic behind the scene.

Although this doesn't mean we should be super verbose all the time:

this.fs.copy(
  path.join(this.sourceRoot(), 'fileA.js'),
  path.join(this.destinationRoot(), 'fileB.js'),
)

So we want helper methods to join paths with source, destination, cache (and remote or are they the same?).

I'm also unsure the vocabulary we use is the best. "source" is actually the template/ directory, and destination is the project folder. So, should we be more semantic in the way we name them?

this.templatePath('/fileA.js');
this.projectPath('fileB.js');

I'd like your opinion on that!

@sindresorhus
Copy link
Member

this.fs.copy(
  [this.sourceRoot(), 'fileA.js'],
  [this.destinationRoot(), 'fileB.js']
)

Maybe accept an array in src/dest which are path.join'd?

@SBoudrias
Copy link
Member Author

I'm not sure passing array would be very intuitive. I added this.templatePath() and this.destinationPath() helpers methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants