Skip to content

Display a warning when calling "copyFiles" with an invalid path #456

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

Merged
merged 2 commits into from
Dec 13, 2018

Conversation

Lyrkan
Copy link
Collaborator

@Lyrkan Lyrkan commented Nov 16, 2018

This PR adds a warning when copyFiles() is called with a from value that isn't an existing directory.

This is kind of related to #445 but even if the friendly-errors-webpack-plugin worked properly in this case the origin of the error would probably not be obvious (it'd most likely contain a reference to the temporary entry).

);

if (!fs.existsSync(copyFrom) || !fs.lstatSync(copyFrom).isDirectory()) {
logger.warning(`The "from" option of copyFiles() should be set to an existing directory but "${entry.from}" does not seem to be one. No file will be copied for this entry.`);
Copy link
Member

Choose a reason for hiding this comment

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

"entry" might not be the best word here... because it means something else

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm, maybe... by "entry" I meant "config entry", would it be better to put that?

entry.from
);

if (!fs.existsSync(copyFrom) || !fs.lstatSync(copyFrom).isDirectory()) {
Copy link
Member

Choose a reason for hiding this comment

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

I guess we could break these into 2 separate pieces: 1 error is that the path doesn't exist. Another error is that they've pointed directly to a single file, not a directory, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

@weaverryan
Copy link
Member

Thanks @Lyrkan!

@weaverryan weaverryan merged commit 5161d30 into symfony:master Dec 13, 2018
weaverryan added a commit that referenced this pull request Dec 13, 2018
…ath (Lyrkan)

This PR was squashed before being merged into the master branch (closes #456).

Discussion
----------

Display a warning when calling "copyFiles" with an invalid path

This PR adds a warning when `copyFiles()` is called with a `from` value that isn't an existing directory.

This is kind of related to #445 but even if the friendly-errors-webpack-plugin worked properly in this case the origin of the error would probably not be obvious (it'd most likely contain a reference to the temporary entry).

Commits
-------

5161d30 Display a different warning when trying to copy from an unexisting directory or an invalid one
8cb9d4a Display a warning when calling "copyFiles" with an invalid path
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