@@ -23,9 +23,8 @@ export default class NodeCommand extends Command {
2323 tag : Flags . string ( {
2424 summary : 'Tag of the Graph Node release to install.' ,
2525 } ) ,
26- 'download-dir' : Flags . string ( {
27- summary : 'Directory to download the Graph Node release to.' ,
28- default : os . tmpdir ( ) ,
26+ 'bin-dir' : Flags . string ( {
27+ summary : 'Directory to install the Graph Node binary to.' ,
2928 } ) ,
3029 } ;
3130
@@ -35,15 +34,19 @@ export default class NodeCommand extends Command {
3534 } ) ,
3635 } ;
3736
38- static examples = [ '$ graph node install' ] ;
37+ static examples = [
38+ '$ graph node install' ,
39+ '$ graph node install --tag v1.0.0' ,
40+ '$ graph node install --bin-dir /usr/local/bin' ,
41+ ] ;
3942
4043 static strict = false ;
4144
4245 async run ( ) {
4346 const { flags, args } = await this . parse ( NodeCommand ) ;
4447
4548 if ( args . install ) {
46- await installGraphNode ( flags . tag ) ;
49+ await installGraphNode ( flags . tag , flags [ 'bin-dir' ] ) ;
4750 return ;
4851 }
4952
@@ -52,7 +55,7 @@ export default class NodeCommand extends Command {
5255 }
5356}
5457
55- async function installGraphNode ( tag ?: string ) {
58+ async function installGraphNode ( tag ?: string , binDir ?: string ) {
5659 const latestRelease = tag || ( await getLatestGraphNodeRelease ( ) ) ;
5760 const tmpBase = os . tmpdir ( ) ;
5861 const tmpDir = await fs . promises . mkdtemp ( path . join ( tmpBase , 'graph-node-' ) ) ;
@@ -79,7 +82,7 @@ async function installGraphNode(tag?: string) {
7982
8083 let extractedPath : string ;
8184
82- print . info ( `Extracting ${ downloadPath } ` ) ;
85+ print . info ( `\nExtracting binary... ` ) ;
8386 if ( downloadPath . endsWith ( '.gz' ) ) {
8487 extractedPath = await extractGz ( downloadPath ) ;
8588 } else if ( downloadPath . endsWith ( '.zip' ) ) {
@@ -89,17 +92,19 @@ async function installGraphNode(tag?: string) {
8992 throw new Error ( `Unsupported file type: ${ downloadPath } ` ) ;
9093 }
9194
92- const movedPath = await moveFileToBinDir ( extractedPath ) ;
93- print . info ( `Moved ${ extractedPath } to ${ movedPath } ` ) ;
95+ const movedPath = await moveFileToBinDir ( extractedPath , binDir ) ;
96+ print . info ( `✅ Graph Node ${ latestRelease } installed successfully` ) ;
97+ print . info ( `Binary location: ${ movedPath } ` ) ;
9498
9599 if ( os . platform ( ) !== 'win32' ) {
96100 await chmod ( movedPath , 0o755 ) ;
97101 }
98102
99- print . info ( `Installed Graph Node ${ latestRelease } ` ) ;
100- print . info (
101- `Please add the following to your PATH: ${ path . dirname ( movedPath ) } if it's not already there or if you're using a custom download directory` ,
102- ) ;
103+ print . info ( '' ) ;
104+ print . info ( `📋 Next steps:` ) ;
105+ print . info ( ` Add ${ path . dirname ( movedPath ) } to your PATH (if not already)` ) ;
106+ print . info ( ` Run 'gnd' to start your local Graph Node development environment` ) ;
107+ print . info ( '' ) ;
103108
104109 // Delete the temporary directory
105110 await fs . promises . rm ( tmpDir , { recursive : true , force : true } ) ;
0 commit comments