Skip to content

Commit

Permalink
Add upgrade helper for 11ty/eleventy#3255
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jul 23, 2024
1 parent c9530ca commit ffdade8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(require("./src/explicit-config-file.js"));
eleventyConfig.addPlugin(require("./src/html-output-suffix.js"));
eleventyConfig.addPlugin(require("./src/alias-template-formats.js"));
eleventyConfig.addPlugin(require("./src/empty-formats.js"));

eleventyConfig.on("eleventy.after", () => {
console.log(chalk.blue(`[${pkg.name}] This plugin is intended for temporary use: once you’re satisfied please remove this plugin from your project!`));
Expand Down
17 changes: 17 additions & 0 deletions src/empty-formats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require("node:fs");
const chalk = require("kleur");
const pkg = require("../package.json");

const minimist = require("minimist");

const argv = minimist(process.argv.slice(2), {
string: ["formats"]
});

module.exports = function(eleventyConfig) {
if(argv.formats || argv.formats === undefined) {
console.log(chalk.green(`[${pkg.name}] PASSED`), `You aren’t using \`--formats=\` or \`--formats=''\` but if you were you should know that these are now empty template format sets. In previous versions, they were aliased to "*". Read more: https://github.com/11ty/eleventy/issues/3255`);
} else if(argv.formats === "" || argv.formats === null) {
console.log(chalk.red(`[${pkg.name}] ERROR`), `In Eleventy 3.0 \`--formats=""\` and \`formats=\` are empty template format sets. Previous versions aliased these to "*". Use \`--formats=*\` if you want that behavior in 3.0. Read more: https://github.com/11ty/eleventy/issues/3255`);
}
};

0 comments on commit ffdade8

Please sign in to comment.