@editframe/create 0.36.2-beta → 0.37.1-beta
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/index.js +111 -23
- package/dist/index.js.map +1 -1
- package/dist/templates/animejs/package.json +3 -3
- package/dist/templates/card-poetry/package.json +3 -3
- package/dist/templates/html/package.json +3 -3
- package/dist/templates/react/package.json +3 -3
- package/dist/templates/react-demo/package.json +3 -3
- package/dist/templates/simple-demo/package.json +3 -3
- package/dist/utils.js +81 -0
- package/dist/utils.js.map +1 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { getDevCommand, getUserPkgManager, installAgentSkills, installDependencies } from "./utils.js";
|
|
2
3
|
import { access, cp, readdir } from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -10,28 +11,31 @@ import prompts from "prompts";
|
|
|
10
11
|
function showHelp(templates) {
|
|
11
12
|
const usage = `
|
|
12
13
|
${chalk.bold("Usage:")}
|
|
13
|
-
npm create @editframe
|
|
14
|
+
npm create @editframe -- [template] [options]
|
|
14
15
|
|
|
15
16
|
${chalk.bold("Options:")}
|
|
16
|
-
-d, --directory <name> Project directory name
|
|
17
|
+
-d, --directory <name> Project directory name
|
|
18
|
+
--skip-install Skip dependency installation
|
|
19
|
+
--skip-skills Skip agent skills installation
|
|
20
|
+
--agent <name> Specify AI agent (cursor, claude, vscode, etc.)
|
|
21
|
+
-y, --yes Skip all prompts, use defaults
|
|
17
22
|
-h, --help Show this help message
|
|
18
23
|
|
|
19
24
|
${chalk.bold("Available Templates:")}
|
|
20
25
|
${templates.map((t) => ` - ${t}`).join("\n")}
|
|
21
26
|
|
|
22
27
|
${chalk.bold("Examples:")}
|
|
23
|
-
${chalk.dim("# Interactive mode (
|
|
24
|
-
npm create @editframe
|
|
28
|
+
${chalk.dim("# Interactive mode (recommended)")}
|
|
29
|
+
npm create @editframe
|
|
25
30
|
|
|
26
|
-
${chalk.dim("# Specify template
|
|
27
|
-
npm create @editframe
|
|
31
|
+
${chalk.dim("# Specify template")}
|
|
32
|
+
npm create @editframe -- react
|
|
28
33
|
|
|
29
|
-
${chalk.dim("#
|
|
30
|
-
npm create @editframe
|
|
31
|
-
npm create @editframe/elements -- react-demo -d my-app
|
|
34
|
+
${chalk.dim("# Full non-interactive")}
|
|
35
|
+
npm create @editframe -- react -d my-app --agent cursor -y
|
|
32
36
|
|
|
33
|
-
${chalk.dim("#
|
|
34
|
-
npm create @editframe
|
|
37
|
+
${chalk.dim("# Skip auto-installation")}
|
|
38
|
+
npm create @editframe -- react --skip-install --skip-skills
|
|
35
39
|
`;
|
|
36
40
|
process.stdout.write(usage);
|
|
37
41
|
}
|
|
@@ -57,6 +61,20 @@ async function main() {
|
|
|
57
61
|
directory: {
|
|
58
62
|
type: "string",
|
|
59
63
|
short: "d"
|
|
64
|
+
},
|
|
65
|
+
skipInstall: {
|
|
66
|
+
type: "boolean",
|
|
67
|
+
default: false
|
|
68
|
+
},
|
|
69
|
+
skipSkills: {
|
|
70
|
+
type: "boolean",
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
agent: { type: "string" },
|
|
74
|
+
yes: {
|
|
75
|
+
type: "boolean",
|
|
76
|
+
short: "y",
|
|
77
|
+
default: false
|
|
60
78
|
}
|
|
61
79
|
},
|
|
62
80
|
allowPositionals: true
|
|
@@ -67,6 +85,10 @@ async function main() {
|
|
|
67
85
|
}
|
|
68
86
|
const cliTemplate = positionals[0];
|
|
69
87
|
const cliDirectory = values.directory;
|
|
88
|
+
const skipInstall = values.skipInstall;
|
|
89
|
+
const skipSkills = values.skipSkills;
|
|
90
|
+
const cliAgent = values.agent;
|
|
91
|
+
const nonInteractive = values.yes;
|
|
70
92
|
if (cliTemplate && !templates.includes(cliTemplate)) {
|
|
71
93
|
process.stderr.write(chalk.red(`Error: Template "${cliTemplate}" does not exist.\n\n`));
|
|
72
94
|
process.stderr.write(chalk.bold("Available templates:\n"));
|
|
@@ -75,13 +97,13 @@ async function main() {
|
|
|
75
97
|
process.exit(1);
|
|
76
98
|
}
|
|
77
99
|
const promptQuestions = [];
|
|
78
|
-
if (!cliDirectory) promptQuestions.push({
|
|
100
|
+
if (!cliDirectory && !nonInteractive) promptQuestions.push({
|
|
79
101
|
type: "text",
|
|
80
102
|
name: "directoryName",
|
|
81
103
|
message: "Enter the name of the directory to generate into:",
|
|
82
104
|
initial: "my-project"
|
|
83
105
|
});
|
|
84
|
-
if (!cliTemplate) promptQuestions.push({
|
|
106
|
+
if (!cliTemplate && !nonInteractive) promptQuestions.push({
|
|
85
107
|
type: "select",
|
|
86
108
|
name: "templateName",
|
|
87
109
|
message: "Choose a starter template:",
|
|
@@ -90,9 +112,56 @@ async function main() {
|
|
|
90
112
|
value: template
|
|
91
113
|
}))
|
|
92
114
|
});
|
|
115
|
+
if (!skipSkills && !cliAgent && !nonInteractive) {
|
|
116
|
+
promptQuestions.push({
|
|
117
|
+
type: "confirm",
|
|
118
|
+
name: "installSkills",
|
|
119
|
+
message: "Install AI agent skills for better coding assistance?",
|
|
120
|
+
initial: true
|
|
121
|
+
});
|
|
122
|
+
promptQuestions.push({
|
|
123
|
+
type: (_prev, values$1) => values$1.installSkills ? "select" : null,
|
|
124
|
+
name: "agent",
|
|
125
|
+
message: "Which AI coding agent are you using?",
|
|
126
|
+
choices: [
|
|
127
|
+
{
|
|
128
|
+
title: "Cursor",
|
|
129
|
+
value: "cursor",
|
|
130
|
+
description: "Most popular"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
title: "VS Code Copilot",
|
|
134
|
+
value: "vscode"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: "Claude Code",
|
|
138
|
+
value: "claude"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: "Windsurf",
|
|
142
|
+
value: "windsurf"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
title: "All agents",
|
|
146
|
+
value: "all"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
title: "Skip",
|
|
150
|
+
value: "skip"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
initial: 0
|
|
154
|
+
});
|
|
155
|
+
}
|
|
93
156
|
const answers = promptQuestions.length > 0 ? await prompts(promptQuestions) : {};
|
|
94
|
-
|
|
95
|
-
|
|
157
|
+
if (!cliDirectory && !nonInteractive && !answers.directoryName || !cliTemplate && !nonInteractive && !answers.templateName) {
|
|
158
|
+
process.stderr.write(chalk.red("\nCancelled\n"));
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
const directoryName = cliDirectory || answers.directoryName || "my-project";
|
|
162
|
+
const templateName = cliTemplate || answers.templateName || templates[0];
|
|
163
|
+
let selectedAgent = cliAgent || answers.agent;
|
|
164
|
+
if (!skipSkills && !selectedAgent && nonInteractive) selectedAgent = "cursor";
|
|
96
165
|
const targetDir = path.join(process.cwd(), directoryName);
|
|
97
166
|
const templateDir = path.join(__dirname, "templates", templateName);
|
|
98
167
|
if (await checkDirectoryExists(targetDir)) {
|
|
@@ -108,15 +177,34 @@ async function main() {
|
|
|
108
177
|
process.exit(1);
|
|
109
178
|
}
|
|
110
179
|
}
|
|
111
|
-
process.stderr.write(
|
|
112
|
-
process.stderr.write(`Using template: ${templateName}\n`);
|
|
180
|
+
process.stderr.write(`\nCreating project in directory: ${targetDir}\n`);
|
|
181
|
+
process.stderr.write(`Using template: ${templateName}\n\n`);
|
|
113
182
|
await cp(templateDir, targetDir, { recursive: true });
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
process.stderr.write("
|
|
183
|
+
const pkgManager = getUserPkgManager();
|
|
184
|
+
let depsInstalled = false;
|
|
185
|
+
let skillsInstalled = false;
|
|
186
|
+
if (!skipInstall) depsInstalled = await installDependencies(targetDir);
|
|
187
|
+
if (!skipSkills && selectedAgent && selectedAgent !== "skip") skillsInstalled = await installAgentSkills(targetDir, selectedAgent);
|
|
188
|
+
process.stderr.write(chalk.green.bold("\n✓ Project created successfully!\n"));
|
|
189
|
+
if (depsInstalled) process.stderr.write(chalk.green("✓ Dependencies installed\n"));
|
|
190
|
+
if (skillsInstalled) process.stderr.write(chalk.green(`✓ Agent skills installed (${selectedAgent})\n`));
|
|
191
|
+
process.stderr.write(chalk.bold("\nYour project is ready! 🎉\n\n"));
|
|
192
|
+
process.stderr.write(chalk.bold("Next steps:\n"));
|
|
193
|
+
process.stderr.write(chalk.cyan(` cd ${directoryName}\n`));
|
|
194
|
+
if (!depsInstalled) process.stderr.write(chalk.cyan(` ${pkgManager} install\n`));
|
|
195
|
+
process.stderr.write(chalk.cyan(` ${getDevCommand(pkgManager)}\n`));
|
|
196
|
+
if (skillsInstalled) {
|
|
197
|
+
process.stderr.write(chalk.bold("\nAI Agent Skills installed:\n"));
|
|
198
|
+
process.stderr.write(chalk.dim(" • elements-composition - HTML/Web Components\n"));
|
|
199
|
+
process.stderr.write(chalk.dim(" • react-composition - React components\n"));
|
|
200
|
+
process.stderr.write(chalk.dim(" • motion-design - Animation principles\n"));
|
|
201
|
+
process.stderr.write(chalk.bold("\nTry asking your AI agent:\n"));
|
|
202
|
+
process.stderr.write(chalk.dim(" \"Create a 5-second video with fade-in text\"\n"));
|
|
203
|
+
process.stderr.write(chalk.dim(" \"Add a waveform visualization\"\n"));
|
|
204
|
+
process.stderr.write(chalk.dim(" \"Animate this element with spring physics\"\n"));
|
|
205
|
+
}
|
|
206
|
+
process.stderr.write(chalk.dim("\nDocumentation: https://editframe.com/docs\n"));
|
|
207
|
+
process.stderr.write(chalk.dim("Happy coding! 🎬\n\n"));
|
|
120
208
|
}
|
|
121
209
|
main();
|
|
122
210
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["path","promptQuestions: prompts.PromptObject[]"],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { access, cp, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { parseArgs } from \"node:util\";\nimport chalk from \"chalk\";\nimport prompts from \"prompts\";\n\nfunction showHelp(templates: string[]) {\n const usage = `\n${chalk.bold(\"Usage:\")}\n npm create @editframe/elements -- [template] [options]\n\n${chalk.bold(\"Options:\")}\n -d, --directory <name> Project directory name (default: prompts for input)\n -h, --help Show this help message\n\n${chalk.bold(\"Available Templates:\")}\n${templates.map((t) => ` - ${t}`).join(\"\\n\")}\n\n${chalk.bold(\"Examples:\")}\n ${chalk.dim(\"# Interactive mode (prompts for all inputs)\")}\n npm create @editframe/elements\n\n ${chalk.dim(\"# Specify template, prompt for directory\")}\n npm create @editframe/elements -- react-demo\n\n ${chalk.dim(\"# Specify both template and directory\")}\n npm create @editframe/elements -- react-demo --directory my-app\n npm create @editframe/elements -- react-demo -d my-app\n\n ${chalk.dim(\"# Show help\")}\n npm create @editframe/elements -- --help\n`;\n\n process.stdout.write(usage);\n}\n\nasync function checkDirectoryExists(path: string) {\n try {\n await access(path);\n return true;\n } catch (_error) {\n return false;\n }\n}\n\nasync function main() {\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n // List of available starter templates\n const templates = await readdir(path.join(__dirname, \"templates\"));\n\n // Parse command line arguments\n const { values, positionals } = parseArgs({\n args: process.argv.slice(2),\n options: {\n help: {\n type: \"boolean\",\n short: \"h\",\n default: false,\n },\n directory: {\n type: \"string\",\n short: \"d\",\n },\n },\n allowPositionals: true,\n });\n\n // Show help if requested\n if (values.help) {\n showHelp(templates);\n process.exit(0);\n }\n\n // Extract CLI arguments\n const cliTemplate = positionals[0];\n const cliDirectory = values.directory;\n\n // Validate template if provided\n if (cliTemplate && !templates.includes(cliTemplate)) {\n process.stderr.write(\n chalk.red(`Error: Template \"${cliTemplate}\" does not exist.\\n\\n`),\n );\n process.stderr.write(chalk.bold(\"Available templates:\\n\"));\n for (const t of templates) {\n process.stderr.write(` - ${t}\\n`);\n }\n process.stderr.write(\n chalk.dim(\"\\nRun with --help for more information.\\n\"),\n );\n process.exit(1);\n }\n\n // Build prompts array based on what CLI args were provided\n const promptQuestions: prompts.PromptObject[] = [];\n\n if (!cliDirectory) {\n promptQuestions.push({\n type: \"text\",\n name: \"directoryName\",\n message: \"Enter the name of the directory to generate into:\",\n initial: \"my-project\",\n });\n }\n\n if (!cliTemplate) {\n promptQuestions.push({\n type: \"select\",\n name: \"templateName\",\n message: \"Choose a starter template:\",\n choices: templates.map((template) => ({\n title: template,\n value: template,\n })),\n });\n }\n\n // Prompt for missing information\n const answers =\n promptQuestions.length > 0 ? await prompts(promptQuestions) : {};\n\n // Use CLI args or prompted values\n const directoryName = cliDirectory || answers.directoryName;\n const templateName = cliTemplate || answers.templateName;\n\n const targetDir = path.join(process.cwd(), directoryName);\n const templateDir = path.join(__dirname, \"templates\", templateName);\n\n const exists = await checkDirectoryExists(targetDir);\n\n if (exists) {\n process.stderr.write(\n chalk.yellow(`Directory ${targetDir} already exists.\\n`),\n );\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: \"Directory already exists. Do you want to overwrite it?\",\n initial: false,\n });\n\n if (!overwrite) {\n process.stderr.write(chalk.red(\"Aborting...\\n\"));\n process.exit(1);\n }\n }\n\n process.stderr.write(`Creating project in directory: ${targetDir}\\n`);\n process.stderr.write(`Using template: ${templateName}\\n`);\n\n // Copy the selected template to the target directory\n await cp(templateDir, targetDir, { recursive: true });\n\n process.stderr.write(chalk.green(\"\\nProject created successfully.\\n\\n\"));\n\n process.stderr.write(chalk.green(\"Next steps:\\n\"));\n\n process.stderr.write(` cd ${directoryName}\\n`);\n process.stderr.write(\" npm install\\n\");\n process.stderr.write(\" npm start\\n\\n\");\n\n process.stderr.write(\"Happy hacking!\\n\");\n}\n\nmain();\n"],"mappings":";;;;;;;;;AASA,SAAS,SAAS,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MAAM,mBAAmB;;AAG1C,MAAM"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["path","promptQuestions: prompts.PromptObject[]","values"],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { access, cp, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { parseArgs } from \"node:util\";\nimport chalk from \"chalk\";\nimport prompts from \"prompts\";\nimport {\n getUserPkgManager,\n installDependencies,\n installAgentSkills,\n getDevCommand,\n} from \"./utils.js\";\n\nfunction showHelp(templates: string[]) {\n const usage = `\n${chalk.bold(\"Usage:\")}\n npm create @editframe -- [template] [options]\n\n${chalk.bold(\"Options:\")}\n -d, --directory <name> Project directory name\n --skip-install Skip dependency installation\n --skip-skills Skip agent skills installation\n --agent <name> Specify AI agent (cursor, claude, vscode, etc.)\n -y, --yes Skip all prompts, use defaults\n -h, --help Show this help message\n\n${chalk.bold(\"Available Templates:\")}\n${templates.map((t) => ` - ${t}`).join(\"\\n\")}\n\n${chalk.bold(\"Examples:\")}\n ${chalk.dim(\"# Interactive mode (recommended)\")}\n npm create @editframe\n\n ${chalk.dim(\"# Specify template\")}\n npm create @editframe -- react\n\n ${chalk.dim(\"# Full non-interactive\")}\n npm create @editframe -- react -d my-app --agent cursor -y\n\n ${chalk.dim(\"# Skip auto-installation\")}\n npm create @editframe -- react --skip-install --skip-skills\n`;\n\n process.stdout.write(usage);\n}\n\nasync function checkDirectoryExists(path: string) {\n try {\n await access(path);\n return true;\n } catch (_error) {\n return false;\n }\n}\n\nasync function main() {\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\n\n // List of available starter templates\n const templates = await readdir(path.join(__dirname, \"templates\"));\n\n // Parse command line arguments\n const { values, positionals } = parseArgs({\n args: process.argv.slice(2),\n options: {\n help: {\n type: \"boolean\",\n short: \"h\",\n default: false,\n },\n directory: {\n type: \"string\",\n short: \"d\",\n },\n skipInstall: {\n type: \"boolean\",\n default: false,\n },\n skipSkills: {\n type: \"boolean\",\n default: false,\n },\n agent: {\n type: \"string\",\n },\n yes: {\n type: \"boolean\",\n short: \"y\",\n default: false,\n },\n },\n allowPositionals: true,\n });\n\n // Show help if requested\n if (values.help) {\n showHelp(templates);\n process.exit(0);\n }\n\n // Extract CLI arguments\n const cliTemplate = positionals[0];\n const cliDirectory = values.directory;\n const skipInstall = values.skipInstall;\n const skipSkills = values.skipSkills;\n const cliAgent = values.agent;\n const nonInteractive = values.yes;\n\n // Validate template if provided\n if (cliTemplate && !templates.includes(cliTemplate)) {\n process.stderr.write(\n chalk.red(`Error: Template \"${cliTemplate}\" does not exist.\\n\\n`),\n );\n process.stderr.write(chalk.bold(\"Available templates:\\n\"));\n for (const t of templates) {\n process.stderr.write(` - ${t}\\n`);\n }\n process.stderr.write(\n chalk.dim(\"\\nRun with --help for more information.\\n\"),\n );\n process.exit(1);\n }\n\n // Build prompts array - ask ALL questions upfront before any network calls\n const promptQuestions: prompts.PromptObject[] = [];\n\n if (!cliDirectory && !nonInteractive) {\n promptQuestions.push({\n type: \"text\",\n name: \"directoryName\",\n message: \"Enter the name of the directory to generate into:\",\n initial: \"my-project\",\n });\n }\n\n if (!cliTemplate && !nonInteractive) {\n promptQuestions.push({\n type: \"select\",\n name: \"templateName\",\n message: \"Choose a starter template:\",\n choices: templates.map((template) => ({\n title: template,\n value: template,\n })),\n });\n }\n\n // Ask about agent skills upfront (unless skipped via CLI)\n if (!skipSkills && !cliAgent && !nonInteractive) {\n promptQuestions.push({\n type: \"confirm\",\n name: \"installSkills\",\n message: \"Install AI agent skills for better coding assistance?\",\n initial: true,\n });\n \n promptQuestions.push({\n type: (_prev, values) => (values.installSkills ? \"select\" : null),\n name: \"agent\",\n message: \"Which AI coding agent are you using?\",\n choices: [\n {\n title: \"Cursor\",\n value: \"cursor\",\n description: \"Most popular\",\n },\n { title: \"VS Code Copilot\", value: \"vscode\" },\n { title: \"Claude Code\", value: \"claude\" },\n { title: \"Windsurf\", value: \"windsurf\" },\n { title: \"All agents\", value: \"all\" },\n { title: \"Skip\", value: \"skip\" },\n ],\n initial: 0,\n });\n }\n\n // Prompt for all missing information at once\n const answers =\n promptQuestions.length > 0 ? await prompts(promptQuestions) : {};\n\n // Handle user cancellation\n if (\n (!cliDirectory && !nonInteractive && !answers.directoryName) ||\n (!cliTemplate && !nonInteractive && !answers.templateName)\n ) {\n process.stderr.write(chalk.red(\"\\nCancelled\\n\"));\n process.exit(1);\n }\n\n // Use CLI args or prompted values (with defaults for non-interactive mode)\n const directoryName =\n cliDirectory || answers.directoryName || \"my-project\";\n const templateName = cliTemplate || answers.templateName || templates[0];\n \n // Determine agent selection from CLI or prompts\n let selectedAgent = cliAgent || answers.agent;\n \n // Default to cursor in non-interactive mode if skills not skipped\n if (!skipSkills && !selectedAgent && nonInteractive) {\n selectedAgent = \"cursor\";\n }\n\n const targetDir = path.join(process.cwd(), directoryName);\n const templateDir = path.join(__dirname, \"templates\", templateName);\n\n const exists = await checkDirectoryExists(targetDir);\n\n if (exists) {\n process.stderr.write(\n chalk.yellow(`Directory ${targetDir} already exists.\\n`),\n );\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: \"Directory already exists. Do you want to overwrite it?\",\n initial: false,\n });\n\n if (!overwrite) {\n process.stderr.write(chalk.red(\"Aborting...\\n\"));\n process.exit(1);\n }\n }\n\n process.stderr.write(`\\nCreating project in directory: ${targetDir}\\n`);\n process.stderr.write(`Using template: ${templateName}\\n\\n`);\n\n // Copy the selected template to the target directory\n await cp(templateDir, targetDir, { recursive: true });\n\n const pkgManager = getUserPkgManager();\n let depsInstalled = false;\n let skillsInstalled = false;\n\n // All questions have been asked - now do the work\n \n // Install dependencies unless skipped\n if (!skipInstall) {\n depsInstalled = await installDependencies(targetDir);\n }\n\n // Install agent skills if an agent was selected\n if (!skipSkills && selectedAgent && selectedAgent !== \"skip\") {\n skillsInstalled = await installAgentSkills(targetDir, selectedAgent);\n }\n\n // Success message\n process.stderr.write(chalk.green.bold(\"\\n✓ Project created successfully!\\n\"));\n\n if (depsInstalled) {\n process.stderr.write(chalk.green(\"✓ Dependencies installed\\n\"));\n }\n\n if (skillsInstalled) {\n process.stderr.write(\n chalk.green(`✓ Agent skills installed (${selectedAgent})\\n`)\n );\n }\n\n process.stderr.write(chalk.bold(\"\\nYour project is ready! 🎉\\n\\n\"));\n\n // Next steps\n process.stderr.write(chalk.bold(\"Next steps:\\n\"));\n process.stderr.write(chalk.cyan(` cd ${directoryName}\\n`));\n\n if (!depsInstalled) {\n process.stderr.write(chalk.cyan(` ${pkgManager} install\\n`));\n }\n\n process.stderr.write(chalk.cyan(` ${getDevCommand(pkgManager)}\\n`));\n\n // Skills info\n if (skillsInstalled) {\n process.stderr.write(chalk.bold(\"\\nAI Agent Skills installed:\\n\"));\n process.stderr.write(\n chalk.dim(\" • elements-composition - HTML/Web Components\\n\")\n );\n process.stderr.write(\n chalk.dim(\" • react-composition - React components\\n\")\n );\n process.stderr.write(\n chalk.dim(\" • motion-design - Animation principles\\n\")\n );\n\n process.stderr.write(chalk.bold(\"\\nTry asking your AI agent:\\n\"));\n process.stderr.write(\n chalk.dim(' \"Create a 5-second video with fade-in text\"\\n')\n );\n process.stderr.write(chalk.dim(' \"Add a waveform visualization\"\\n'));\n process.stderr.write(\n chalk.dim(' \"Animate this element with spring physics\"\\n')\n );\n }\n\n process.stderr.write(\n chalk.dim(\"\\nDocumentation: https://editframe.com/docs\\n\")\n );\n process.stderr.write(chalk.dim(\"Happy coding! 🎬\\n\\n\"));\n}\n\nmain();\n"],"mappings":";;;;;;;;;;AAeA,SAAS,SAAS,WAAqB;CACrC,MAAM,QAAQ;EACd,MAAM,KAAK,SAAS,CAAC;;;EAGrB,MAAM,KAAK,WAAW,CAAC;;;;;;;;EAQvB,MAAM,KAAK,uBAAuB,CAAC;EACnC,UAAU,KAAK,MAAM,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC;;EAE5C,MAAM,KAAK,YAAY,CAAC;IACtB,MAAM,IAA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Y,CAAC;AAG/D,SAAQ,OAAO,MAAM,MAAM,KAAK,KAAK,cAAc,WAAW,CAAC,IAAI,CAAC;AAGpE,KAAI,iBAAiB;AACnB,UAAQ,OAAO,MAAM,MAAM,KAAK,iCAAiC,CAAC;AAClE,UAAQ,OAAO,MACb,MAAM,IAAI,mDAAmD,CAC9D;AACD,UAAQ,OAAO,MACb,MAAM,IAAI,6CAA6C,CACxD;AACD,UAAQ,OAAO,MACb,MAAM,IAAI,6CAA6C,CACxD;AAED,UAAQ,OAAO,MAAM,MAAM,KAAK,gCAAgC,CAAC;AACjE,UAAQ,OAAO,MACb,MAAM,IAAI,oDAAkD,CAC7D;AACD,UAAQ,OAAO,MAAM,MAAM,IAAI,uCAAqC,CAAC;AACrE,UAAQ,OAAO,MACb,MAAM,IAAI,mDAAiD,CAC5D;;AAGH,SAAQ,OAAO,MACb,MAAM,IAAI,gDAAgD,CAC3D;AACD,SAAQ,OAAO,MAAM,MAAM,IAAI,uBAAuB,CAAC;;AAGzD,MAAM"}
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@editframe/cli": "0.
|
|
15
|
-
"@editframe/elements": "0.
|
|
16
|
-
"@editframe/vite-plugin": "0.
|
|
14
|
+
"@editframe/cli": "0.37.1-beta",
|
|
15
|
+
"@editframe/elements": "0.37.1-beta",
|
|
16
|
+
"@editframe/vite-plugin": "0.37.1-beta",
|
|
17
17
|
"animejs": "^4.2.2",
|
|
18
18
|
"prismjs": "^1.30.0",
|
|
19
19
|
"tailwindcss": "^3.4.3",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@editframe/cli": "0.
|
|
15
|
-
"@editframe/elements": "0.
|
|
16
|
-
"@editframe/vite-plugin": "0.
|
|
14
|
+
"@editframe/cli": "0.37.1-beta",
|
|
15
|
+
"@editframe/elements": "0.37.1-beta",
|
|
16
|
+
"@editframe/vite-plugin": "0.37.1-beta",
|
|
17
17
|
"tailwindcss": "^3.4.3",
|
|
18
18
|
"vite": "^6.3.5",
|
|
19
19
|
"vite-plugin-singlefile": "^2.0.1"
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"start": "editframe preview"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@editframe/cli": "0.
|
|
11
|
-
"@editframe/elements": "0.
|
|
12
|
-
"@editframe/vite-plugin": "0.
|
|
10
|
+
"@editframe/cli": "0.37.1-beta",
|
|
11
|
+
"@editframe/elements": "0.37.1-beta",
|
|
12
|
+
"@editframe/vite-plugin": "0.37.1-beta",
|
|
13
13
|
"tailwindcss": "^3.4.3",
|
|
14
14
|
"vite": "^6.3.5",
|
|
15
15
|
"vite-plugin-singlefile": "^2.0.1"
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"start": "editframe preview"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@editframe/cli": "0.
|
|
11
|
-
"@editframe/react": "0.
|
|
12
|
-
"@editframe/vite-plugin": "0.
|
|
10
|
+
"@editframe/cli": "0.37.1-beta",
|
|
11
|
+
"@editframe/react": "0.37.1-beta",
|
|
12
|
+
"@editframe/vite-plugin": "0.37.1-beta",
|
|
13
13
|
"@vitejs/plugin-react": "^4.3.1",
|
|
14
14
|
"tailwindcss": "^3.4.3",
|
|
15
15
|
"vite": "^6.3.5",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@editframe/cli": "0.
|
|
15
|
-
"@editframe/react": "0.
|
|
16
|
-
"@editframe/vite-plugin": "0.
|
|
14
|
+
"@editframe/cli": "0.37.1-beta",
|
|
15
|
+
"@editframe/react": "0.37.1-beta",
|
|
16
|
+
"@editframe/vite-plugin": "0.37.1-beta",
|
|
17
17
|
"@vitejs/plugin-react": "^4.3.1",
|
|
18
18
|
"tailwindcss": "^3.4.3",
|
|
19
19
|
"vite": "^6.3.5",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@editframe/cli": "0.
|
|
15
|
-
"@editframe/elements": "0.
|
|
16
|
-
"@editframe/vite-plugin": "0.
|
|
14
|
+
"@editframe/cli": "0.37.1-beta",
|
|
15
|
+
"@editframe/elements": "0.37.1-beta",
|
|
16
|
+
"@editframe/vite-plugin": "0.37.1-beta",
|
|
17
17
|
"tailwindcss": "^3.4.3",
|
|
18
18
|
"vite": "^6.3.5",
|
|
19
19
|
"vite-plugin-singlefile": "^2.0.1"
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { execa } from "execa";
|
|
3
|
+
|
|
4
|
+
//#region src/utils.ts
|
|
5
|
+
/**
|
|
6
|
+
* Detect which package manager was used to invoke the create script.
|
|
7
|
+
* Uses the npm_config_user_agent environment variable set by package managers.
|
|
8
|
+
*/
|
|
9
|
+
function getUserPkgManager() {
|
|
10
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
11
|
+
if (userAgent) {
|
|
12
|
+
if (userAgent.startsWith("yarn")) return "yarn";
|
|
13
|
+
if (userAgent.startsWith("pnpm")) return "pnpm";
|
|
14
|
+
if (userAgent.startsWith("bun")) return "bun";
|
|
15
|
+
}
|
|
16
|
+
return "npm";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Run the appropriate install command for the detected package manager.
|
|
20
|
+
* Shows full output to the user so they can see progress.
|
|
21
|
+
*/
|
|
22
|
+
async function runInstallCommand(pkgManager, projectDir) {
|
|
23
|
+
await execa(pkgManager, ["install"], {
|
|
24
|
+
cwd: projectDir,
|
|
25
|
+
stdout: "inherit",
|
|
26
|
+
stderr: "inherit"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Install dependencies in the project directory.
|
|
31
|
+
*/
|
|
32
|
+
async function installDependencies(projectDir) {
|
|
33
|
+
const pkgManager = getUserPkgManager();
|
|
34
|
+
try {
|
|
35
|
+
process.stderr.write(chalk.bold(`\nInstalling dependencies with ${pkgManager}...\n\n`));
|
|
36
|
+
await runInstallCommand(pkgManager, projectDir);
|
|
37
|
+
process.stderr.write(chalk.green("\n✓ Dependencies installed successfully!\n"));
|
|
38
|
+
return true;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
process.stderr.write(chalk.yellow("\n⚠ Dependency installation failed\n"));
|
|
41
|
+
process.stderr.write(chalk.dim("You can install manually:\n"));
|
|
42
|
+
process.stderr.write(chalk.cyan(` cd ${projectDir.split("/").pop()}\n`));
|
|
43
|
+
process.stderr.write(chalk.cyan(` ${pkgManager} install\n\n`));
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Install AI agent skills using the ai-agent-skills CLI.
|
|
49
|
+
*/
|
|
50
|
+
async function installAgentSkills(projectDir, agent) {
|
|
51
|
+
try {
|
|
52
|
+
process.stderr.write(chalk.bold(`\nInstalling AI agent skills for ${agent}...\n\n`));
|
|
53
|
+
await execa("npx", [
|
|
54
|
+
"ai-agent-skills",
|
|
55
|
+
"install",
|
|
56
|
+
"editframe/skills",
|
|
57
|
+
...agent === "all" ? [] : ["--agent", agent]
|
|
58
|
+
], {
|
|
59
|
+
cwd: projectDir,
|
|
60
|
+
stdout: "inherit",
|
|
61
|
+
stderr: "inherit"
|
|
62
|
+
});
|
|
63
|
+
process.stderr.write(chalk.green(`\n✓ Agent skills installed for ${agent}!\n`));
|
|
64
|
+
return true;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
process.stderr.write(chalk.yellow("\n⚠ Failed to install agent skills\n"));
|
|
67
|
+
process.stderr.write(chalk.dim("You can install manually:\n"));
|
|
68
|
+
process.stderr.write(chalk.cyan(` npx ai-agent-skills install editframe/skills --agent ${agent}\n\n`));
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get the appropriate dev command for the package manager.
|
|
74
|
+
*/
|
|
75
|
+
function getDevCommand(pkgManager) {
|
|
76
|
+
return pkgManager === "npm" ? "npm run dev" : `${pkgManager} dev`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
export { getDevCommand, getUserPkgManager, installAgentSkills, installDependencies };
|
|
81
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { execa } from \"execa\";\nimport chalk from \"chalk\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\n/**\n * Detect which package manager was used to invoke the create script.\n * Uses the npm_config_user_agent environment variable set by package managers.\n */\nexport function getUserPkgManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent;\n\n if (userAgent) {\n if (userAgent.startsWith(\"yarn\")) return \"yarn\";\n if (userAgent.startsWith(\"pnpm\")) return \"pnpm\";\n if (userAgent.startsWith(\"bun\")) return \"bun\";\n }\n\n return \"npm\"; // Default fallback\n}\n\n/**\n * Run the appropriate install command for the detected package manager.\n * Shows full output to the user so they can see progress.\n */\nasync function runInstallCommand(\n pkgManager: PackageManager,\n projectDir: string\n): Promise<void> {\n // Show all output directly to user - no hiding behind spinners\n await execa(pkgManager, [\"install\"], {\n cwd: projectDir,\n stdout: \"inherit\",\n stderr: \"inherit\",\n });\n}\n\n/**\n * Install dependencies in the project directory.\n */\nexport async function installDependencies(projectDir: string): Promise<boolean> {\n const pkgManager = getUserPkgManager();\n\n try {\n process.stderr.write(chalk.bold(`\\nInstalling dependencies with ${pkgManager}...\\n\\n`));\n \n await runInstallCommand(pkgManager, projectDir);\n\n process.stderr.write(chalk.green(\"\\n✓ Dependencies installed successfully!\\n\"));\n\n return true;\n } catch (error) {\n process.stderr.write(chalk.yellow(\"\\n⚠ Dependency installation failed\\n\"));\n process.stderr.write(chalk.dim(\"You can install manually:\\n\"));\n process.stderr.write(chalk.cyan(` cd ${projectDir.split(\"/\").pop()}\\n`));\n process.stderr.write(chalk.cyan(` ${pkgManager} install\\n\\n`));\n return false;\n }\n}\n\n/**\n * Install AI agent skills using the ai-agent-skills CLI.\n */\nexport async function installAgentSkills(\n projectDir: string,\n agent: string\n): Promise<boolean> {\n try {\n process.stderr.write(chalk.bold(`\\nInstalling AI agent skills for ${agent}...\\n\\n`));\n \n const agentFlag = agent === \"all\" ? [] : [\"--agent\", agent];\n\n await execa(\n \"npx\",\n [\"ai-agent-skills\", \"install\", \"editframe/skills\", ...agentFlag],\n { \n cwd: projectDir,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }\n );\n\n process.stderr.write(chalk.green(`\\n✓ Agent skills installed for ${agent}!\\n`));\n return true;\n } catch (error) {\n process.stderr.write(chalk.yellow(\"\\n⚠ Failed to install agent skills\\n\"));\n process.stderr.write(chalk.dim(\"You can install manually:\\n\"));\n process.stderr.write(\n chalk.cyan(\n ` npx ai-agent-skills install editframe/skills --agent ${agent}\\n\\n`\n )\n );\n return false;\n }\n}\n\n/**\n * Get the appropriate dev command for the package manager.\n */\nexport function getDevCommand(pkgManager: PackageManager): string {\n return pkgManager === \"npm\" ? \"npm run dev\" : `${pkgManager} dev`;\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,oBAAoC;CAClD,MAAM,YAAY,QAAQ,IAAI;AAE9B,KAAI,WAAW;AACb,MAAI,UAAU,WAAW,OAAO,CAAE,QAAO;AACzC,MAAI,UAAU,WAAW,OAAO,CAAE,QAAO;AACzC,MAAI,UAAU,WAAW,MAAM,CAAE,QAAO;;AAG1C,QAAO;;;;;;AAOT,eAAe,kBACb,YACA,YACe;AAEf,OAAM,MAAM,YAAY,CAAC,UAAU,EA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
1
|
{
|
|
2
2
|
"name": "@editframe/create",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.1-beta",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-editframe": "dist/index.js"
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"license": "UNLICENSED",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"chalk": "^5.3.0",
|
|
25
|
-
"prompts": "^2.4.2"
|
|
25
|
+
"prompts": "^2.4.2",
|
|
26
|
+
"execa": "^9.5.2"
|
|
26
27
|
},
|
|
27
28
|
"module": "./dist/index.js",
|
|
28
29
|
"types": "./dist/index.d.ts",
|