strapi-layout-plugin 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-layout-plugin",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Strapi layout engine plugin for Sitecore-like routing",
5
5
  "strapi": {
6
6
  "name": "strapi-layout-plugin",
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ module.exports = async ({ strapi }) => {
7
+ try {
8
+ const pluginComponentsDir = path.join(__dirname, 'components');
9
+ const appComponentsDir = path.join(strapi.dirs.app.src, 'components');
10
+
11
+ // Create velox and shared dirs if they don't exist
12
+ const veloxDir = path.join(appComponentsDir, 'velox');
13
+ const sharedDir = path.join(appComponentsDir, 'shared');
14
+
15
+ if (!fs.existsSync(appComponentsDir)) fs.mkdirSync(appComponentsDir, { recursive: true });
16
+ if (!fs.existsSync(veloxDir)) fs.mkdirSync(veloxDir, { recursive: true });
17
+ if (!fs.existsSync(sharedDir)) fs.mkdirSync(sharedDir, { recursive: true });
18
+
19
+ // Files to copy
20
+ const filesToCopy = [
21
+ { src: path.join(pluginComponentsDir, 'velox', 'header.json'), dest: path.join(veloxDir, 'header.json') },
22
+ { src: path.join(pluginComponentsDir, 'velox', 'footer.json'), dest: path.join(veloxDir, 'footer.json') },
23
+ { src: path.join(pluginComponentsDir, 'velox', 'link.json'), dest: path.join(veloxDir, 'link.json') },
24
+ { src: path.join(pluginComponentsDir, 'velox', 'social-link.json'), dest: path.join(veloxDir, 'social-link.json') },
25
+ { src: path.join(pluginComponentsDir, 'velox', 'footer-column.json'), dest: path.join(veloxDir, 'footer-column.json') },
26
+ { src: path.join(pluginComponentsDir, 'shared', 'seo.json'), dest: path.join(sharedDir, 'seo.json') }
27
+ ];
28
+
29
+ let copied = false;
30
+ filesToCopy.forEach(({ src, dest }) => {
31
+ if (!fs.existsSync(dest) && fs.existsSync(src)) {
32
+ fs.copyFileSync(src, dest);
33
+ copied = true;
34
+ }
35
+ });
36
+
37
+ if (copied) {
38
+ strapi.log.info('[strapi-layout-plugin] Seeded layout components into src/components. Please restart Strapi if components do not show up.');
39
+ }
40
+ } catch (error) {
41
+ strapi.log.error('[strapi-layout-plugin] Failed to auto-seed components:', error);
42
+ }
43
+ };
package/server/index.js CHANGED
@@ -3,11 +3,11 @@
3
3
  const controllers = require('./controllers');
4
4
  const routes = require('./routes');
5
5
  const contentTypes = require('./content-types');
6
- const components = require('./components');
6
+ const bootstrap = require('./bootstrap');
7
7
 
8
8
  module.exports = {
9
9
  controllers,
10
10
  routes,
11
11
  contentTypes,
12
- components,
12
+ bootstrap,
13
13
  };