Skip to content

Commit b96eff5

Browse files
cmwhitedmarcusreinnikgraf
authored
fix(typesync | publish): tsup and package.json updates for publishing (#218)
Co-authored-by: Marcus Rein <[email protected]> Co-authored-by: Nik Graf <[email protected]>
1 parent 42d9a3b commit b96eff5

File tree

17 files changed

+1232
-1122
lines changed

17 files changed

+1232
-1122
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,7 @@ typings/
6868
*.tsbuildinfo
6969
next-env.d.ts
7070

71-
.DS_Store
71+
.DS_Store
72+
73+
# tanstack router output
74+
.tanstack

apps/typesync/client/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export const API_ROOT_URL = 'http://localhost:3000/api/v1';
2-
export const ROOT_SPACE_ID = '8ef40bdd-cf69-4ad7-a9a1-f71c15653994';
2+
export const ROOT_SPACE_ID = '64ed9ffa-e7b3-40f6-ae99-fbf6112d10f8';

apps/typesync/client/src/routeTree.gen.ts

Lines changed: 61 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -8,127 +8,88 @@
88
// You should NOT make any changes in this file as it will be overwritten.
99
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
1010

11-
// Import Routes
11+
import { Route as rootRouteImport } from './routes/__root';
12+
import { Route as IndexRouteImport } from './routes/index';
13+
import { Route as AppsCreateRouteImport } from './routes/apps/create';
14+
import { Route as AppsAppIdDetailsRouteImport } from './routes/apps/$appId/details';
1215

13-
import { Route as rootRoute } from './routes/__root'
14-
import { Route as IndexImport } from './routes/index'
15-
import { Route as AppsCreateImport } from './routes/apps/create'
16-
import { Route as AppsAppIdDetailsImport } from './routes/apps/$appId/details'
17-
18-
// Create/Update Routes
19-
20-
const IndexRoute = IndexImport.update({
16+
const IndexRoute = IndexRouteImport.update({
2117
id: '/',
2218
path: '/',
23-
getParentRoute: () => rootRoute,
24-
} as any)
25-
26-
const AppsCreateRoute = AppsCreateImport.update({
19+
getParentRoute: () => rootRouteImport,
20+
} as any);
21+
const AppsCreateRoute = AppsCreateRouteImport.update({
2722
id: '/apps/create',
2823
path: '/apps/create',
29-
getParentRoute: () => rootRoute,
30-
} as any)
31-
32-
const AppsAppIdDetailsRoute = AppsAppIdDetailsImport.update({
24+
getParentRoute: () => rootRouteImport,
25+
} as any);
26+
const AppsAppIdDetailsRoute = AppsAppIdDetailsRouteImport.update({
3327
id: '/apps/$appId/details',
3428
path: '/apps/$appId/details',
35-
getParentRoute: () => rootRoute,
36-
} as any)
37-
38-
// Populate the FileRoutesByPath interface
39-
40-
declare module '@tanstack/react-router' {
41-
interface FileRoutesByPath {
42-
'/': {
43-
id: '/'
44-
path: '/'
45-
fullPath: '/'
46-
preLoaderRoute: typeof IndexImport
47-
parentRoute: typeof rootRoute
48-
}
49-
'/apps/create': {
50-
id: '/apps/create'
51-
path: '/apps/create'
52-
fullPath: '/apps/create'
53-
preLoaderRoute: typeof AppsCreateImport
54-
parentRoute: typeof rootRoute
55-
}
56-
'/apps/$appId/details': {
57-
id: '/apps/$appId/details'
58-
path: '/apps/$appId/details'
59-
fullPath: '/apps/$appId/details'
60-
preLoaderRoute: typeof AppsAppIdDetailsImport
61-
parentRoute: typeof rootRoute
62-
}
63-
}
64-
}
65-
66-
// Create and export the route tree
29+
getParentRoute: () => rootRouteImport,
30+
} as any);
6731

6832
export interface FileRoutesByFullPath {
69-
'/': typeof IndexRoute
70-
'/apps/create': typeof AppsCreateRoute
71-
'/apps/$appId/details': typeof AppsAppIdDetailsRoute
33+
'/': typeof IndexRoute;
34+
'/apps/create': typeof AppsCreateRoute;
35+
'/apps/$appId/details': typeof AppsAppIdDetailsRoute;
7236
}
73-
7437
export interface FileRoutesByTo {
75-
'/': typeof IndexRoute
76-
'/apps/create': typeof AppsCreateRoute
77-
'/apps/$appId/details': typeof AppsAppIdDetailsRoute
38+
'/': typeof IndexRoute;
39+
'/apps/create': typeof AppsCreateRoute;
40+
'/apps/$appId/details': typeof AppsAppIdDetailsRoute;
7841
}
79-
8042
export interface FileRoutesById {
81-
__root__: typeof rootRoute
82-
'/': typeof IndexRoute
83-
'/apps/create': typeof AppsCreateRoute
84-
'/apps/$appId/details': typeof AppsAppIdDetailsRoute
43+
__root__: typeof rootRouteImport;
44+
'/': typeof IndexRoute;
45+
'/apps/create': typeof AppsCreateRoute;
46+
'/apps/$appId/details': typeof AppsAppIdDetailsRoute;
8547
}
86-
8748
export interface FileRouteTypes {
88-
fileRoutesByFullPath: FileRoutesByFullPath
89-
fullPaths: '/' | '/apps/create' | '/apps/$appId/details'
90-
fileRoutesByTo: FileRoutesByTo
91-
to: '/' | '/apps/create' | '/apps/$appId/details'
92-
id: '__root__' | '/' | '/apps/create' | '/apps/$appId/details'
93-
fileRoutesById: FileRoutesById
49+
fileRoutesByFullPath: FileRoutesByFullPath;
50+
fullPaths: '/' | '/apps/create' | '/apps/$appId/details';
51+
fileRoutesByTo: FileRoutesByTo;
52+
to: '/' | '/apps/create' | '/apps/$appId/details';
53+
id: '__root__' | '/' | '/apps/create' | '/apps/$appId/details';
54+
fileRoutesById: FileRoutesById;
9455
}
95-
9656
export interface RootRouteChildren {
97-
IndexRoute: typeof IndexRoute
98-
AppsCreateRoute: typeof AppsCreateRoute
99-
AppsAppIdDetailsRoute: typeof AppsAppIdDetailsRoute
57+
IndexRoute: typeof IndexRoute;
58+
AppsCreateRoute: typeof AppsCreateRoute;
59+
AppsAppIdDetailsRoute: typeof AppsAppIdDetailsRoute;
60+
}
61+
62+
declare module '@tanstack/react-router' {
63+
interface FileRoutesByPath {
64+
'/': {
65+
id: '/';
66+
path: '/';
67+
fullPath: '/';
68+
preLoaderRoute: typeof IndexRouteImport;
69+
parentRoute: typeof rootRouteImport;
70+
};
71+
'/apps/create': {
72+
id: '/apps/create';
73+
path: '/apps/create';
74+
fullPath: '/apps/create';
75+
preLoaderRoute: typeof AppsCreateRouteImport;
76+
parentRoute: typeof rootRouteImport;
77+
};
78+
'/apps/$appId/details': {
79+
id: '/apps/$appId/details';
80+
path: '/apps/$appId/details';
81+
fullPath: '/apps/$appId/details';
82+
preLoaderRoute: typeof AppsAppIdDetailsRouteImport;
83+
parentRoute: typeof rootRouteImport;
84+
};
85+
}
10086
}
10187

10288
const rootRouteChildren: RootRouteChildren = {
10389
IndexRoute: IndexRoute,
10490
AppsCreateRoute: AppsCreateRoute,
10591
AppsAppIdDetailsRoute: AppsAppIdDetailsRoute,
106-
}
107-
108-
export const routeTree = rootRoute
92+
};
93+
export const routeTree = rootRouteImport
10994
._addFileChildren(rootRouteChildren)
110-
._addFileTypes<FileRouteTypes>()
111-
112-
/* ROUTE_MANIFEST_START
113-
{
114-
"routes": {
115-
"__root__": {
116-
"filePath": "__root.tsx",
117-
"children": [
118-
"/",
119-
"/apps/create",
120-
"/apps/$appId/details"
121-
]
122-
},
123-
"/": {
124-
"filePath": "index.tsx"
125-
},
126-
"/apps/create": {
127-
"filePath": "apps/create.tsx"
128-
},
129-
"/apps/$appId/details": {
130-
"filePath": "apps/$appId/details.tsx"
131-
}
132-
}
133-
}
134-
ROUTE_MANIFEST_END */
95+
._addFileTypes<FileRouteTypes>();

