create-mastra 0.1.3 → 0.1.4-alpha.1
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 +27 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/starter-files/workflow.ts +0 -182
- package/starter-files/config.ts +0 -28
- package/starter-files/mastra-pg.docker-compose.yaml +0 -15
- package/starter-files/tools.ts +0 -95
- package/starter-files/workflow.ts +0 -183
package/dist/index.js
CHANGED
|
@@ -1585,7 +1585,7 @@ var execWithTimeout = async (command, timeoutMs = 18e4) => {
|
|
|
1585
1585
|
throw error;
|
|
1586
1586
|
}
|
|
1587
1587
|
};
|
|
1588
|
-
var createMastraProject = async () => {
|
|
1588
|
+
var createMastraProject = async ({ createVersionTag }) => {
|
|
1589
1589
|
pe(color2.inverse("Mastra Create"));
|
|
1590
1590
|
const projectName = await ae({
|
|
1591
1591
|
message: "What do you want to name your project?",
|
|
@@ -1644,10 +1644,11 @@ var createMastraProject = async () => {
|
|
|
1644
1644
|
}' > tsconfig.json`);
|
|
1645
1645
|
s2.stop(`${pm} dependencies installed`);
|
|
1646
1646
|
s2.start("Installing mastra");
|
|
1647
|
-
|
|
1647
|
+
const versionTag = createVersionTag ? `@${createVersionTag}` : "@latest";
|
|
1648
|
+
await execWithTimeout(`${pm} i -D mastra${versionTag}`);
|
|
1648
1649
|
s2.stop("mastra installed");
|
|
1649
1650
|
s2.start("Installing @mastra/core");
|
|
1650
|
-
await execWithTimeout(`${pm} i @mastra/core
|
|
1651
|
+
await execWithTimeout(`${pm} i @mastra/core${versionTag}`);
|
|
1651
1652
|
s2.stop("@mastra/core installed");
|
|
1652
1653
|
s2.start("Adding .gitignore");
|
|
1653
1654
|
await exec3(`echo output.txt >> .gitignore`);
|
|
@@ -1663,7 +1664,9 @@ var createMastraProject = async () => {
|
|
|
1663
1664
|
return { projectName };
|
|
1664
1665
|
};
|
|
1665
1666
|
var create = async (args) => {
|
|
1666
|
-
const { projectName } = await createMastraProject(
|
|
1667
|
+
const { projectName } = await createMastraProject({
|
|
1668
|
+
createVersionTag: args?.createVersionTag
|
|
1669
|
+
});
|
|
1667
1670
|
const directory = "/src";
|
|
1668
1671
|
if (!args.components || !args.llmProvider || !args.addExample) {
|
|
1669
1672
|
const result = await interactivePrompt();
|
|
@@ -1700,8 +1703,24 @@ async function getPackageVersion() {
|
|
|
1700
1703
|
const content = await fsExtra.readJSON(pkgJsonPath);
|
|
1701
1704
|
return content.version;
|
|
1702
1705
|
}
|
|
1706
|
+
async function getCreateVersionTag() {
|
|
1707
|
+
try {
|
|
1708
|
+
const binPath = process.argv[1];
|
|
1709
|
+
const binDir = dirname(binPath);
|
|
1710
|
+
const pkgJsonPath = path.join(binDir, "..", "create-mastra", "package.json");
|
|
1711
|
+
const content = await fsExtra.readJSON(pkgJsonPath);
|
|
1712
|
+
if (content.version?.includes("-")) {
|
|
1713
|
+
const tag = content.version.split("-")[1].split(".")[0];
|
|
1714
|
+
return tag;
|
|
1715
|
+
}
|
|
1716
|
+
} catch (error) {
|
|
1717
|
+
console.error("Error getting create-mastra version tag:", error);
|
|
1718
|
+
}
|
|
1719
|
+
return void 0;
|
|
1720
|
+
}
|
|
1703
1721
|
|
|
1704
1722
|
const version = await getPackageVersion();
|
|
1723
|
+
const createVersionTag = await getCreateVersionTag();
|
|
1705
1724
|
const analytics = new PosthogAnalytics({
|
|
1706
1725
|
apiKey: "phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT",
|
|
1707
1726
|
host: "https://us.posthog.com",
|
|
@@ -1722,7 +1741,8 @@ program.name("create-mastra").description("Create a new Mastra project").option(
|
|
|
1722
1741
|
await create({
|
|
1723
1742
|
components: ["agents", "tools", "workflows"],
|
|
1724
1743
|
llmProvider: "openai",
|
|
1725
|
-
addExample: false
|
|
1744
|
+
addExample: false,
|
|
1745
|
+
createVersionTag
|
|
1726
1746
|
});
|
|
1727
1747
|
return;
|
|
1728
1748
|
}
|
|
@@ -1730,7 +1750,8 @@ program.name("create-mastra").description("Create a new Mastra project").option(
|
|
|
1730
1750
|
components: args.components ? args.components.split(",") : [],
|
|
1731
1751
|
llmProvider: args.llm,
|
|
1732
1752
|
addExample: args.example,
|
|
1733
|
-
llmApiKey: args["llm-api-key"]
|
|
1753
|
+
llmApiKey: args["llm-api-key"],
|
|
1754
|
+
createVersionTag
|
|
1734
1755
|
});
|
|
1735
1756
|
});
|
|
1736
1757
|
program.parse(process.argv);
|