@@ -86,6 +86,10 @@ export default class InitCommand extends Command {
8686 summary : 'Skip installing dependencies.' ,
8787 default : false ,
8888 } ) ,
89+ 'skip-git' : Flags . boolean ( {
90+ summary : 'Skip initializing a Git repository.' ,
91+ default : false ,
92+ } ) ,
8993 'start-block' : Flags . string ( {
9094 helpGroup : 'Scaffold from contract' ,
9195 description : 'Block number to start indexing from.' ,
@@ -131,6 +135,7 @@ export default class InitCommand extends Command {
131135 'from-example' : fromExample ,
132136 'index-events' : indexEvents ,
133137 'skip-install' : skipInstall ,
138+ 'skip-git' : skipGit ,
134139 network,
135140 abi : abiPath ,
136141 'start-block' : startBlock ,
@@ -186,6 +191,7 @@ export default class InitCommand extends Command {
186191 directory,
187192 subgraphName,
188193 skipInstall,
194+ skipGit,
189195 } ,
190196 { commands } ,
191197 ) ;
@@ -247,6 +253,7 @@ export default class InitCommand extends Command {
247253 startBlock,
248254 spkgPath,
249255 skipInstall,
256+ skipGit,
250257 } ,
251258 { commands, addContract : false } ,
252259 ) ;
@@ -273,6 +280,7 @@ export default class InitCommand extends Command {
273280 subgraphName : answers . subgraphName ,
274281 directory : answers . directory ,
275282 skipInstall,
283+ skipGit,
276284 } ,
277285 { commands } ,
278286 ) ;
@@ -322,6 +330,7 @@ export default class InitCommand extends Command {
322330 startBlock : answers . startBlock ,
323331 spkgPath : answers . spkgPath ,
324332 skipInstall,
333+ skipGit,
325334 } ,
326335 { commands, addContract : true } ,
327336 ) ;
@@ -919,12 +928,14 @@ async function initSubgraphFromExample(
919928 subgraphName,
920929 directory,
921930 skipInstall,
931+ skipGit,
922932 } : {
923933 fromExample : string | boolean ;
924934 allowSimpleName ?: boolean ;
925935 subgraphName : string ;
926936 directory : string ;
927937 skipInstall : boolean ;
938+ skipGit : boolean ;
928939 } ,
929940 {
930941 commands,
@@ -1031,10 +1042,12 @@ async function initSubgraphFromExample(
10311042 }
10321043
10331044 // Initialize a fresh Git repository
1034- const repo = await initRepository ( directory ) ;
1035- if ( repo !== true ) {
1036- this . exit ( 1 ) ;
1037- return ;
1045+ if ( ! skipGit ) {
1046+ const repo = await initRepository ( directory ) ;
1047+ if ( repo !== true ) {
1048+ this . exit ( 1 ) ;
1049+ return ;
1050+ }
10381051 }
10391052
10401053 // Install dependencies
@@ -1072,6 +1085,7 @@ async function initSubgraphFromContract(
10721085 startBlock,
10731086 spkgPath,
10741087 skipInstall,
1088+ skipGit,
10751089 } : {
10761090 protocolInstance : Protocol ;
10771091 allowSimpleName : boolean | undefined ;
@@ -1086,6 +1100,7 @@ async function initSubgraphFromContract(
10861100 startBlock ?: string ;
10871101 spkgPath ?: string ;
10881102 skipInstall : boolean ;
1103+ skipGit : boolean ;
10891104 } ,
10901105 {
10911106 commands,
@@ -1163,10 +1178,12 @@ async function initSubgraphFromContract(
11631178 }
11641179
11651180 // Initialize a fresh Git repository
1166- const repo = await initRepository ( directory ) ;
1167- if ( repo !== true ) {
1168- this . exit ( 1 ) ;
1169- return ;
1181+ if ( ! skipGit ) {
1182+ const repo = await initRepository ( directory ) ;
1183+ if ( repo !== true ) {
1184+ this . exit ( 1 ) ;
1185+ return ;
1186+ }
11701187 }
11711188
11721189 if ( ! skipInstall ) {
0 commit comments