@onexapis/cli 1.1.22 → 1.1.25
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/dist/cli.js +49 -0
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +49 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -0
- package/dist/index.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +3 -0
- package/package.json +4 -3
- package/templates/default/.mcp.json +5 -1
- package/templates/default/CLAUDE.md +115 -12
package/dist/index.js
CHANGED
|
@@ -1605,6 +1605,17 @@ async function initCommand(projectName, options = {}) {
|
|
|
1605
1605
|
author,
|
|
1606
1606
|
template
|
|
1607
1607
|
};
|
|
1608
|
+
let figmaApiKey = "";
|
|
1609
|
+
if (!options.yes) {
|
|
1610
|
+
const figmaAnswer = await inquirer__default.default.prompt([
|
|
1611
|
+
{
|
|
1612
|
+
type: "password",
|
|
1613
|
+
name: "figmaApiKey",
|
|
1614
|
+
message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
|
|
1615
|
+
}
|
|
1616
|
+
]);
|
|
1617
|
+
figmaApiKey = figmaAnswer.figmaApiKey || "";
|
|
1618
|
+
}
|
|
1608
1619
|
exports.logger.startSpinner("Creating project structure...");
|
|
1609
1620
|
try {
|
|
1610
1621
|
fs2__default.default.mkdirSync(projectPath, { recursive: true });
|
|
@@ -1616,6 +1627,21 @@ async function initCommand(projectName, options = {}) {
|
|
|
1616
1627
|
description,
|
|
1617
1628
|
author
|
|
1618
1629
|
);
|
|
1630
|
+
const mcpJsonPath = path7__default.default.join(projectPath, ".mcp.json");
|
|
1631
|
+
if (fs2__default.default.existsSync(mcpJsonPath)) {
|
|
1632
|
+
let mcpContent = fs2__default.default.readFileSync(mcpJsonPath, "utf-8");
|
|
1633
|
+
if (figmaApiKey) {
|
|
1634
|
+
mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
|
|
1635
|
+
} else {
|
|
1636
|
+
try {
|
|
1637
|
+
const mcpJson = JSON.parse(mcpContent);
|
|
1638
|
+
delete mcpJson.mcpServers.figma;
|
|
1639
|
+
mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
|
|
1640
|
+
} catch {
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
fs2__default.default.writeFileSync(mcpJsonPath, mcpContent, "utf-8");
|
|
1644
|
+
}
|
|
1619
1645
|
exports.logger.stopSpinner(true, "Project structure created!");
|
|
1620
1646
|
if (options.git) {
|
|
1621
1647
|
exports.logger.startSpinner("Initializing git repository...");
|
|
@@ -3375,6 +3401,29 @@ async function cloneCommand(themeName, options) {
|
|
|
3375
3401
|
].join("\n")
|
|
3376
3402
|
);
|
|
3377
3403
|
}
|
|
3404
|
+
const mcpJsonPath = path7__default.default.join(outputDir, ".mcp.json");
|
|
3405
|
+
if (await fs__default.default.pathExists(mcpJsonPath)) {
|
|
3406
|
+
const { default: inquirerMod } = await import('inquirer');
|
|
3407
|
+
const { figmaApiKey } = await inquirerMod.prompt([
|
|
3408
|
+
{
|
|
3409
|
+
type: "password",
|
|
3410
|
+
name: "figmaApiKey",
|
|
3411
|
+
message: "Figma API Key (optional, for Figma-to-code MCP \u2014 press Enter to skip):"
|
|
3412
|
+
}
|
|
3413
|
+
]);
|
|
3414
|
+
let mcpContent = await fs__default.default.readFile(mcpJsonPath, "utf-8");
|
|
3415
|
+
if (figmaApiKey) {
|
|
3416
|
+
mcpContent = mcpContent.replace("__FIGMA_API_KEY__", figmaApiKey);
|
|
3417
|
+
} else {
|
|
3418
|
+
try {
|
|
3419
|
+
const mcpJson = JSON.parse(mcpContent);
|
|
3420
|
+
delete mcpJson.mcpServers?.figma;
|
|
3421
|
+
mcpContent = JSON.stringify(mcpJson, null, 2) + "\n";
|
|
3422
|
+
} catch {
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
await fs__default.default.writeFile(mcpJsonPath, mcpContent, "utf-8");
|
|
3426
|
+
}
|
|
3378
3427
|
if (options.install !== false) {
|
|
3379
3428
|
const hasPkgJson = await fs__default.default.pathExists(
|
|
3380
3429
|
path7__default.default.join(outputDir, "package.json")
|