dynamic-zone 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/index.js +14 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5,8 +5,21 @@ const path = require("path");
5
5
 
6
6
  const basePath = process.cwd();
7
7
 
8
+ // Safety check: prevent creating inside node_modules
9
+ if (basePath.includes("node_modules")) {
10
+ console.log("❌ Do not run inside node_modules");
11
+ process.exit(0);
12
+ }
13
+
14
+ // Use src folder
15
+ const srcPath = path.join(basePath, "src");
16
+ if (!fs.existsSync(srcPath)) {
17
+ console.log("⚠️ No src folder found, skipping dynamic-zone setup");
18
+ process.exit(0);
19
+ }
20
+
8
21
  // Paths
9
- const cmsPath = path.join(basePath, "cms");
22
+ const cmsPath = path.join(srcPath, "cms");
10
23
  const componentsPath = path.join(cmsPath, "components");
11
24
  const dynamicZonePath = path.join(cmsPath, "dynamic-zone");
12
25
 
@@ -86,7 +99,6 @@ export default function SectionRenderer({ sections, slug }: Props) {
86
99
 
87
100
  // Create file
88
101
  const filePath = path.join(dynamicZonePath, "section-renderer.tsx");
89
-
90
102
  if (!fs.existsSync(filePath)) {
91
103
  fs.writeFileSync(filePath, fileContent);
92
104
  console.log("📄 Created file:", filePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamic-zone",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "dynamic zone for cms platforms",
5
5
  "keywords": [
6
6
  "dynamic-zone"