Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | /** |
| 2 | * This script updates the peer dependencies of all providers to the latest version of the core package. |
| 3 | * It reads the core package version from the core package's package.json file. |
| 4 | */ |
| 5 | |
| 6 | import fs from 'fs'; |
| 7 | import path from 'path'; |
| 8 | |
| 9 | const corePkgPackageJson = path.resolve(__dirname, '../ts/packages/core', 'package.json'); |
| 10 | const corePkg = JSON.parse(fs.readFileSync(corePkgPackageJson, 'utf-8')); |
| 11 | const coreVersion = corePkg.version; |
| 12 | |
| 13 | // skip if the core package is rc, alpha or beta |
| 14 | if (coreVersion.includes('rc') || coreVersion.includes('alpha') || coreVersion.includes('beta')) { |
| 15 | console.log(`✅ Current core version is ${coreVersion}`); |
| 16 | console.log( |
| 17 | '⚠️ Skipping update of peer dependencies for rc, alpha or beta versions of the core package' |
| 18 | ); |
| 19 | process.exit(0); |
| 20 | } |
| 21 | |
| 22 | const providersDir = path.resolve(__dirname, '../packages/providers'); |
| 23 | const providerDirs = fs.readdirSync(providersDir).filter(name => { |
| 24 | const fullPath = path.resolve(providersDir, name); |
| 25 | return fs.existsSync(path.join(fullPath, 'package.json')); |
| 26 | }); |
| 27 | |
| 28 | for (const provider of providerDirs) { |
| 29 | const providerPackageJson = path.resolve(providersDir, provider, 'package.json'); |
| 30 | const providerPkg = JSON.parse(fs.readFileSync(providerPackageJson, 'utf-8')); |
| 31 | providerPkg.peerDependencies['@composio/core'] = `^${coreVersion}`; |
| 32 | fs.writeFileSync(providerPackageJson, JSON.stringify(providerPkg, null, 2)); |
| 33 | console.log( |
| 34 | `✅ Updated peer dependency for ${provider} from ${providerPkg.peerDependencies['@composio/core']} -> ^${coreVersion}` |
| 35 | ); |
| 36 | } |