Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .changeset/shaggy-cups-scream.md

This file was deleted.

7 changes: 6 additions & 1 deletion apps/create-hypergraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
## 0.1.0
### Patch Changes

- Initial release
- Initial release

## 0.1.3
### Patch Changes

- 9de4bd2: rename template-vite-react/.gitignore -> _gitignore to guarantee it gets published to npm. Rename back to `.gitignore` once the app is scaffolded.
2 changes: 1 addition & 1 deletion apps/create-hypergraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-hypergraph",
"version": "0.1.0",
"version": "0.1.3",
"description": "CLI toolchain to scaffold a Hypergraph-enabled application with a given template.",
"type": "module",
"bin": {
Expand Down
9 changes: 7 additions & 2 deletions apps/create-hypergraph/src/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const createHypergraphApp = Command.make('create-hypergraph-app', {

export const run = Command.run(createHypergraphApp, {
name: 'create-hypergraph-app',
version: '0.1.0',
version: '0.1.3',
});

// ========================
Expand Down Expand Up @@ -165,7 +165,12 @@ function scaffoldHypergraphApp(config: Readonly<ResolvedConfig>) {
if (entry.isDirectory() && framework.skipDirectories.has(entry.name)) continue;

const srcPath = path.join(src, entry.name);
const destPath = path.join(dest, entry.name);

// Check if the file needs to be renamed (it has an entry in the Utils.renameFileDict)
const maybeRename = Utils.renameFileDict[entry.name];
const entryname = entry.isFile() && maybeRename != null ? maybeRename : entry.name;

const destPath = path.join(dest, entryname);

if (entry.isDirectory()) {
yield* copyTemplate(srcPath, destPath);
Expand Down
8 changes: 8 additions & 0 deletions apps/create-hypergraph/src/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import * as HelpDoc from '@effect/cli/HelpDoc';
import * as Effect from 'effect/Effect';

/**
* When copying from the template, if the file name in the template has an entry in this map, rename to the value.
* For example, `.gitignore`. In the template-* directories, the gitignore is named `_gitignore` because `.gitignore` files do _not_ get published to npm.
*/
export const renameFileDict: Record<string, string | undefined> = {
_gitignore: '.gitignore',
};

const SCOPED_PACKAGE_REGEX = /^(?:@([^/]+?)[/])?([^/]+?)$/;

const blockList = ['node_modules', 'favicon.ico'];
Expand Down
2 changes: 1 addition & 1 deletion apps/create-hypergraph/template-vite-react/src/mapping.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Id } from '@graphprotocol/grc-20';
import type { Mapping } from '@graphprotocol/hypergraph';
import type { Mapping } from '@graphprotocol/typesync/Mapping';

export const mapping: Mapping = {
Address: {
Expand Down
1 change: 1 addition & 0 deletions apps/create-hypergraph/test/Cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ describe('create-hypergraph CLI', () => {
'tsconfig.json',
'vite.config.ts',
'index.html',
'.gitignore',
'src/main.tsx',
'src/index.css',
'src/schema.ts',
Expand Down
Loading