apache / apache/cordova-cli

Install plugin only in a specific platform (defined in package.json)

Open
#552 4 comments 5 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
967
Forks
344
Avg merge
8h 41m
Merged PRs (30d)
9

Description

# Feature Request

## Motivation Behind Feature

Many plugins do work only in a specific platform and crash in other platforms during build. Furthermore many plugins are specifically designed to a specific platform only, but their creators did not take that into account. There's also a popular [request](https://stackoverflow.com/questions/23108342/install-cordova-plugin-for-one-platform-only) for this in Stackoverflow.

## Feature Description

It would be very advantageous to have in `package.json` some sort of way to inform that we just want a specific plugin installed only in a specific platform, and not in all platforms.

For example something like this in `package.json`

```
"cordova": {
"plugins": {
"cordova-plugin-mobile-ocr": {
"platform-specific": ["android"]
}
}
```

## Alternatives or Workarounds

We can use plugman but it's not reliable nor there is a way to tell other people that we want a certain plugin installed only on a specific platform. I suppose we can also use a hook, but I was wondering before which event should we consider to process. We can also have git branches with different versions of `package.json` for different platforms.

The best way would be undoubtedly to have that information directly stored in `package.json`.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the package.json cordova.plugins configuration shown in the issue, then compare the plugman and hook workarounds it mentions. Determine how platform-specific plugin installation should be represented and processed; done means a plugin declared for one platform is not installed for other platforms without breaking existing package.json behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.