Skip to content

Commit

Permalink
build: split packages to untangle dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
irishcarbomb777 committed May 14, 2024
1 parent d8f2ffa commit f4415ef
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 9 deletions.
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,24 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./neo4j": {
"types": "./dist/neo4j/index.d.ts",
"import": "./dist/neo4j/index.js",
"require": "./dist/neo4j/index.cjs"
},
"./next": {
"types": "./dist/next/index.d.ts",
"import": "./dist/next/index.js",
"require": "./dist/next/index.cjs"
},
"./react": {
"types": "./dist/react/index.d.ts",
"import": "./dist/react/index.js",
"require": "./dist/react/index.cjs"
}
},
"files": [
Expand Down Expand Up @@ -62,4 +78,4 @@
"tsx": "^4.7.2",
"typescript": "^5.4.5"
}
}
}
2 changes: 2 additions & 0 deletions src/index.neo4j.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './index'
export * from './layers/Neo4j/defineNeo4jLayer'
2 changes: 2 additions & 0 deletions src/index.nextjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './index'
export * from './layers/NextjsCache/defineNextjsCacheLayer'
2 changes: 2 additions & 0 deletions src/index.react.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './index'
export * from './layers/ReactCache/defineReactCacheLayer'
4 changes: 0 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

export * from './base/defineBaseGraph'
export * from './base/defineNode'
export * from './layers/Neo4j/defineNeo4jLayer'
export * from './layers/NextjsCache/defineNextjsCacheLayer'
export * from './layers/ReactCache/defineReactCacheLayer'


// Types
export * from './types/GraphLayer'
Expand Down
24 changes: 20 additions & 4 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src/index.ts"],

const baseOptions = {
sourcemap: true,
clean: true,
shims: true,
dts: true,
format: ["esm", 'cjs'],
});
format: ["cjs", 'esm'],
} as Partial<Parameters<typeof defineConfig>[0]>;

export default defineConfig([{
entry: { index: "src/index.ts" },
...baseOptions
}, {
entry: { "neo4j/index": "src/index.neo4j.ts" },
...baseOptions
}, {
entry: { "nextjs/index": "src/index.nextjs.ts" },
...baseOptions,
banner: { js: `'use server'` }
}, {
entry: { "react/index": "src/index.react.ts" },
...baseOptions
}]);

0 comments on commit f4415ef

Please sign in to comment.