/nativescript-build-release

A NativeScript utility to simplify the "tns build --release" command to quickly create an Android or iOS package, using only the "nsconfig.json" file. Currently available on MacOS and Linux.

Primary LanguageShellMIT LicenseMIT

NativeScript Build Release

A NativeScript utility to simplify the tns build --release command to quickly create an Android or iOS package, using only the nsconfig.json file. Currently available on MacOS and Linux.

We perfectly know DEBUG or RUN, but not necessarily BUILD...

Note: Work in progress to become a new functionality of NativeScript CLI. See the progression with the pull request #5296.

Getting Started

Prerequisites

  • MacOS or Linux operating system.
  • Git installed and configured. (see Git website)
  • NativeScript installed and configured. (see CLI setup)
  • A functional project to use the utility. (see app templates)

Installation

In Terminal, run the following command to download the files from this directory.

git clone https://github.com/elvticc/nativescript-build-release

Alias

In Terminal profile file (.bash_profile, .zprofile, etc.), add the following alias.

alias ns_build="sh ~/_PATH_TO_UTILITY_/nativescript-build-release/main.sh"

Usage

NSConfig file

The utility only uses the nsconfig.json file. It is at the root of your application folder, otherwise create it. (more info)

In the nsconfig.json file, you must add the buildRelease key. The buildRelease key can contain the following data:

  • android (more info)

    • keyStorePath
    • keyStoreAlias
    • copyPath
    • options (separated by commas)
      • aot
      • snapshot
      • compileSnapshot
      • uglify
      • report
      • sourceMap
      • hiddenSourceMap
      • force
      • aab (package extension)
      • 28 (and higher) or api28 or sdk28
  • ios (more info)

    • teamId
    • provisionUuid
    • copyPath
    • options (separated by commas)
      • aot
      • uglify
      • report
      • sourceMap
      • hiddenSourceMap
      • force
      • app (package extension)
      • icloud or iCloud

nsconfig.json example

{
    "buildRelease": {
        "android": {
            "keyStorePath": "/_PATH_TO_APP_/_APP_NAME_/android.keystore",
            "keyStoreAlias": "_APP_NAME_",
            "copyPath": "/_PATH_TO_APP_/_APP_NAME_/App/_BUILD_FOLDER_NAME_",
            "options": "uglify, aab"
        },
        "ios": {
            "provisionUuid": "0a0a00aa-0aaa-0a00-aa00-00000a0a00a0",
            "copyPath": "/_PATH_TO_APP_/_APP_NAME_/App/_BUILD_FOLDER_NAME_",
            "options": "uglify"
        }
    }
}

Start

In Terminal, navigate to your application root folder and run ns_build alias to start the utility.

Screenshot of NativeScript Build Release utility

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Benjamin Grand @elvticc