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

Breaking change: copy => fs.copy does not work as expected (ignores sourceRoot) #1037

Closed
evil-shrike opened this issue Sep 6, 2017 · 1 comment
Labels

Comments

@evil-shrike
Copy link

As continue #901

Previously there was copy method which assumed files inside sourceRoot. Now the method was removed (not documented anywhere), and using fs object is suggested (http://yeoman.io/authoring/file-system.html)

was working:

this.copy('path/to/file', 'path/to/file');

now failing, as there's no copy method now.
If change it to fs.copy:

this.fs.copy('path/to/file', 'path/to/file');

it's still failing, now inside mem-fs-editor\lib\actions\copy.js: AssertionError: Trying to copy from a source that does not exist: path/to/file

It turns out fs.copy ignores template path (sourceRoot).
So I have to add templatePath for the source file:

this.fs.copy(this.templatePath('path/to/file'), 'path/to/file');

very annoying as requires specifying templatePath for fs.copy call.
And it's also undocumented.

Also there are outdated and incorrect comment in code for sourceRoot - see https://github.com/yeoman/generator/blob/master/lib/index.js#L586

  /**
   * Change the generator source root directory.
   * This path is used by multiples file system methods like (`this.read` and `this.copy`)
   * @param  {String} rootPath new source root path
   * @return {String}          source root path
   */
sourceRoot(rootPath) 
@github-actions
Copy link
Contributor

github-actions bot commented Jan 1, 2020

This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the stale label Jan 1, 2020
@github-actions github-actions bot closed this as completed Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant