capacitor-assets icon indicating copy to clipboard operation
capacitor-assets copied to clipboard

Detect Cordova vs native projects

Open imhoffd opened this issue 4 years ago • 2 comments

Remove --skip-config and --copy workflow and detect project type instead. For Capacitor projects, which are really just native projects, there is no need to have a resources/ directory. Generated resources can be written directly into place in their respective native projects.

If Cordova is detected, the config.xml and resources/ directory workflow is used.

The --resources <path> option can be kept to allow devs to specify where to write generated resources, but wouldn't do anything in "Capacitor/native mode".

The --ios-project <path> and --android-project <path> options can be kept to allow devs to specify where native projects exist relative to the current directory, but wouldn't do anything in the "Cordova mode".

imhoffd avatar Apr 23 '20 05:04 imhoffd

Is there any plan to rename the tool from 'cordova-res' to something else? I guess there this would cause a ton of ripple, but the name of this tool is the reason why it took me as long as it did to find the switches I could use on it to work with capacitor projects. I was looking elsewhere thinking this tool didn't apply.

flyer1 avatar Mar 13 '21 22:03 flyer1

Yes, 1.0 will be called (most likely) @capacitor/assets and we're dropping Cordova support which should make this moot

mlynch avatar Nov 01 '21 19:11 mlynch

Closing as @capacitor/assets is now a thing and Cordova support is gone

mlynch avatar Sep 23 '22 20:09 mlynch

One issue related to this is that the new tool dies not delete any existing contents in the folder. This is particularly problematic if you had previously generated icons using Cordova or some other method because it creates a bunch of issues with having too many photos. It also doesn't overwrite an existing JSON file, so the old images remain the primary expected images. Maybe it's a good idea to wipe the folder before generating anything. I had to erase the whole ios folder and rerun npx cap add ios to get this to work, and even then the splash icons are not working. They get generated but they don't get detected it used.

Thanks,

Alex Morgan EcoRate

On Fri, Sep 23, 2022, 4:59 PM Max Lynch @.***> wrote:

Closed #113 https://github.com/ionic-team/capacitor-assets/issues/113 as completed.

— Reply to this email directly, view it on GitHub https://github.com/ionic-team/capacitor-assets/issues/113#event-7450286723, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT3FWPRAGGACYLDTJQNPA3V7YK2JANCNFSM4MOYKA6A . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

alexandermorgan avatar Sep 23 '22 21:09 alexandermorgan

Native projects in capacitor are part of your source tree so we can't delete the folder (you might have custom native code or plugins in there). That's a big difference from Cordova. However, for iOS I think we can be more aggressive/destructive about updating the asset Contents.json files to reflect the new changes

mlynch avatar Sep 24 '22 19:09 mlynch