feat: payload cms
This commit is contained in:
33
scripts/create-home-blocks.js
Normal file
33
scripts/create-home-blocks.js
Normal file
@@ -0,0 +1,33 @@
|
||||
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\`);
|
||||
});
|
||||
Reference in New Issue
Block a user