Skip to content

Commit

Permalink
updated tables
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmaguitar committed Nov 7, 2023
1 parent 6448c02 commit 10518ee
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 57 deletions.
30 changes: 15 additions & 15 deletions README.md

Large diffs are not rendered by default.

22 changes: 19 additions & 3 deletions bin/updateTableMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@ const { join } = require("path");
const fs = require('fs');

const generateExamplesTableMarkdown = require("./copyGutenbergExample/generateExamplesTableMarkdown.js");
const examplesJson = require("../data/examples.json");
const slug = process.argv[2];
const rootPath = process.cwd();
let readmePath;

if (slug) {
slug
if (slug == 'all') {
const pluginsFolderNames = examplesJson.map(({slug}) => slug)
pluginsFolderNames.forEach(plugin => {
const pluginPath = join(rootPath, "plugins", plugin);
if (!fs.existsSync(pluginPath)) throw `plugin path doesn't exist: ${pluginPath}`;
readmePath = join(pluginPath, "README.md");
if (!fs.existsSync(readmePath)) throw `readme path doesn't exist: ${readmePath}`;
generateExamplesTableMarkdown({slug: plugin, readmePath});
});
generateExamplesTableMarkdown({readmePath: join(rootPath, "README.md")});
return;
}
else if (slug && slug !== 'all') {
const pluginPath = join(rootPath, "plugins", slug);
if (!fs.existsSync(pluginPath)) throw `plugin path doesn't exist: ${pluginPath}`;
readmePath = join(pluginPath, "README.md");
console.log({slug, readmePath})
if (!fs.existsSync(readmePath)) throw `readme path doesn't exist: ${readmePath}`;
generateExamplesTableMarkdown({slug, readmePath});
return;
}

generateExamplesTableMarkdown({slug, readmePath});
generateExamplesTableMarkdown({readmePath: join(rootPath, "README.md")});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"postcreate-example:new": "pnpm i",
"get:hexcode": "node ./bin/randomHexCode.js",
"table:update": "node ./bin/updateTableMarkdown.js",
"table:update:all": "node ./bin/updateTableMarkdown.js -- all",
"zips:remove": "rimraf --verbose ./plugins/*/@block-development-examples",
"zips:move": "copyfiles --verbose --flat './plugins/**/*.zip' zips",
"deploy": "npm run build && npm run plugin-zip && make-dir zips && npm run zips:move && npm run zips:remove"
Expand Down
6 changes: 3 additions & 3 deletions plugins/basic-block-translations-3df23d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<!-- Please, do not remove these @TABLE EXAMPLES BEGIN and @TABLE EXAMPLES END comments or modify the table inside. This table is automatically generated from the data at data/examples.json and data/tags.json -->
<!-- @TABLE EXAMPLES BEGIN -->
| Folder | <span style="display: inline-block; width:250px">Short description</span> | Tags | ID ([❓](https://github.com/wptrainingteam/block-development-examples/wiki/04-Why-an-ID-for-every-example%3F "Why an ID for every example?")) | Download .zip | Live Demo |
| -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [📁](https://github.com/wptrainingteam/block-development-examples/tree/trunk/plugins/basic-block-translations-3df23d) | Basic Block with Translations | <small><code><a href="https://github.com/wptrainingteam/block-development-examples/wiki/03-Tags#static-rendering">STATIC RENDERING</a></code></small> | `3df23d` | [📦](https://raw.githubusercontent.com/wptrainingteam/block-development-examples/deploy/zips/basic-block-translations-3df23d.zip "Install the plugin using this zip and activate it. Then use the ID of the block (3df23d) to find it and add it to a post to see it in action") | [![](https://raw.githubusercontent.com/wptrainingteam/block-development-examples/trunk/assets/icon-wp.svg)](https://playground.wordpress.net/#%7B%22landingPage%22:%22/wp-admin/plugins.php%22,%22steps%22:%5B%7B%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22%7D,%7B%22step%22:%22mkdir%22,%22path%22:%22/downloads%22%7D,%7B%22step%22:%22writeFile%22,%22path%22:%22/downloads/plugin.zip%22,%22data%22:%7B%22resource%22:%22url%22,%22url%22:%22https://raw.githubusercontent.com/wptrainingteam/block-development-examples/deploy/zips/basic-block-translations-3df23d.zip%22,%22caption%22:%22Downloading%20plugin...%22%7D%7D,%7B%22step%22:%22installPlugin%22,%22pluginZipFile%22:%7B%22resource%22:%22vfs%22,%22path%22:%22/downloads/plugin.zip%22%7D%7D%5D%7D "Use the ID of the block (3df23d) to find it and add it to a post to see it in action") |
| Folder | <span style="display: inline-block; width:250px">Short description</span> | Tags | ID ([❓](https://github.com/wptrainingteam/block-development-examples/wiki/04-Why-an-ID-for-every-example%3F "Why an ID for every example?")) | Download .zip | Live Demo |
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [📁](https://github.com/wptrainingteam/block-development-examples/tree/trunk/plugins/basic-block-translations-3df23d) | Basic Block with Translations | <small><code><a href="https://github.com/wptrainingteam/block-development-examples/wiki/03-Tags#static-rendering">STATIC RENDERING</a></code></small> | `3df23d` | [📦](https://raw.githubusercontent.com/wptrainingteam/block-development-examples/deploy/zips/basic-block-translations-3df23d.zip "Install the plugin using this zip and activate it. Then use the ID of the block (3df23d) to find it and add it to a post to see it in action") | [![](https://raw.githubusercontent.com/wptrainingteam/block-development-examples/trunk/assets/icon-wp.svg)](https://playground.wordpress.net/#%7B%22landingPage%22:%22/wp-admin/plugins.php%22,%22steps%22:%5B%7B%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22%7D,%7B%22step%22:%22mkdir%22,%22path%22:%22/downloads%22%7D,%7B%22step%22:%22writeFile%22,%22path%22:%22/downloads/plugin.zip%22,%22data%22:%7B%22resource%22:%22url%22,%22url%22:%22https://raw.githubusercontent.com/wptrainingteam/block-development-examples/deploy/zips/basic-block-translations-3df23d.zip%22,%22caption%22:%22Downloading%20plugin...%22%7D%7D,%7B%22step%22:%22installPlugin%22,%22pluginZipFile%22:%7B%22resource%22:%22vfs%22,%22path%22:%22/downloads/plugin.zip%22%7D%7D%5D%7D "Use the ID of the block (3df23d) to find it and add it to a post to see it in action") |
<!-- @TABLE EXAMPLES END -->

Basic block that shows how to use translations in a block.
Expand Down
Loading

0 comments on commit 10518ee

Please sign in to comment.