content icon indicating copy to clipboard operation
content copied to clipboard

Stop build with unsupported filenames

Open KidSysco opened this issue 2 months ago • 1 comments

Environment

Not needed.

Reproduction

Not needed.

Describe the bug

When there are .ts files in the content folder, we get a warning message in the Build console output from line 47 of content/src/runtime/transformers/index.ts...

https://github.com/nuxt/content/blob/f753723d3cd4d8f8a92d050b9be59489c522c35f/src/runtime/transformers/index.ts#L47

Perhaps this should throw an error to stop the build and force it to break.

Otherwise, here is the scenario that played out today, and could break production builds for others too...

When developing in dev mode, there is no warning about putting .ts files in the content folder. Everything just works perfectly. There are also no docs about keeping .ts files in the content folder.

When doing a build there is no error, only this one warning (from line 47) that is embedded within thousands of lines of build output, and the build does not fail.

CI or Devops thinks all is good. So they deploy the site to production where the website totally breaks because it cannot find the code it needs.

Additional context

If we don't stop the build when things are not correct, then it can lead to broken websites getting deployed to production. We should also add to the docs about unsupported file extensions in the content folder.

Logs

Not needed.

KidSysco avatar Apr 11 '24 13:04 KidSysco

Why did I have .ts files in the content folder?

Because we are implementing I18n, which calls for language files. While these files are TS, they look, and feel a lot like typical content files. So we figured the content folder was a really good fit. It worked perfectly in dev, broke badly in production.

KidSysco avatar Apr 11 '24 13:04 KidSysco