Skip to content

Plugin variables #882

@Fatme

Description

@Fatme

myPlugin's package.json:

"nativescript": {
    "platforms": {
      "android": "1.1.3",
      "ios": "1.2.3"
    },
    "variables": {
        "APP_ID": {
             "defaultValue": "myAppId"
        },
        "APP_NAME": {
        }
    }
  }

Plugin add

{N} CLI will store all plugin variables and their values into project's package.json file:

"nativescript": {
    "id": "org.nativescript.androidTest3",
        "tns-android": {
        "version": "1.3.0"
    },
        "myPlugin-variables": {
            "APP_ID": "myAppId",
            "APP_NAME": "myAppName"
        }
}

Valid plugin commands:

  • `tns plugin add myPlugin --var.APP_ID myNewAppId --var.APP_NAME myAppName
  • tns plugin add myPlugin --var.APP_NAME myAppName

Invalid plugin commands:

  • tns plugin add myPlugin
  • tns plugin add myPlugin --var.APP_ID myNewAppId

Prepare

On prepare {N} CLI will replace all references of plugin variable with the specified value by plugin add command.
It seems that it will be enough to respect only AndroidManifest.xml and Info.plist file. But maybe in some cases {N} CLI should respect .java files as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions