mastra 0.1.57-unstable.37 → 0.1.57-unstable.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastra",
3
- "version": "0.1.57-unstable.37",
3
+ "version": "0.1.57-unstable.38",
4
4
  "license": "MIT",
5
5
  "description": "cli for mastra",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "src/starter-files",
14
14
  "src/scripts",
15
15
  "src/chat/agent/dist",
16
- ".npmrc"
16
+ "node_modules"
17
17
  ],
18
18
  "keywords": [
19
19
  "mastra",
@@ -64,11 +64,9 @@
64
64
  "typescript": "^5.5.4",
65
65
  "yocto-spinner": "^0.1.1",
66
66
  "zod": "^3.24.0",
67
- "js-yaml": "^4.1.0",
68
- "lodash": "^4.17.21",
69
- "swagger-ui-dist": "^5.0.0",
70
- "glob-promise": "^6.0.0",
71
- "@mastra/core": "0.1.27-alpha.30"
67
+ "jest": "^29.7.0",
68
+ "ts-jest": "^29.2.4",
69
+ "@mastra/core": "0.1.27-alpha.32"
72
70
  },
73
71
  "devDependencies": {
74
72
  "@types/express": "^5.0.0",
@@ -83,22 +81,23 @@
83
81
  "autoprefixer": "^10.4.20",
84
82
  "eslint-plugin-react-hooks": "^5.0.0",
85
83
  "eslint-plugin-react-refresh": "^0.4.14",
86
- "jest": "^29.7.0",
87
84
  "postcss": "^8.4.49",
88
85
  "tailwindcss": "^3.4.16",
89
- "ts-jest": "^29.2.4",
90
86
  "vite": "^6.0.3",
91
87
  "vitest": "^2.1.8"
92
88
  },
93
89
  "scripts": {
94
- "build": "npx tsc && cp -r src/starter-files dist/ && cd src/chat/agent && vite build && cd ../../..",
90
+ "build": "npx tsc && cp -r src/starter-files dist/ && cd src/chat/agent && vite build && cd ../../.. && cd src/homepage && vite build && cd ../..",
95
91
  "build:dev": "npx tsc --watch",
96
92
  "build:agent-chat": "cd src/chat/agent && vite build",
97
93
  "dev:agent-chat": "cd src/chat/agent && vite",
94
+ "build:homepage": "cd src/homepage && vite build",
95
+ "dev:homepage": "cd src/homepage && vite",
98
96
  "init": "npx tsx src/index.ts init",
99
97
  "dev": "npx tsx src/index.ts dev",
100
98
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
101
99
  "clean": "rm -rf dist && rm -rf node_modules",
102
- "typecheck": "tsc --noEmit --incremental"
100
+ "typecheck": "tsc --noEmit --incremental",
101
+ "postinstall": "node src/scripts/postinstall.js"
103
102
  }
104
103
  }
@@ -1,3 +1,73 @@
1
- process.stdout.write('\nThank you for installing Mastra!\n');
2
- process.stdout.write('Install @mastra/core in your Next.js project then run "mastra init" to get started.\n');
3
- process.stdout.write('Visit https://mastra.ai/docs to read the docs.\n\n');
1
+ import { execSync } from 'child_process';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ // Skip postinstall in CI and production environments
6
+ if (process.env.CI || process.env.NODE_ENV === 'production') {
7
+ console.log('Skipping postinstall in CI/production environment');
8
+ process.exit(0);
9
+ }
10
+
11
+ // Prevent recursive execution
12
+ if (process.env.PREVENT_POSTINSTALL_RECURSION) {
13
+ console.log('Skipping recursive postinstall');
14
+ process.exit(0);
15
+ }
16
+
17
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
+ const packageRoot = path.resolve(__dirname, '..', '..');
19
+
20
+ function detectPackageManager() {
21
+ const userAgent = process.env.npm_config_user_agent || '';
22
+ const execPath = process.env.npm_execpath || '';
23
+
24
+ // Check user agent first
25
+ if (userAgent.includes('yarn')) {
26
+ return 'yarn';
27
+ }
28
+ if (userAgent.includes('pnpm')) {
29
+ return 'pnpm';
30
+ }
31
+ if (userAgent.includes('npm')) {
32
+ return 'npm';
33
+ }
34
+
35
+ // Fallback to execpath check
36
+ if (execPath.includes('yarn')) {
37
+ return 'yarn';
38
+ }
39
+ if (execPath.includes('pnpm')) {
40
+ return 'pnpm';
41
+ }
42
+ if (execPath.includes('npm')) {
43
+ return 'npm';
44
+ }
45
+
46
+ return 'npm'; // Default fallback
47
+ }
48
+
49
+ try {
50
+ const packageManager = detectPackageManager();
51
+ const installCmd = {
52
+ npm: 'npm install',
53
+ yarn: 'yarn install',
54
+ pnpm: 'pnpm install --shamefully-hoist --filter . --force --silent',
55
+ }[packageManager];
56
+
57
+ console.log(`Detected package manager: ${packageManager}`);
58
+ console.log(`Running ${installCmd} in ${packageRoot}`);
59
+
60
+ execSync(installCmd, {
61
+ cwd: packageRoot,
62
+ stdio: 'inherit',
63
+ env: {
64
+ ...process.env,
65
+ PREVENT_POSTINSTALL_RECURSION: 'true',
66
+ PNPM_RECURSIVE_INSTALL_FORCE: 'true',
67
+ PNPM_NO_WARN_HEADLESS: '1',
68
+ },
69
+ });
70
+ } catch (error) {
71
+ console.error('Failed to run install:', error);
72
+ process.exit(1);
73
+ }
package/.npmrc DELETED
@@ -1,2 +0,0 @@
1
- store-dir=./.pnpm-store
2
- virtual-store-dir=node_modules/.pnpm