create-mastra 0.17.1 → 0.17.3-alpha.0
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/CHANGELOG.md +6 -0
- package/dist/index.js +15 -16
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1940,7 +1940,6 @@ export const mastra = new Mastra({
|
|
|
1940
1940
|
throw err;
|
|
1941
1941
|
}
|
|
1942
1942
|
};
|
|
1943
|
-
yoctoSpinner({ text: "Installing Mastra core dependencies\n" });
|
|
1944
1943
|
var getAPIKey = async (provider) => {
|
|
1945
1944
|
let key = "OPENAI_API_KEY";
|
|
1946
1945
|
switch (provider) {
|
|
@@ -2084,19 +2083,19 @@ Note: you will need to go into Cursor Settings -> MCP Settings and manually enab
|
|
|
2084
2083
|
);
|
|
2085
2084
|
}
|
|
2086
2085
|
if (editor === `cursor-global`) {
|
|
2087
|
-
const
|
|
2086
|
+
const confirm = await ve({
|
|
2088
2087
|
message: `Global install will add/update ${cursorGlobalMCPConfigPath} and make the Mastra docs MCP server available in all your Cursor projects. Continue?`,
|
|
2089
2088
|
options: [
|
|
2090
2089
|
{ value: "yes", label: "Yes, I understand" },
|
|
2091
2090
|
{ value: "skip", label: "No, skip for now" }
|
|
2092
2091
|
]
|
|
2093
2092
|
});
|
|
2094
|
-
if (
|
|
2093
|
+
if (confirm !== `yes`) {
|
|
2095
2094
|
return void 0;
|
|
2096
2095
|
}
|
|
2097
2096
|
}
|
|
2098
2097
|
if (editor === `windsurf`) {
|
|
2099
|
-
const
|
|
2098
|
+
const confirm = await ve({
|
|
2100
2099
|
message: `Windsurf only supports a global MCP config (at ${windsurfGlobalMCPConfigPath}) is it ok to add/update that global config?
|
|
2101
2100
|
This means the Mastra docs MCP server will be available in all your Windsurf projects.`,
|
|
2102
2101
|
options: [
|
|
@@ -2104,7 +2103,7 @@ This means the Mastra docs MCP server will be available in all your Windsurf pro
|
|
|
2104
2103
|
{ value: "skip", label: "No, skip for now" }
|
|
2105
2104
|
]
|
|
2106
2105
|
});
|
|
2107
|
-
if (
|
|
2106
|
+
if (confirm !== `yes`) {
|
|
2108
2107
|
return void 0;
|
|
2109
2108
|
}
|
|
2110
2109
|
}
|
|
@@ -2154,10 +2153,10 @@ var exec2 = util.promisify(child_process.exec);
|
|
|
2154
2153
|
async function cloneTemplate(options) {
|
|
2155
2154
|
const { template, projectName, targetDir } = options;
|
|
2156
2155
|
const projectPath = targetDir ? path.resolve(targetDir, projectName) : path.resolve(projectName);
|
|
2157
|
-
const
|
|
2156
|
+
const spinner4 = yoctoSpinner({ text: `Cloning template "${template.title}"...` }).start();
|
|
2158
2157
|
try {
|
|
2159
2158
|
if (await directoryExists(projectPath)) {
|
|
2160
|
-
|
|
2159
|
+
spinner4.error(`Directory ${projectName} already exists`);
|
|
2161
2160
|
throw new Error(`Directory ${projectName} already exists`);
|
|
2162
2161
|
}
|
|
2163
2162
|
await cloneRepositoryWithoutGit(template.githubUrl, projectPath);
|
|
@@ -2166,10 +2165,10 @@ async function cloneTemplate(options) {
|
|
|
2166
2165
|
if (await fileExists(envExamplePath)) {
|
|
2167
2166
|
await fs4.copyFile(envExamplePath, path.join(projectPath, ".env"));
|
|
2168
2167
|
}
|
|
2169
|
-
|
|
2168
|
+
spinner4.success(`Template "${template.title}" cloned successfully to ${projectName}`);
|
|
2170
2169
|
return projectPath;
|
|
2171
2170
|
} catch (error) {
|
|
2172
|
-
|
|
2171
|
+
spinner4.error(`Failed to clone template: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2173
2172
|
throw error;
|
|
2174
2173
|
}
|
|
2175
2174
|
}
|
|
@@ -2224,16 +2223,16 @@ async function updatePackageJson(projectPath, projectName) {
|
|
|
2224
2223
|
}
|
|
2225
2224
|
}
|
|
2226
2225
|
async function installDependencies(projectPath, packageManager) {
|
|
2227
|
-
const
|
|
2226
|
+
const spinner4 = yoctoSpinner({ text: "Installing dependencies..." }).start();
|
|
2228
2227
|
try {
|
|
2229
2228
|
const pm = packageManager || getPackageManager();
|
|
2230
2229
|
const installCommand = shellQuote2.quote([pm, "install"]);
|
|
2231
2230
|
await exec2(installCommand, {
|
|
2232
2231
|
cwd: projectPath
|
|
2233
2232
|
});
|
|
2234
|
-
|
|
2233
|
+
spinner4.success("Dependencies installed successfully");
|
|
2235
2234
|
} catch (error) {
|
|
2236
|
-
|
|
2235
|
+
spinner4.error(`Failed to install dependencies: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2237
2236
|
throw error;
|
|
2238
2237
|
}
|
|
2239
2238
|
}
|
|
@@ -2696,16 +2695,16 @@ async function createFromTemplate(args2) {
|
|
|
2696
2695
|
selectedTemplate = selected;
|
|
2697
2696
|
} else if (args2.template && typeof args2.template === "string") {
|
|
2698
2697
|
if (isGitHubUrl(args2.template)) {
|
|
2699
|
-
const
|
|
2700
|
-
|
|
2698
|
+
const spinner4 = Y();
|
|
2699
|
+
spinner4.start("Validating GitHub repository...");
|
|
2701
2700
|
const validation = await validateGitHubProject(args2.template);
|
|
2702
2701
|
if (!validation.isValid) {
|
|
2703
|
-
|
|
2702
|
+
spinner4.stop("Validation failed");
|
|
2704
2703
|
M.error("This does not appear to be a valid Mastra project:");
|
|
2705
2704
|
validation.errors.forEach((error) => M.error(` - ${error}`));
|
|
2706
2705
|
throw new Error("Invalid Mastra project");
|
|
2707
2706
|
}
|
|
2708
|
-
|
|
2707
|
+
spinner4.stop("Valid Mastra project \u2713");
|
|
2709
2708
|
selectedTemplate = await createFromGitHubUrl(args2.template);
|
|
2710
2709
|
} else {
|
|
2711
2710
|
const templates = await loadTemplates();
|