apps/typesync/package.json

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "@graphprotocol/typesync-cli",
3-
"version": "0.0.0-alpha",
2+
"name": "@graphprotocol/hypergraph-cli",
3+
"version": "0.0.0-alpha.19",
44
"type": "module",
55
"license": "MIT",
66
"description": "CLI toolchain to view existing types, select, pick, extend to create schemas and generate a @graphprotocol/hypergraph schema.",
77
"repository": {
88
"type": "git",
9-
"url": "https://github.com/graphprotocol/hypergraph.git",
9+
"url": "git+https://github.com/graphprotocol/hypergraph.git",
1010
"directory": "apps/typesync"
1111
},
1212
"publishConfig": {
@@ -15,50 +15,50 @@
1515
"linkDirectory": false
1616
},
1717
"bin": {
18-
"hypergraph": "./dist/bin.cjs",
19-
"hg": "./dist/bin.cjs"
18+
"hypergraph": "./dist/bin.js",
19+
"hg": "./dist/bin.js"
2020
},
2121
"files": ["README.md", "dist"],
2222
"scripts": {
2323
"codegen:gql": "graphql-codegen --config ./graphql.codegen.ts",
2424
"build:client": "vite build",
25-
"build": "rm -rf dist && pnpm run build:client && tsup && pnpm run copy-all",
25+
"build": "pnpm run clean && pnpm run build:client && tsup && pnpm run copy-all",
2626
"build:ts": "tsup",
27-
"dev": "vite build && pnpx tsx ./src/bin.ts",
27+
"dev": "vite build && pnpx tsx ./src/bin.ts typesync",
2828
"dev:cli": "pnpx tsx ./src/bin.ts typesync",
2929
"dev:client": "vite --force",
30-
"clean": "rimraf dist/*",
31-
"start": "node ./dist/bin.cjs",
30+
"clean": "rm -rf dist client/dist",
31+
"start": "node ./dist/bin.js",
3232
"check": "tsc --noEmit",
3333
"test": "vitest run",
3434
"coverage": "vitest run --coverage",
3535
"copy-package-json": "tsx scripts/copy-package-json.ts",
36-
"copy-db-migrations": "cp -rp ./src/migrations ./dist/migrations",
37-
"copy-client-dist": "mkdir -p ./dist/client && cp -rp ./client/dist ./dist/client/dist",
38-
"copy-all": "pnpm run copy-package-json && pnpm run copy-db-migrations && pnpm run copy-client-dist",
36+
"copy-client-dist": "tsx scripts/copy-client-dist.ts",
37+
"copy-all": "pnpm run copy-package-json && pnpm run copy-client-dist",
3938
"hypergraph": "pnpx tsx ./src/bin.ts typesync"
4039
},
4140
"devDependencies": {
42-
"@effect/cli": "latest",
41+
"@effect/cli": "^0.66.1",
4342
"@effect/experimental": "^0.51.1",
44-
"@effect/language-service": "latest",
45-
"@effect/platform": "latest",
46-
"@effect/platform-node": "latest",
47-
"@effect/sql": "latest",
48-
"@effect/sql-sqlite-node": "latest",
49-
"@effect/vitest": "latest",
50-
"@graphprotocol/grc-20": "^0.21.2",
51-
"@graphql-codegen/cli": "^5.0.6",
52-
"@graphql-codegen/client-preset": "^4.8.1",
43+
"@effect/language-service": "^0.23.3",
44+
"@effect/platform": "^0.87.1",
45+
"@effect/platform-node": "^0.88.3",
46+
"@effect/sql": "^0.40.1",
47+
"@effect/sql-sqlite-node": "^0.41.1",
48+
"@effect/vitest": "^0.23.10",
49+
"@graphprotocol/grc-20": "^0.21.3",
50+
"@graphql-codegen/cli": "^5.0.7",
51+
"@graphql-codegen/client-preset": "^4.8.3",
5352
"@graphql-codegen/typescript": "^4.1.6",
5453
"@graphql-codegen/typescript-operations": "^4.6.1",
55-
"@tanstack/router-plugin": "^1.120.13",
56-
"@types/node": "^22.15.29",
57-
"@types/react": "^19.1.6",
58-
"@types/react-dom": "^19.1.5",
59-
"@vitejs/plugin-react": "^4.5.0",
54+
"@tanstack/router-plugin": "^1.121.41",
55+
"@types/node": "^24.0.5",
56+
"@types/react": "^19.1.8",
57+
"@types/react-dom": "^19.1.6",
58+
"@vitejs/plugin-react": "^4.6.0",
59+
"glob": "^11.0.3",
6060
"tsup": "^8.5.0",
61-
"tsx": "^4.19.4",
61+
"tsx": "^4.20.3",
6262
"vite": "^6.3.5"
6363
},
6464
"dependencies": {
@@ -67,13 +67,13 @@
6767
"@heroicons/react": "^2.2.0",
6868
"@phosphor-icons/react": "^2.1.10",
6969
"@radix-ui/react-tabs": "^1.1.12",
70-
"@tailwindcss/vite": "^4.1.8",
71-
"@tanstack/react-form": "^1.12.1",
72-
"@tanstack/react-query": "^5.79.2",
73-
"@tanstack/react-query-devtools": "^5.79.2",
74-
"@tanstack/react-router": "^1.120.15",
75-
"@tanstack/react-router-devtools": "1.120.15",
76-
"better-sqlite3": "^11.10.0",
70+
"@tailwindcss/vite": "^4.1.11",
71+
"@tanstack/react-form": "^1.12.4",
72+
"@tanstack/react-query": "^5.81.4",
73+
"@tanstack/react-query-devtools": "^5.81.4",
74+
"@tanstack/react-router": "^1.121.41",
75+
"@tanstack/react-router-devtools": "1.121.41",
76+
"better-sqlite3": "^12.1.1",
7777
"date-fns": "^4.1.0",
7878
"effect": "^3.16.10",
7979
"graphql": "^16.11.0",
@@ -82,7 +82,7 @@
8282
"open": "^10.1.2",
8383
"react": "^19.1.0",
8484
"react-dom": "^19.1.0",
85-
"shiki": "^3.4.2",
86-
"tailwindcss": "^4.1.8"
85+
"shiki": "^3.7.0",
86+
"tailwindcss": "^4.1.11"
8787
}
8888
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { FileSystem, Path } from '@effect/platform';
2+
import { NodeContext } from '@effect/platform-node';
3+
import { Effect } from 'effect';
4+
5+
const program = Effect.gen(function* () {
6+
const fs = yield* FileSystem.FileSystem;
7+
const path = yield* Path.Path;
8+
9+
const src = path.resolve('./', 'client', 'dist');
10+
const dest = path.resolve('./', 'dist', 'client', 'dist');
11+
12+
yield* fs
13+
.makeDirectory(dest, { recursive: true })
14+
.pipe(Effect.andThen(() => fs.copy(src, dest, { overwrite: true })));
15+
16+
return yield* Effect.logInfo('[Build] Copied client/dist to dist/client/dist');
17+
}).pipe(Effect.provide(NodeContext.layer));
18+
19+
Effect.runPromise(program).catch(console.error);

