Skip to content

Commit 3801671

Browse files
authored
feat: generate git ignore (#1629)
1 parent 0d72873 commit 3801671

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

.changeset/happy-cats-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': minor
3+
---
4+
5+
generate gitignore file
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
export const getGitIgnore = () => {
2+
return `# Graph CLI generated artifacts
3+
build/
4+
generated/
5+
6+
# Dependency directories
7+
node_modules/
8+
jspm_packages/
9+
10+
# Logs
11+
logs
12+
*.log
13+
npm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
17+
# Optional npm cache directory
18+
.npm
19+
20+
# Optional eslint cache
21+
.eslintcache
22+
23+
# dotenv environment variables file
24+
.env
25+
26+
# Testing
27+
coverage
28+
coverage.json
29+
30+
# Typechain
31+
typechain
32+
typechain-types
33+
34+
# Hardhat files
35+
cache
36+
`;
37+
};

packages/cli/src/scaffold/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Protocol from '../protocols';
55
import ABI from '../protocols/ethereum/abi';
66
import { version } from '../version';
77
import { getDockerFile } from './get-docker-file';
8+
import { getGitIgnore } from './get-git-ignore';
89
import { generateEventIndexingHandlers } from './mapping';
910
import { abiEvents, generateEventType, generateExampleEntityType } from './schema';
1011
import { generateTestsFiles } from './tests';
@@ -159,6 +160,10 @@ dataSources:
159160
return await prettier.format(getDockerFile(), { parser: 'yaml' });
160161
}
161162

163+
generateGitIgnoreFile() {
164+
return getGitIgnore();
165+
}
166+
162167
async generateMappings() {
163168
return this.protocol.getMappingScaffold()
164169
? { [`${strings.kebabCase(this.contractName)}.ts`]: await this.generateMapping() }
@@ -206,6 +211,7 @@ dataSources:
206211
'subgraph.yaml': await this.generateManifest(),
207212
'schema.graphql': await this.generateSchema(),
208213
'package.json': await this.generatePackageJsonForSubstreams(),
214+
'.gitignore': await this.generateGitIgnoreFile(),
209215
};
210216
}
211217
return {
@@ -214,6 +220,7 @@ dataSources:
214220
'schema.graphql': await this.generateSchema(),
215221
'tsconfig.json': await this.generateTsConfig(),
216222
'docker-compose.yml': await this.generateDockerFileConfig(),
223+
'.gitignore': await this.generateGitIgnoreFile(),
217224
src: await this.generateMappings(),
218225
abis: await this.generateABIs(),
219226
tests: await this.generateTests(),

0 commit comments

Comments
 (0)