dynamic-zone 1.0.0 → 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.
- package/index.js +14 -2
- package/package.json +4 -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(
|
|
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.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "dynamic zone for cms platforms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dynamic-zone"
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"main": "index.js",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"dynamic-zone": "./index.js"
|
|
14
17
|
}
|
|
15
18
|
}
|