figma-mcp-cli 1.0.9 → 1.0.10
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 +26 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -103,6 +103,12 @@ program
|
|
|
103
103
|
message: "Please select the target frontend framework:",
|
|
104
104
|
choices: ["React", "Vue", "HTML/CSS", "Other"],
|
|
105
105
|
},
|
|
106
|
+
{
|
|
107
|
+
type: "input",
|
|
108
|
+
name: "componentName",
|
|
109
|
+
message: "Please enter the component name (e.g., MyComponent):",
|
|
110
|
+
validate: (input) => (input ? true : "Component name cannot be empty"),
|
|
111
|
+
},
|
|
106
112
|
{
|
|
107
113
|
type: "input",
|
|
108
114
|
name: "componentPath",
|
|
@@ -111,10 +117,29 @@ program
|
|
|
111
117
|
default: "src/components",
|
|
112
118
|
validate: (input) => (input ? true : "Component path cannot be empty"),
|
|
113
119
|
},
|
|
120
|
+
{
|
|
121
|
+
type: "confirm",
|
|
122
|
+
name: "createFolder",
|
|
123
|
+
message: "Create a new folder to wrap the generated component?",
|
|
124
|
+
default: true,
|
|
125
|
+
},
|
|
114
126
|
]);
|
|
115
127
|
|
|
128
|
+
// 如果选择创建文件夹,自动调整路径
|
|
129
|
+
let finalPath = answers.componentPath;
|
|
130
|
+
if (answers.createFolder) {
|
|
131
|
+
// 确保路径以组件名文件夹结尾
|
|
132
|
+
if (!finalPath.endsWith(answers.componentName)) {
|
|
133
|
+
finalPath = path.join(finalPath, answers.componentName);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const folderInstruction = answers.createFolder
|
|
138
|
+
? ` Create a new folder named "${answers.componentName}" to wrap the component.`
|
|
139
|
+
: "";
|
|
140
|
+
const prompt = `${answers.figmaUrl}, Convert this to a ${answers.framework} component named "${answers.componentName}", Componentization and style separation are required.${folderInstruction} Generate the component at: ${finalPath}`
|
|
116
141
|
await clipboardy.write(
|
|
117
|
-
|
|
142
|
+
prompt
|
|
118
143
|
);
|
|
119
144
|
console.log("\n🔄 Please follow these steps:\n");
|
|
120
145
|
console.log(
|