File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
__tests__/unit/utils/upgrade Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,22 @@ imports:
119
119
expect ( result . didRun ) . toBeTruthy ( ) ;
120
120
expect ( mockFs . lstatSync ) . not . toHaveBeenCalled ( ) ;
121
121
} ) ;
122
+ it ( 'should skip blacklisted upgrade.yml imports' , async ( ) => {
123
+ mockFs . writeFileSync ( '/oldProject/android/some.file' , 'random' ) ;
124
+ mockFs . writeFileSync ( '/oldProject/node_modules/some.file' , 'random' ) ;
125
+ mockFs . writeFileSync (
126
+ path . join ( getProjectPath ( ) , '.upgrade/upgrade.yml' ) ,
127
+ `
128
+ imports:
129
+ - android
130
+ - node_modules/some.file`
131
+ ) ;
132
+ mockFs . lstatSync . mockClear ( ) ;
133
+ const result = await runUpgradeTasks ( '/oldProject' ) ;
134
+
135
+ expect ( result . didRun ) . toBeTruthy ( ) ;
136
+ expect ( mockFs . lstatSync ) . not . toHaveBeenCalled ( ) ;
137
+ } ) ;
122
138
it ( 'should skip when no old project path specified' , async ( ) => {
123
139
mockFs . writeFileSync (
124
140
path . join ( getProjectPath ( ) , '.upgrade/upgrade.yml' ) ,
Original file line number Diff line number Diff line change @@ -180,7 +180,9 @@ export async function getInstallCommand(projectPath: string) {
180
180
const isPnpmLockPresent = fs . existsSync (
181
181
path . join ( projectPath , 'pnpm-lock.yaml' )
182
182
) ;
183
- const isBunLockPresent = fs . existsSync ( path . join ( projectPath , 'bun.lockb' ) ) ;
183
+ const isBunLockPresent =
184
+ fs . existsSync ( path . join ( projectPath , 'bun.lockb' ) ) ||
185
+ fs . existsSync ( path . join ( projectPath , 'bun.lock' ) ) ;
184
186
185
187
const options : SelectOption [ ] = [ ] ;
186
188
if ( isNpmLockPresent ) options . push ( { label : 'npm' , value : 'npm install' } ) ;
Original file line number Diff line number Diff line change @@ -70,11 +70,34 @@ export async function runUpgradeTasks(
70
70
startSpinner ( `discovering files from ${ color . yellow ( 'old project' ) } ` ) ;
71
71
72
72
const filesToCopy : string [ ] = [ ] ;
73
+ const blackListedPaths = [
74
+ 'android' ,
75
+ 'ios' ,
76
+ '.upgrade/' ,
77
+ 'node_modules/' ,
78
+ 'package.json' ,
79
+ 'integrate-lock.json' ,
80
+ ] ;
73
81
for ( let i = 0 ; i < config . imports . length ; i ++ ) {
74
82
updateSpinner (
75
83
`discovering files from ${ color . yellow ( 'old project' ) } (${ i + 1 } /${ config . imports . length } )`
76
84
) ;
77
85
const relativePath = getText ( config . imports [ i ] ) ;
86
+ if (
87
+ blackListedPaths . some ( p => {
88
+ if ( p . endsWith ( '/' ) )
89
+ return (
90
+ relativePath . startsWith ( p ) ||
91
+ relativePath === p . substring ( 0 , p . length - 1 )
92
+ ) ;
93
+ return relativePath === p ;
94
+ } )
95
+ ) {
96
+ logWarning (
97
+ `skipped import of ${ color . yellow ( relativePath ) } , this path is handled internally so you can remove it from imports list.`
98
+ ) ;
99
+ continue ;
100
+ }
78
101
const importPath = path . join ( oldProjectPath , relativePath ) ;
79
102
if ( ! fs . existsSync ( importPath ) ) {
80
103
logWarning (
You can’t perform that action at this time.
0 commit comments