Skip to content

Commit 5161d30

Browse files
committed
Display a different warning when trying to copy from an unexisting directory or an invalid one
1 parent 8cb9d4a commit 5161d30

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/config-generator.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,13 @@ class ConfigGenerator {
154154
entry.from
155155
);
156156

157-
if (!fs.existsSync(copyFrom) || !fs.lstatSync(copyFrom).isDirectory()) {
158-
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.`);
157+
if (!fs.existsSync(copyFrom)) {
158+
logger.warning(`The "from" option of copyFiles() should be set to an existing directory but "${entry.from}" does not seem to exist. Nothing will be copied for this copyFiles() config object.`);
159+
return false;
160+
}
161+
162+
if (!fs.lstatSync(copyFrom).isDirectory()) {
163+
logger.warning(`The "from" option of copyFiles() should be set to an existing directory but "${entry.from}" seems to be a file. Nothing will be copied for this copyFiles() config object.`);
159164
return false;
160165
}
161166

test/functional.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ module.exports = {
16211621
to: 'assets/[path][name].[ext]',
16221622
includeSubdirectories: false
16231623
}, {
1624-
from: './bar/baz',
1624+
from: './images/symfony_logo.png',
16251625
includeSubdirectories: true
16261626
}]);
16271627

@@ -1634,8 +1634,8 @@ module.exports = {
16341634
'manifest.json'
16351635
]);
16361636

1637-
expect(stdout).to.contain('should be set to an existing directory but "./foo" does not seem to be one');
1638-
expect(stdout).to.contain('should be set to an existing directory but "./bar/baz" does not seem to be one');
1637+
expect(stdout).to.contain('should be set to an existing directory but "./foo" does not seem to exist');
1638+
expect(stdout).to.contain('should be set to an existing directory but "./images/symfony_logo.png" seems to be a file');
16391639

16401640
done();
16411641
});

0 commit comments

Comments
 (0)