33import fs from 'fs' ;
44import chalk from 'chalk' ;
55import execa from 'execa' ;
6- // @ts -ignore Not typed
76import editJsonFile from 'edit-json-file' ;
87import { prompt } from 'enquirer' ;
98import { Path } from '@beemo/core' ;
@@ -28,8 +27,8 @@ async function copyAndInstallDepsFromModule(
2827 isYarn : boolean ,
2928 isMonorepo : boolean ,
3029) {
31- const pkg = require ( `${ moduleName } /package.json` ) ;
32- const deps = Object . keys ( pkg . dependencies ) . filter (
30+ const pkg : NimbusPackage = require ( `${ moduleName } /package.json` ) ;
31+ const deps = Object . keys ( pkg . dependencies || { } ) . filter (
3332 ( dep ) => ! dep . includes ( '@beemo' ) && ! dep . includes ( '@airbnb/nimbus' ) ,
3433 ) ;
3534
@@ -75,7 +74,7 @@ function migrateDotfiles() {
7574
7675function migratePackageScripts ( nimbus : NimbusPackage [ 'nimbus' ] ) {
7776 const pkg = editJsonFile ( pkgPath ) ;
78- const scripts = pkg . get ( 'scripts' ) || { } ;
77+ const scripts = pkg . get < NimbusPackage [ 'scripts' ] > ( 'scripts' ) ?? { } ;
7978 const srcFolder = nimbus . settings . srcFolder || 'src' ;
8079 const testFolder = nimbus . settings . testFolder || 'test' ;
8180
@@ -142,7 +141,7 @@ function migrateEslint() {
142141
143142function migrateJest ( ) {
144143 const configPath = Path . resolve ( 'jest.config.js' ) . path ( ) ;
145- const config = require ( configPath ) ;
144+ const config : { [ key : string ] : unknown } = require ( configPath ) ;
146145
147146 delete config . moduleNameMapper ;
148147 delete config . setupFiles ;
@@ -184,7 +183,7 @@ export async function eject() {
184183 console . log ( BANNER ) ;
185184 console . log ( `${ chalk . cyan ( '[1/5]' ) } Ejecting Nimbus` ) ;
186185
187- const nimbus = editJsonFile ( pkgPath ) . get ( 'nimbus' ) ;
186+ const nimbus = editJsonFile ( pkgPath ) . get < NimbusPackage [ 'nimbus' ] > ( 'nimbus' ) ;
188187
189188 if ( ! nimbus ) {
190189 throw new Error ( "Project isn't Nimbus enabled." ) ;
0 commit comments