@@ -9,27 +9,11 @@ import { fileURLToPath } from 'node:url'
9
9
import process from 'node:process'
10
10
// eslint-disable-next-line no-restricted-imports
11
11
import chalk from 'chalk'
12
+ import boxen from 'boxen'
12
13
13
14
const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
14
15
15
- const identity = ( message ) => message
16
-
17
- /**
18
- *
19
- * @param {string } message
20
- * @param {Array<chalk['Color'] | chalk['Modifiers']> } styles
21
- * @returns
22
- */
23
- const format = ( message , styles ) => {
24
- let func = identity
25
- try {
26
- func = chalk
27
- styles . forEach ( ( style ) => {
28
- func = func [ style ]
29
- } )
30
- } catch { }
31
- return func ( message )
32
- }
16
+ const NETLIFY_CYAN_HEX = '#28b5ac'
33
17
34
18
const postInstall = async ( ) => {
35
19
const { createMainCommand } = await import ( '../dist/commands/index.js' )
@@ -44,25 +28,37 @@ const postInstall = async () => {
44
28
generateAutocompletion ( program )
45
29
}
46
30
47
- console . log ( '' )
48
- console . log ( await format ( 'Success! Netlify CLI has been installed!' , [ 'greenBright' , 'bold' , 'underline' ] ) )
49
- console . log ( '' )
50
- console . log ( 'Your device is now configured to use Netlify CLI to deploy and manage your Netlify sites.' )
51
- console . log ( '' )
52
- console . log ( 'Next steps:' )
53
31
console . log ( '' )
54
32
console . log (
55
- ` ${ await format ( 'netlify init' , [
56
- 'cyanBright' ,
57
- 'bold' ,
58
- ] ) } Connect or create a Netlify site from current directory`,
33
+ boxen (
34
+ `Success! Netlify CLI has been installed!
35
+
36
+ You can now use Netlify CLI to develop, deploy, and manage your Netlify sites.
37
+
38
+ 🚀 Now get building!` ,
39
+ {
40
+ padding : 1 ,
41
+ margin : 1 ,
42
+ textAlignment : 'center' ,
43
+ borderStyle : 'round' ,
44
+ borderColor : NETLIFY_CYAN_HEX ,
45
+ // This is an intentional half-width space to work around a unicode padding math bug in boxen
46
+ title : '⬥ ' ,
47
+ titleAlignment : 'center' ,
48
+ } ,
49
+ ) ,
59
50
)
51
+ console . log ( 'Next steps:' )
52
+ console . log ( ` ${ chalk . cyanBright . bold ( 'netlify login' ) } Log in to your Netlify account` )
60
53
console . log (
61
- ` ${ await format ( 'netlify deploy' , [ 'cyanBright' , 'bold' ] ) } Deploy the latest changes to your Netlify site` ,
54
+ ` ${ chalk . cyanBright . bold ( 'netlify init' ) } Connect or create a Netlify site from the current directory ` ,
62
55
)
56
+ console . log ( ` ${ chalk . cyanBright . bold ( 'netlify deploy' ) } Deploy the latest changes to your Netlify site` )
57
+ console . log ( ` ${ chalk . cyanBright . bold ( 'netlify help' ) } Find out what else you can do 👀` )
58
+ console . log ( '' )
59
+ console . log ( `For more help with the CLI, visit ${ chalk . cyanBright . bold ( 'https://developers.netlify.com/cli' ) } ` )
63
60
console . log ( '' )
64
- console . log ( `For more information on the CLI run ${ await format ( 'netlify help' , [ 'cyanBright' , 'bold' ] ) } ` )
65
- console . log ( `Or visit the docs at ${ await format ( 'https://cli.netlify.com' , [ 'cyanBright' , 'bold' ] ) } ` )
61
+ console . log ( `For help with Netlify, visit ${ chalk . cyanBright . bold ( 'https://docs.netlify.com' ) } ` )
66
62
console . log ( '' )
67
63
}
68
64
@@ -73,7 +69,7 @@ const main = async () => {
73
69
try {
74
70
await fs . stat ( path . resolve ( __dirname , '../.git' ) )
75
71
} catch ( err ) {
76
- if ( err . code === 'ENOENT' ) {
72
+ if ( err instanceof Error && 'code' in err && err . code === 'ENOENT' ) {
77
73
isEndUserInstall = true
78
74
}
79
75
}
0 commit comments