@@ -66,9 +66,9 @@ async function main(): Promise<void> {
6666 let description : string | undefined
6767 try {
6868 ; ( { name : packageName , description } = JSON . parse ( await readFile ( 'package.json' , 'utf-8' ) ) )
69- } catch ( err ) {
70- if ( err . code !== 'ENOENT' ) {
71- throw err
69+ } catch ( error ) {
70+ if ( error . code !== 'ENOENT' ) {
71+ throw error
7272 }
7373 }
7474 if ( packageName ) {
@@ -110,22 +110,22 @@ async function main(): Promise<void> {
110110 } ,
111111 } )
112112 console . log ( `📘 Created https://github.com/sourcegraph/${ repoName } ` )
113- } catch ( err ) {
113+ } catch ( error ) {
114114 if (
115- err instanceof HTTPError &&
116- ( err . response . body as any ) ?. errors ?. some ?. (
117- ( err : any ) =>
118- err ?. resource === 'Repository' &&
119- err ?. field === 'name' &&
120- typeof err ?. message === 'string' &&
121- / a l r e a d y e x i s t s / i. test ( err . message )
115+ error instanceof HTTPError &&
116+ ( error . response . body as any ) ?. errors ?. some ?. (
117+ ( error_ : any ) =>
118+ error_ ?. resource === 'Repository' &&
119+ error_ ?. field === 'name' &&
120+ typeof error_ ?. message === 'string' &&
121+ / a l r e a d y e x i s t s / i. test ( error_ . message )
122122 )
123123 ) {
124124 console . log (
125125 `📘 Repository already exists at https://github.com/sourcegraph/${ repoName } , skipping creation`
126126 )
127127 } else {
128- throw err
128+ throw error
129129 }
130130 }
131131 await exec ( 'git' , [ 'remote' , 'add' , 'origin' , `https://github.com/sourcegraph/${ repoName } .git` ] )
@@ -157,8 +157,8 @@ async function main(): Promise<void> {
157157 resolveBodyOnly : true ,
158158 } )
159159 const licenseText = license . body
160- . replace ( / \[ y e a r \ ]/ g, new Date ( ) . getFullYear ( ) . toString ( ) )
161- . replace ( / \[ f u l l n a m e \ ]/ g, 'Sourcegraph' )
160+ . replace ( / \[ y e a r ] / g, new Date ( ) . getFullYear ( ) . toString ( ) )
161+ . replace ( / \[ f u l l n a m e ] / g, 'Sourcegraph' )
162162 await writeFile ( 'LICENSE' , licenseText )
163163 }
164164
@@ -267,9 +267,9 @@ async function main(): Promise<void> {
267267 try {
268268 packageJson = JSON . parse ( await readFile ( 'package.json' , 'utf-8' ) )
269269 console . log ( '📄 package.json already exists, skipping creation' )
270- } catch ( err ) {
271- if ( err . code !== 'ENOENT' ) {
272- throw err
270+ } catch ( error ) {
271+ if ( error . code !== 'ENOENT' ) {
272+ throw error
273273 }
274274 console . log ( '📄 Adding package.json' )
275275 packageJson = {
@@ -321,9 +321,9 @@ async function main(): Promise<void> {
321321 try {
322322 console.log('📂 Creating src directory')
323323 await mkdir('src')
324- } catch (err ) {
325- if (err .code !== 'EEXIST') {
326- throw err
324+ } catch (error ) {
325+ if (error .code !== 'EEXIST') {
326+ throw error
327327 }
328328 }
329329
@@ -437,11 +437,11 @@ async function main(): Promise<void> {
437437 setTimeout ( ( ) => process . exit ( 0 ) , 100 )
438438}
439439
440- main ( ) . catch ( err => {
441- if ( err . showStack === false ) {
442- console . error ( '\n' + chalk . red ( err . message ) + '\n' )
440+ main ( ) . catch ( error => {
441+ if ( error . showStack === false ) {
442+ console . error ( '\n' + chalk . red ( error . message ) + '\n' )
443443 } else {
444- console . error ( err )
444+ console . error ( error )
445445 }
446446 setTimeout ( ( ) => process . exit ( 1 ) , 100 )
447447} )
0 commit comments