Skip to content

Commit c7120dd

Browse files
authored
fix: missing artifacts for the agents packages (#193)
## Description An incorrect command was used to build both agent-bridge and agent-shared, resulting in missing .cjs artifacts. This pull request fixes the issue by running Vite instead of the TypeScript compiler.
1 parent 6baaac8 commit c7120dd

6 files changed

Lines changed: 58 additions & 28 deletions

File tree

packages/agent-bridge/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.5.0",
44
"description": "React hook API for registering agent tools in React Native",
55
"type": "module",
6-
"main": "./dist/index.cjs",
6+
"main": "./dist/index.js",
77
"module": "./dist/index.js",
88
"types": "./dist/index.d.ts",
99
"files": [
@@ -26,14 +26,17 @@
2626
"author": "Szymon Chmal <szymon.chmal@callstack.com>",
2727
"license": "MIT",
2828
"scripts": {
29-
"build": "tsc -b tsconfig.lib.json",
29+
"build": "vite build",
30+
"typecheck": "tsc -p tsconfig.lib.json --noEmit",
3031
"clean": "rm -rf dist"
3132
},
3233
"exports": {
34+
"./package.json": "./package.json",
3335
".": {
36+
"development": "./src/index.ts",
3437
"types": "./dist/index.d.ts",
3538
"import": "./dist/index.js",
36-
"require": "./dist/index.js"
39+
"require": "./dist/index.cjs"
3740
}
3841
},
3942
"dependencies": {

packages/agent-bridge/tsconfig.lib.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@
55
"rootDir": "src",
66
"outDir": "dist",
77
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
8-
"declaration": true,
9-
"declarationMap": true,
10-
"composite": true,
11-
"emitDeclarationOnly": false,
8+
"emitDeclarationOnly": true,
129
"forceConsistentCasingInFileNames": true,
13-
"types": ["node"],
10+
"types": ["node", "vite/client"],
1411
"lib": ["dom", "ES2022"],
1512
"jsx": "react-jsx",
16-
"module": "NodeNext",
17-
"moduleResolution": "NodeNext",
18-
"target": "ES2022"
13+
"esModuleInterop": true
1914
},
2015
"include": ["src/**/*.ts", "src/**/*.tsx"],
2116
"references": [
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
/// <reference types='vitest' />
22
import { defineConfig } from 'vite';
3-
import { resolve } from 'path';
3+
import path, { resolve } from 'node:path';
44
import dts from 'vite-plugin-dts';
55

66
export default defineConfig({
7+
root: __dirname,
8+
cacheDir: '../../node_modules/.vite/agent-bridge',
9+
base: './',
710
plugins: [
811
dts({
9-
tsconfigPath: './tsconfig.lib.json',
12+
entryRoot: 'src',
13+
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
14+
rollupTypes: true,
1015
}),
1116
],
12-
root: __dirname,
13-
cacheDir: '../../node_modules/.vite/agent-bridge',
14-
base: './',
1517
build: {
18+
ssr: true,
1619
lib: {
1720
entry: resolve(__dirname, 'src/index.ts'),
18-
fileName: 'index',
19-
formats: ['es', 'cjs'],
21+
formats: ['es' as const, 'cjs' as const],
2022
},
2123
rollupOptions: {
2224
external: ['react', '@rozenite/plugin-bridge'],
2325
},
2426
},
27+
server: {
28+
port: 3000,
29+
open: true,
30+
},
2531
});

packages/agent-shared/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@
2525
"author": "Szymon Chmal <szymon.chmal@callstack.com>",
2626
"license": "MIT",
2727
"scripts": {
28-
"build": "tsc -b tsconfig.lib.json",
28+
"build": "vite build",
29+
"typecheck": "tsc -p tsconfig.lib.json --noEmit",
2930
"clean": "rm -rf dist"
3031
},
3132
"exports": {
33+
"./package.json": "./package.json",
3234
".": {
35+
"development": "./src/index.ts",
3336
"types": "./dist/index.d.ts",
3437
"import": "./dist/index.js",
35-
"require": "./dist/index.js"
38+
"require": "./dist/index.cjs"
3639
}
3740
},
3841
"dependencies": {

packages/agent-shared/tsconfig.lib.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
"rootDir": "src",
66
"outDir": "dist",
77
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
8-
"declaration": true,
9-
"declarationMap": true,
10-
"composite": true,
11-
"emitDeclarationOnly": false,
8+
"emitDeclarationOnly": true,
129
"forceConsistentCasingInFileNames": true,
13-
"lib": ["ES2022"],
14-
"module": "NodeNext",
15-
"moduleResolution": "NodeNext",
16-
"target": "ES2022"
10+
"types": ["node", "vite/client"],
11+
"esModuleInterop": true
1712
},
1813
"include": ["src/**/*.ts"]
1914
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// <reference types='vitest' />
2+
import { defineConfig } from 'vite';
3+
import path, { resolve } from 'node:path';
4+
import dts from 'vite-plugin-dts';
5+
6+
export default defineConfig({
7+
root: __dirname,
8+
cacheDir: '../../node_modules/.vite/agent-shared',
9+
base: './',
10+
plugins: [
11+
dts({
12+
entryRoot: 'src',
13+
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
14+
rollupTypes: true,
15+
}),
16+
],
17+
build: {
18+
ssr: true,
19+
lib: {
20+
entry: resolve(__dirname, 'src/index.ts'),
21+
formats: ['es' as const, 'cjs' as const],
22+
},
23+
},
24+
server: {
25+
port: 3000,
26+
open: true,
27+
},
28+
});

0 commit comments

Comments
 (0)