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
5 changes: 5 additions & 0 deletions .changeset/happy-cats-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': minor
---

generate gitignore file
37 changes: 37 additions & 0 deletions packages/cli/src/scaffold/get-git-ignore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export const getGitIgnore = () => {
return `# Graph CLI generated artifacts
build/
generated/

# Dependency directories
node_modules/
jspm_packages/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# dotenv environment variables file
.env

# Testing
coverage
coverage.json

# Typechain
typechain
typechain-types

# Hardhat files
cache
`;
};
7 changes: 7 additions & 0 deletions packages/cli/src/scaffold/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Protocol from '../protocols';
import ABI from '../protocols/ethereum/abi';
import { version } from '../version';
import { getDockerFile } from './get-docker-file';
import { getGitIgnore } from './get-git-ignore';
import { generateEventIndexingHandlers } from './mapping';
import { abiEvents, generateEventType, generateExampleEntityType } from './schema';
import { generateTestsFiles } from './tests';
Expand Down Expand Up @@ -159,6 +160,10 @@ dataSources:
return await prettier.format(getDockerFile(), { parser: 'yaml' });
}

generateGitIgnoreFile() {
return getGitIgnore();
}

async generateMappings() {
return this.protocol.getMappingScaffold()
? { [`${strings.kebabCase(this.contractName)}.ts`]: await this.generateMapping() }
Expand Down Expand Up @@ -206,6 +211,7 @@ dataSources:
'subgraph.yaml': await this.generateManifest(),
'schema.graphql': await this.generateSchema(),
'package.json': await this.generatePackageJsonForSubstreams(),
'.gitignore': await this.generateGitIgnoreFile(),
};
}
return {
Expand All @@ -214,6 +220,7 @@ dataSources:
'schema.graphql': await this.generateSchema(),
'tsconfig.json': await this.generateTsConfig(),
'docker-compose.yml': await this.generateDockerFileConfig(),
'.gitignore': await this.generateGitIgnoreFile(),
src: await this.generateMappings(),
abis: await this.generateABIs(),
tests: await this.generateTests(),
Expand Down