apps/typesync/src/Database.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
import { fileURLToPath } from 'node:url';
2-
import * as NodeContext from '@effect/platform-node/NodeContext';
3-
import * as SqliteClient from '@effect/sql-sqlite-node/SqliteClient';
4-
import * as Migrator from '@effect/sql-sqlite-node/SqliteMigrator';
5-
import * as SqlClient from '@effect/sql/SqlClient';
6-
import * as SqlError from '@effect/sql/SqlError';
7-
import * as SqlResolver from '@effect/sql/SqlResolver';
8-
import * as SqlSchema from '@effect/sql/SqlSchema';
9-
import * as EffectArray from 'effect/Array';
10-
import * as Chunk from 'effect/Chunk';
11-
import * as Console from 'effect/Console';
12-
import * as Effect from 'effect/Effect';
13-
import * as Layer from 'effect/Layer';
14-
import * as Option from 'effect/Option';
15-
import * as Order from 'effect/Order';
16-
import * as Schema from 'effect/Schema';
17-
import * as Stream from 'effect/Stream';
2+
import { NodeContext } from '@effect/platform-node';
3+
import { SqlClient, SqlError, SqlResolver, SqlSchema } from '@effect/sql';
4+
import { SqliteMigrator as Migrator, SqliteClient } from '@effect/sql-sqlite-node';
5+
import { Chunk, Console, Effect, Array as EffectArray, Layer, Option, Order, Schema, Stream } from 'effect';
186

197
import * as TypesyncDomain from '../domain/Domain.js';
208
import * as Domain from './Domain.js';
219

2210
const SqlLive = SqliteClient.layer({
23-
filename: 'typesync.db',
11+
filename: '.typesync.db',
2412
});
2513
const MigratorLive = Migrator.layer({
2614
loader: Migrator.fromFileSystem(fileURLToPath(new URL('migrations', import.meta.url))),
27-
// Where to put the `_schema.sql` file
28-
schemaDirectory: 'src/migrations',
2915
}).pipe(Layer.provide(SqlLive));
3016

3117
const DatabaseLive = Layer.mergeAll(SqlLive, MigratorLive).pipe(Layer.provide(NodeContext.layer));

0 commit comments

Comments
 (0)