-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ios): run-ios
command
#2173
fix(ios): run-ios
command
#2173
Conversation
cc @cipolleschi |
// if the project with the name already has cache, remove the cache to avoid problems with pods installation | ||
cacheManager.removeProjectCache(projectName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, the same scenario could be if someone clones repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but is there any way to prevent that in this scenario? 🤔
const fullPath = path.resolve(getCacheRootPath(), name); | ||
|
||
if (fs.existsSync(fullPath)) { | ||
fs.rmSync(fullPath, {recursive: true}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add some error handling for the fs and resolve operations
Would appreciate tests for these scenarios 🙌🏼 |
366172c
to
30e3ea9
Compare
@thymikee thanks for your review, done! |
|
||
let dirFiles = fs.readdirSync(path.join(DIR, PROJECT_NAME)); | ||
|
||
expect(dirFiles).toContain('react-native.config.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could also validate what's inside
logger.error( | ||
`Failed to remove cache for ${name}. If you experience any issues when running freshly initialized project, please remove ${chalk.underline( | ||
path.join(cacheRootPath, name), | ||
)} folder manually.`, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.error( | |
`Failed to remove cache for ${name}. If you experience any issues when running freshly initialized project, please remove ${chalk.underline( | |
path.join(cacheRootPath, name), | |
)} folder manually.`, | |
); | |
logger.error( | |
`Failed to remove cache for ${name}. If you experience any issues when running freshly initialized project, please remove the "${chalk.underline( | |
path.join(cacheRootPath, name), | |
)}" folder manually.`, | |
); |
function removeProjectCache(name: string) { | ||
const cacheRootPath = getCacheRootPath(); | ||
try { | ||
const fullPath = path.resolve(cacheRootPath, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can move fullPath
outside try catch and re-use it in catch
statement.
Summary:
Fixing numerous small issues that could lead for potential breaking
run-ios
command:run-ios
was called for the first time, and Pods were not installed duringinit
, after installation it was trying to runxcodebuild
command with.xcodeproj
instead of.xcworkspace
bundle install
step inrun-ios
--version
flag was used with < 0.73, pods had trouble installing because unknown flag was used in the config (this scenario will fail unless 0.73 islatest
, if you are experiencing it, it's becauselatest
is used when--version
flag is not used)Test Plan:
node ../path/to/cli init RN73RC5 --version 0.73.0-rc.5
n
run-ios
rm -rf RN73RC5
node ../path/to/cli init RN73RC5 --version 0.73.0-rc.5
y
run-ios
Checklist