Socket
Socket
Sign inDemoInstall

@capacitor-trancee/sync-version

Package Overview
Dependencies
7
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @capacitor-trancee/sync-version

Syncing version from package.json to target platform in the capacitor projects.


Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

capacitor-sync-version

npm package version PRs Welcome

Syncing version from package.json to target platform in the capacitor projects.

Currently supported platforms are: [android, ios].

Installation

npm add --save-dev capacitor-sync-version

Additional preparation for Android only

Step 1. Create a file named app.properties in ./android/app/, then add the following properties:

versionName=0.0.1
versionCode=1

These properties will be updated when capacitor-sync-version running.

Step 2. Adjust codes to referrence these properties in ./android/app/build.gradle.

  • Add the following codes after apply plugin: 'com.android.application':

    def appProperties = new Properties();
    file("app.properties").withInputStream { appProperties.load(it) }
    
  • Update properties in defaultConfig {} block:

    defaultConfig {
      versionCode appProperties.getProperty("versionCode").toInteger()
      versionName appProperties.getProperty("versionName")
    }
    

Usage

The simplest way to use capacitor-sync-version is running it in the capacitor hooks.

Just adding the following script to package.json:

{
  "scripts": {
    "capacitor:copy:before": "capacitor-sync-version"
  }
}

In this way, capacitor-sync-version will be run before capacitor copy command, e.g., npx cap copy.

Other ways to run capacitor-sync-version are:

# sync for android only
capacitor-sync-version android

# sync for both android and ios
capacitor-sync-version android ios

Licence

MIT

FAQs

Last updated on 12 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc