recursive-copy icon indicating copy to clipboard operation
recursive-copy copied to clipboard

Something broke with release 2.0.12 using 11ty

Open awaragi opened this issue 4 years ago • 4 comments

Hey. Not sure what happened but a yarn upgrade on my existing and currently working 11ty site now is causing errors.

Error with passthrough copy: (more in DEBUG output)
> Having trouble copying './src/images'

`TemplatePassthroughManagerCopyError` was thrown
> Cannot read property 'sort' of undefined

`TypeError` was thrown:
    TypeError: Cannot read property 'sort' of undefined
        at xxx/node_modules/@11ty/eleventy/node_modules/recursive-copy/lib/copy.js:90:8
        at async Promise.all (index 0)
Unhandled rejection in promise ([object Promise]): (more in DEBUG output)
> Having trouble copying

`TemplateWriterWriteError` was thrown
> Having trouble copying './src/images'

`TemplatePassthroughManagerCopyError` was thrown
> Cannot read property 'sort' of undefined

`TypeError` was thrown:
    TypeError: Cannot read property 'sort' of undefined
        at xxx/node_modules/@11ty/eleventy/node_modules/recursive-copy/lib/copy.js:90:8
        at async Promise.all (index 0)

I tried debugging by going step by step in the code and the files are actually copied and only at the following code that it fails with results being undefined

				.then(function(results) {
					return results
						.sort(function (a, b) { return a.index - b.index; })
						.map(function(result) { return result.value; });
				});

The recursive-copy is only used in following code:

    eleventyConfig.addPassthroughCopy({'src/images': 'images'});

For now I am happy with my yarn.lock which ensure that my current build is wokring but eventually hope to be able to do upgrade successfuly.

If you need any details let me know. If I find something in the mean time I will post it here.

awaragi avatar Jun 27 '21 22:06 awaragi

Thanks for the excellent bug report, I can only apologise for this - this must have been due to a change I released a few hours ago that changes the order in which output directories are created. I thought the test suite covered all the likely scenarios but apparently not.

For the time being I've released v2.0.13 which reverts the change, so if you upgrade to the latest version that should be working again.

I'll make sure to add some more tests that replicate this issue before touching anything else; I'll leave this issue open though and will make sure to push a pre-release version next time!

timkendrick avatar Jun 27 '21 22:06 timkendrick

Wow. thanks for the excellent response time. I confirm that the 2.0.13 the failure is no longer there. If you ever want me to test out a new version let me know.

awaragi avatar Jun 27 '21 22:06 awaragi

Thanks, I might take you up on that offer for testing a prerelease - I'll also catch up with how 11ty are using this library to make sure that there are no more of these breaking changes in future.

I'll make sure to update this issue once I'm ready to roll out a fix.

timkendrick avatar Jun 27 '21 23:06 timkendrick

Is this still an issue with latest (2.0.14)?

Zearin avatar Apr 13 '24 15:04 Zearin