create-mastra 0.1.3-alpha.0 → 0.1.4-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/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
- await execWithTimeout(`${pm} i -D mastra@latest`);
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@latest`);
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,20 @@ async function getPackageVersion() {
1700
1703
  const content = await fsExtra.readJSON(pkgJsonPath);
1701
1704
  return content.version;
1702
1705
  }
1706
+ function getCreateVersionTag() {
1707
+ const createArg = process.argv.find(
1708
+ (arg) => arg.startsWith("create-mastra@") || arg.startsWith("mastra@") || arg === "create-mastra" || arg === "mastra"
1709
+ );
1710
+ if (!createArg) return void 0;
1711
+ const tagMatch = createArg.match(/@([a-zA-Z]+)$/);
1712
+ if (tagMatch) {
1713
+ return tagMatch[1];
1714
+ }
1715
+ return void 0;
1716
+ }
1703
1717
 
1704
1718
  const version = await getPackageVersion();
1719
+ const createVersionTag = getCreateVersionTag();
1705
1720
  const analytics = new PosthogAnalytics({
1706
1721
  apiKey: "phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT",
1707
1722
  host: "https://us.posthog.com",
@@ -1722,7 +1737,8 @@ program.name("create-mastra").description("Create a new Mastra project").option(
1722
1737
  await create({
1723
1738
  components: ["agents", "tools", "workflows"],
1724
1739
  llmProvider: "openai",
1725
- addExample: false
1740
+ addExample: false,
1741
+ createVersionTag
1726
1742
  });
1727
1743
  return;
1728
1744
  }
@@ -1730,7 +1746,8 @@ program.name("create-mastra").description("Create a new Mastra project").option(
1730
1746
  components: args.components ? args.components.split(",") : [],
1731
1747
  llmProvider: args.llm,
1732
1748
  addExample: args.example,
1733
- llmApiKey: args["llm-api-key"]
1749
+ llmApiKey: args["llm-api-key"],
1750
+ createVersionTag
1734
1751
  });
1735
1752
  });
1736
1753
  program.parse(process.argv);