- Download and create all required files.
- Generate technical repo files. #Create Block from registry.
This commit is contained in:
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "<%= blockGroupName %>/<%= blockFilename %>",
|
||||
"version": "1.0.0",
|
||||
"version": "<%= version %>",
|
||||
"title": "<%= title %>",
|
||||
"categories": [],
|
||||
"icon": "shortcode",
|
||||
|
||||
Reference in New Issue
Block a user