diff --git a/.changeset/shaggy-cups-scream.md b/.changeset/shaggy-cups-scream.md deleted file mode 100644 index d9f5851c..00000000 --- a/.changeset/shaggy-cups-scream.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"create-hypergraph": patch ---- - -Add CHANGELOG.md to publishable dist folder - \ No newline at end of file diff --git a/apps/create-hypergraph/CHANGELOG.md b/apps/create-hypergraph/CHANGELOG.md index c363445c..89ed5199 100644 --- a/apps/create-hypergraph/CHANGELOG.md +++ b/apps/create-hypergraph/CHANGELOG.md @@ -3,4 +3,9 @@ ## 0.1.0 ### Patch Changes -- Initial release \ No newline at end of file +- 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. \ No newline at end of file diff --git a/apps/create-hypergraph/package.json b/apps/create-hypergraph/package.json index a4d81949..4e79d5d8 100644 --- a/apps/create-hypergraph/package.json +++ b/apps/create-hypergraph/package.json @@ -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": { diff --git a/apps/create-hypergraph/src/Cli.ts b/apps/create-hypergraph/src/Cli.ts index 29d64899..7f1df6c9 100644 --- a/apps/create-hypergraph/src/Cli.ts +++ b/apps/create-hypergraph/src/Cli.ts @@ -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', }); // ======================== @@ -165,7 +165,12 @@ function scaffoldHypergraphApp(config: Readonly) { 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); diff --git a/apps/create-hypergraph/src/Utils.ts b/apps/create-hypergraph/src/Utils.ts index 248dd138..c195a3ab 100644 --- a/apps/create-hypergraph/src/Utils.ts +++ b/apps/create-hypergraph/src/Utils.ts @@ -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 = { + _gitignore: '.gitignore', +}; + const SCOPED_PACKAGE_REGEX = /^(?:@([^/]+?)[/])?([^/]+?)$/; const blockList = ['node_modules', 'favicon.ico']; diff --git a/apps/create-hypergraph/template-vite-react/.gitignore b/apps/create-hypergraph/template-vite-react/_gitignore similarity index 100% rename from apps/create-hypergraph/template-vite-react/.gitignore rename to apps/create-hypergraph/template-vite-react/_gitignore diff --git a/apps/create-hypergraph/template-vite-react/src/mapping.ts b/apps/create-hypergraph/template-vite-react/src/mapping.ts index b345a5f0..ed2fd934 100644 --- a/apps/create-hypergraph/template-vite-react/src/mapping.ts +++ b/apps/create-hypergraph/template-vite-react/src/mapping.ts @@ -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: { diff --git a/apps/create-hypergraph/test/Cli.test.ts b/apps/create-hypergraph/test/Cli.test.ts index ecfa3e42..0829e064 100644 --- a/apps/create-hypergraph/test/Cli.test.ts +++ b/apps/create-hypergraph/test/Cli.test.ts @@ -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',