Skip to content

Commit

Permalink
feat: decrease bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-dixit committed Dec 14, 2024
1 parent 502eb8a commit d5b58a4
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/python @angrybayblade @tushar-composio
/js @himanshu-dixit @plxity
/js @himanshu-dixit @plxity @utkarsh-dixit
9 changes: 8 additions & 1 deletion .github/workflows/release_js_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ jobs:
- name: Install packages in js folder
run: pnpm install --frozen-lockfile

- name: Bump version
run: ./bump_version.sh ${{ github.event.inputs.version }}

- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: pnpm build
run: pnpm build


- name: pnpm build cli
run: pnpm build:cli

- name: pnpm publish
working-directory: js/dist
run: |
if ${{ github.event.inputs.isRCRelease }}; then
pnpm publish --no-git-checks --tag rc
Expand Down
27 changes: 27 additions & 0 deletions js/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Get the current version from package.dist.json and package.json
current_version=$(grep '"version":' package.dist.json | cut -d'"' -f4)
current_version_pkg=$(grep '"version":' package.json | cut -d'"' -f4)

# Get new version from argument or prompt user
if [ -z "$1" ]; then
echo "Current version in package.dist.json is: $current_version"
echo "Current version in package.json is: $current_version_pkg"
echo "Enter new version:"
read new_version
else
new_version=$1
fi

# Update version in package.dist.json
sed -i '' "s/\"version\": \"$current_version\"/\"version\": \"$new_version\"/" package.dist.json

# Update version in package.json
sed -i '' "s/\"version\": \"$current_version_pkg\"/\"version\": \"$new_version\"/" package.json

# Update version in src/constants.js
sed -i '' "s/COMPOSIO_VERSION = \`$current_version\`/COMPOSIO_VERSION = \`$new_version\`/" src/constants.js

echo "Version updated from $current_version to $new_version in package.dist.json"
echo "Version updated from $current_version_pkg to $new_version in package.json"
19 changes: 19 additions & 0 deletions js/package.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "composio-core",
"version": "0.4.4-beta",
"description": "",
"main": "index.js",
"scripts": {},
"bin": {
"composio-js": "./cli/index",
"composio": "./cli/index"
},
"lint-staged": {},
"keywords": [],
"author": "Utkarsh Dixit <[email protected]>",
"license": "ISC",
"devDependencies": {},
"publishConfig": {
"access": "public"
}
}
8 changes: 1 addition & 7 deletions js/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,5 @@ export default [
// List any external dependencies here
]
},
...generateBundleAndTypeBundles('index'),
...generateBundleAndTypeBundles('frameworks/cloudflare'),
...generateBundleAndTypeBundles('frameworks/langchain'),
...generateBundleAndTypeBundles('frameworks/openai'),
...generateBundleAndTypeBundles('frameworks/langgraph'),
...generateBundleAndTypeBundles('frameworks/vercel'),
...generateBundleAndTypeBundles('sdk/index'),
...generateBundleAndTypeBundles('index')
];
3 changes: 1 addition & 2 deletions js/setup_cli.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# cp src/constants.js dist/cli/constants.js
cp src/constants.js dist/constants.js
# mv lib/src/cli/index.js lib/src/cli/index
cat <<EOF > temp_file
#!/usr/bin/env node
$(cat dist/cli/index.js)
Expand All @@ -9,4 +8,4 @@ mv temp_file dist/cli/index

rm dist/cli/index.js


cp package.dist.json dist/package.json

0 comments on commit d5b58a4

Please sign in to comment.