34 lines
741 B
JavaScript
34 lines
741 B
JavaScript
const fs = require('fs');
|
|
|
|
const blocks = [
|
|
'HomeHero',
|
|
'HomeProductCategories',
|
|
'HomeWhatWeDo',
|
|
'HomeRecentPosts',
|
|
'HomeExperience',
|
|
'HomeWhyChooseUs',
|
|
'HomeMeetTheTeam',
|
|
'HomeVideo',
|
|
];
|
|
|
|
blocks.forEach(name => {
|
|
const content = `import { Block } from 'payload';
|
|
|
|
export const ${name}: Block = {
|
|
slug: '${name.charAt(0).toLowerCase() + name.slice(1)}',
|
|
interfaceName: '${name}Block',
|
|
fields: [
|
|
{
|
|
name: 'note',
|
|
type: 'text',
|
|
admin: {
|
|
description: 'This is a dedicated layout block for the homepage wrapper. Content is managed via translation files.',
|
|
},
|
|
},
|
|
],
|
|
};
|
|
`;
|
|
fs.writeFileSync(\`src/payload/blocks/\${name}.ts\`, content);
|
|
console.log(\`Created \${name}.ts\`);
|
|
});
|