Cli copy does not respect platform dir config
See original GitHub issueProject Setup
Added capacitor to existing non ionic project and ran the command: npx cap add ios
Cap created ios dir at root of project. I modified the config to look as follows:
{
"appId": "my.sample.app",
"appName": "my-sample",
"bundledWebRuntime": false,
"webDir": "dist/apps/web"
}
Everything works as expected
I moved the ios dir to apps/ios
and modified the config to:
{
"appId": "my.sample.app",
"appName": "my-sample",
"bundledWebRuntime": false,
"webDir": "dist/apps/web",
"ios": {
"platformDir": "apps/ios"
}
}
running any cap commands for ios like npx cap copy ios
result in the error:
[error] ios" platform has not been created. Use "capacitor add ios" to add the platform project.
.
Adding a dummy ios directory allows the selectPlatform
call to pass but does not respect the platform dir for copying any assets. https://github.com/ionic-team/capacitor/blob/5e6feb6f69a327993613b0579310507209183e6c/cli/src/config.ts#L239
I am new to the project but I think the copy and other platform specific commands should be changed to always check and respect the platformDir config.
ex. https://github.com/ionic-team/capacitor/blob/master/cli/src/tasks/copy.ts#L34-L37
My only motivation is to be able to move the platform dir to a new location inside my project so if there is a way to do this, that would resolve my issue as well.
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
As of beta 14, you should be able to do something like this:
By setting the rootDir all the platform directories will be in that directory. The webDir is then relative to the rootDir.
each time I try to run
npx cap add android
after settingrootDir
it does not get past the “Installing android dependencies” step.However, if I (1) run
npx cap add android
with default settings so that it installs deps, (2) undo that step by manually deleting generated files except for the deps, (3) update therootDir
like shown above and (4) runnpx cap add android
again, it will skip the failing step and succeed.Super annoying