Skip to content

Commit a94bea7

Browse files
authored
fix(#372 | gitignore): rename .gitignore to _gitignore to guarantee publish to npm (#379)
1 parent 8f23386 commit a94bea7

File tree

8 files changed

+24
-11
lines changed

8 files changed

+24
-11
lines changed

.changeset/shaggy-cups-scream.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

apps/create-hypergraph/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@
33
## 0.1.0
44
### Patch Changes
55

6-
- Initial release
6+
- Initial release
7+
8+
## 0.1.3
9+
### Patch Changes
10+
11+
- 9de4bd2: rename template-vite-react/.gitignore -> _gitignore to guarantee it gets published to npm. Rename back to `.gitignore` once the app is scaffolded.

apps/create-hypergraph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-hypergraph",
3-
"version": "0.1.0",
3+
"version": "0.1.3",
44
"description": "CLI toolchain to scaffold a Hypergraph-enabled application with a given template.",
55
"type": "module",
66
"bin": {

apps/create-hypergraph/src/Cli.ts

Lines changed: 7 additions & 2 deletions
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.1.0',
78+
version: '0.1.3',
7979
});
8080

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

167167
const srcPath = path.join(src, entry.name);
168-
const destPath = path.join(dest, entry.name);
168+
169+
// Check if the file needs to be renamed (it has an entry in the Utils.renameFileDict)
170+
const maybeRename = Utils.renameFileDict[entry.name];
171+
const entryname = entry.isFile() && maybeRename != null ? maybeRename : entry.name;
172+
173+
const destPath = path.join(dest, entryname);
169174

170175
if (entry.isDirectory()) {
171176
yield* copyTemplate(srcPath, destPath);

apps/create-hypergraph/src/Utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import * as HelpDoc from '@effect/cli/HelpDoc';
22
import * as Effect from 'effect/Effect';
33

4+
/**
5+
* When copying from the template, if the file name in the template has an entry in this map, rename to the value.
6+
* For example, `.gitignore`. In the template-* directories, the gitignore is named `_gitignore` because `.gitignore` files do _not_ get published to npm.
7+
*/
8+
export const renameFileDict: Record<string, string | undefined> = {
9+
_gitignore: '.gitignore',
10+
};
11+
412
const SCOPED_PACKAGE_REGEX = /^(?:@([^/]+?)[/])?([^/]+?)$/;
513

614
const blockList = ['node_modules', 'favicon.ico'];
File renamed without changes.

apps/create-hypergraph/template-vite-react/src/mapping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Id } from '@graphprotocol/grc-20';
2-
import type { Mapping } from '@graphprotocol/hypergraph';
2+
import type { Mapping } from '@graphprotocol/typesync/Mapping';
33

44
export const mapping: Mapping = {
55
Address: {

apps/create-hypergraph/test/Cli.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ describe('create-hypergraph CLI', () => {
9797
'tsconfig.json',
9898
'vite.config.ts',
9999
'index.html',
100+
'.gitignore',
100101
'src/main.tsx',
101102
'src/index.css',
102103
'src/schema.ts',

0 commit comments

Comments
 (0)