- Download and create all required files.

- Generate technical repo files.
#Create Block from registry.
This commit is contained in:
2022-10-04 18:11:08 +03:00
parent 30a3e964bd
commit ee197d24c4
6 changed files with 126 additions and 41 deletions
+2 -7
View File
@@ -71,6 +71,7 @@ export default class extends Generator {
const group = capitalize(this.data.group);
const data = Object.assign(this.data, {
title,
version: '1.0.0',
blockFilename: title.toLowerCase().replace(/ /ig, '-'),
blockGroupName: group.toLowerCase().replace(/ /ig, '-'),
blockClassName: title.toLowerCase().replace(/ /ig, '_'),
@@ -78,12 +79,6 @@ export default class extends Generator {
const pathDist = path.join(baseDir, 'blocks', data.blockFilename);
this.fs.copyTpl(
this.templatePath('block.json'),
this.destinationPath(path.join(pathDist, 'block.json')),
data
);
this.fs.copyTpl(
this.templatePath('config/default.cjs'),
this.destinationPath(path.join(pathDist, 'config', 'default.cjs')),
@@ -144,7 +139,7 @@ export async function createTechnicalFiles(data, baseDir) {
const store = memFs.create();
const filesystem = editor.create(store);
const files = ['package.json', 'README.md', '.editorconfig', '.gitignore'];
const files = ['package.json', 'README.md', '.editorconfig', '.gitignore', 'block.json'];
for (let file of files) {
await filesystem.copyTplAsync(
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "<%= blockGroupName %>/<%= blockFilename %>",
"version": "1.0.0",
"version": "<%= version %>",
"title": "<%= title %>",
"categories": [],
"icon": "shortcode",