Skip to content

Commit c2b0e0c

Browse files
authored
feat(#365 | nextjs template): create nextjs template for create hypergraph command (#383)
1 parent 834c5af commit c2b0e0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3536
-472
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"access": "public",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
10-
"ignore": ["events", "next-example", "docs", "hypergraph-vite-react-template"],
10+
"ignore": ["events", "next-example", "docs", "hypergraph-vite-react-template", "hypergraph-template-nextjs"],
1111
"prettier": false
1212
}

apps/create-hypergraph/.npmignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Include .gitignore files in templates
2+
!template-*/.gitignore
3+
!dist/template-*/.gitignore
4+
5+
# Exclude source files
6+
src/
7+
scripts/
8+
test/
9+
*.ts
10+
!*.d.ts
11+
tsconfig*.json
12+
vitest.config.ts
13+
tsdown.config.ts

apps/create-hypergraph/CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# create-hypergraph
22

3+
## 0.3.3
4+
### Patch Changes
5+
6+
- c5822d5: Remove localhost syncServerUri from HypergraphAppProvider. uses default instead
7+
8+
## 0.3.2
9+
### Patch Changes
10+
11+
- 91eb4fb: Update llms.txt to include nextjs template for visibility to AI agents
12+
13+
## 0.3.1
14+
### Patch Changes
15+
16+
- 862688a: Update available create hypergraph templates in README to include nextjs for better visibility
17+
18+
## 0.3.0
19+
### Minor Changes
20+
21+
- fadccd2: Include a nextjs template for selection with the create-hypergraph command.
22+
23+
Example usage:
24+
25+
```bash
26+
pnpm create hypergraph@latest --template nextjs
27+
```
28+
329
## 0.2.0
430
### Minor Changes
531

apps/create-hypergraph/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Then follow the given prompts.
4141
- `--template` -> if provided, uses the provided template
4242
- options:
4343
- vite-react
44+
- nextjs
4445
- `--package-manager` -> if provided, uses the provided package manager
4546
- options:
4647
- pnpm
@@ -59,7 +60,8 @@ pnpm create hypergraph@latest --template vite-react --package-manager pnpm my-hy
5960

6061
### Currently Supported Templates
6162

62-
- vite + react
63+
- [vite + react](./template-vite-react/README.md)
64+
- [nextjs](./template-nextjs/README.md)
6365

6466
## References
6567

apps/create-hypergraph/llms.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ create-hypergraph is a CLI tool that scaffolds new Hypergraph-enabled applicatio
5959
### Options
6060

6161
- `--template, -t` (optional): Template to scaffold
62-
- Available values: `vite-react`
62+
- Available values: `vite-react`, `nextjs`
6363
- Default: prompts user to select
64-
- Currently only supports `vite-react` which scaffolds a Vite + React app using @tanstack/react-router
64+
- `vite-react`: Scaffolds a Vite + React app using @tanstack/react-router
65+
- `nextjs`: Scaffolds a Next.js app with App Router and Hypergraph integration
6566

6667
- `--package-manager, -p` (optional): The package manager to use for installing dependencies
6768
- Available values: `pnpm`, `bun`, `yarn`, `npm`
@@ -109,6 +110,13 @@ pnpm create hypergraph my-app --skip-install-deps --skip-initialize-git
109110
- TypeScript enabled
110111
- Development server with HMR
111112

113+
### nextjs
114+
- Next.js application with App Router
115+
- Server and Client Components support
116+
- Hypergraph integration with client-side providers
117+
- TypeScript enabled
118+
- Built-in optimizations and best practices
119+
112120
## Error Handling
113121

114122
The tool will fail gracefully if:

apps/create-hypergraph/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-hypergraph",
3-
"version": "0.2.0",
3+
"version": "0.3.3",
44
"description": "CLI toolchain to scaffold a Hypergraph-enabled application with a given template.",
55
"type": "module",
66
"bin": {
@@ -43,7 +43,7 @@
4343
"Web3",
4444
"Knowledge Graph",
4545
"Hypergraph",
46-
"TypeSyncs"
46+
"TypeSync"
4747
],
4848
"license": "MIT",
4949
"engines": {

apps/create-hypergraph/src/Cli.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const createHypergraphApp = Command.make('create-hypergraph-app', {
7575

7676
export const run = Command.run(createHypergraphApp, {
7777
name: 'create-hypergraph-app',
78-
version: '0.2.0',
78+
version: '0.3.3',
7979
});
8080

8181
// ========================
@@ -294,6 +294,11 @@ function resolveTemplate(config: Readonly<RawConfig>) {
294294
value: 'vite-react',
295295
description: 'Scaffolds a vite + react app using @tanstack/react-router',
296296
},
297+
{
298+
title: 'Nextjs',
299+
value: 'nextjs',
300+
description: 'Scaffolds a nextjs app',
301+
},
297302
],
298303
}).pipe(Effect.map((selected) => selected));
299304
},

apps/create-hypergraph/src/Domain.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as Schema from 'effect/Schema';
22

33
export const ALWAYS_SKIP_DIRECTORIES = ['node_modules', '.git'];
44

5-
export const AvailableFrameworkKey = Schema.Union(Schema.Literal('vite-react'));
5+
export const AvailableFrameworkKey = Schema.Union(Schema.Literal('vite-react'), Schema.Literal('nextjs'));
66
export type AvailableFrameworkKey = typeof AvailableFrameworkKey.Type;
77
export const Framework = Schema.Record({
88
key: AvailableFrameworkKey,
@@ -18,6 +18,10 @@ export const availableFrameworks = {
1818
directory: 'template-vite-react',
1919
skipDirectories: new Set([...ALWAYS_SKIP_DIRECTORIES, '.tanstack', 'dist']),
2020
},
21+
nextjs: {
22+
directory: 'template-nextjs',
23+
skipDirectories: new Set([...ALWAYS_SKIP_DIRECTORIES, '.next', 'dist']),
24+
},
2125
} as const satisfies Framework;
2226
export const availableFrameworkKeys = Object.keys(availableFrameworks) as ReadonlyArray<AvailableFrameworkKey>;
2327

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ignore artifacts:
2+
build
3+
dist
4+
.next
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 120
4+
}

0 commit comments

Comments
 (0)