question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cli copy does not respect platform dir config

See original GitHub issue

Project 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:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
sbannigancommented, Jan 26, 2019

As of beta 14, you should be able to do something like this:

{
  "appId": "my.sample.app",
  "appName": "my-sample",
  "bundledWebRuntime": false,
  "rootDir": "apps"
  "webDir": "../dist/apps/web"
}

By setting the rootDir all the platform directories will be in that directory. The webDir is then relative to the rootDir.

1reaction
DmitryEfimenkocommented, Sep 5, 2019

each time I try to run npx cap add android after setting rootDir 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 the rootDir like shown above and (4) run npx cap add android again, it will skip the failing step and succeed.

Super annoying

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to copy directory from source tree to binary tree?
The configure command will only copy files when cmake is run. Another option is to create a ...
Read more >
Dockerfile reference - Docker Documentation
Dockerfile reference. Docker can build images automatically by reading the instructions from a Dockerfile . A Dockerfile is a text document that contains ......
Read more >
Cisco IOS Configuration Fundamentals Command Reference
For platforms that do not have a physical device named flash:, ... For example, the dir command, which displays a list of files...
Read more >
Command: init | Terraform - HashiCorp Developer
Copy a Source Module. By default, terraform init assumes that the working directory already contains a configuration and will attempt to initialize that ......
Read more >
Configuration - tox
This means if tox needs an option and is not available under ... otherwise new copy) in this directory for the project package....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found