0.0.78 • Published 2 years ago

@lamantin/fastpush v0.0.78

Weekly downloads
332
License
MIT
Repository
github
Last release
2 years ago

fastpush codecov tests api

Typed fastlane frontend for pushing builds to store

What is it

fastpush - it is frontend for fastlane.tools, that can offer to you next solved fastlane problems:

  • Use JavaScript and TypeScript for build process
  • Types and autocomplete for your actions and lanes
  • Use single file for both platform without switching between them

Usage

Write your own file that hold logic of build process

// distribute.ts
import { android, gradle, AndroidPlatform, ui, supply, Incrementer } from "@lamantin/fastpush"

async function distribute() {
  const androidPlatform = new AndroidPlatform()

  const [oldVersionCode, newVersionCode] = await androidPlatform.incrementVersionCode()
  ui.success(`Success update build [${oldVersionCode}] -> [${newVersionCode}]`)

  android([
    gradle("clean"),
    gradle("assemble", {
      build_type: "Release",
    }),
    supply({ track: "beta" }),
  ])
}

distribute()

Run it via ts-node distribute.ts

Need more? Check Example part for more complicated cases

Setup

  1. Prepare environment needed for fastlane iOS and/or Android platforms
  2. Install this publish library with preferred package manager\ yarn add @lamantin/fastpush --dev\ or\ npm install @lamantin/fastpush --save-dev
  3. Go to Usage and write your own build process

Example

CLI

Library distributed with fastpush CLI tool, which helpful for distribute your app with 0 line of additional code.

You can invoke it with you package manager like: \ yarn fastpush --help

  fastpush - helper for publishing react-native projects via fastlane

  USAGE

    fastpush [android] [ios] --track <alpha|beta|production> [...options]

  PARAMETERS

    android - publish android to Google Play
    ios     - publish ios to AppStore       

  OPTIONS

    -i, --increment <none|patch|minor|major> - increment app version [none]     
    -t, --track <alpha|beta|production>      - select publish track [alpha]     
    -s, --silent <true|false>                - distribute without asking [false]
    -p, --project <project>                  - path to root of project [.]      
    -r, --rollout <0..100>                   - percent rollout [100]            

This tool contains all best-practice for publishing app For more complicated examples, you can check implementation of CLI tool at src/cli/publish.ts that distributed with this library

Hooks for build process

Since most of the app distribution logic changes very rarely (but aptly), we have added hook functionality that allows you to change the distribution behavior at any stage of execution.

import { publish } from '@lamantin/fastpush/build/src/cli/publish'
import { fastpush, FastpushResult } from '@lamantin/fastpush/build/src/cli/fastpush'
import { git } from '@lamantin/fastpush/build/src/utils'

// fastpush - function that map CLI arguments to `options` object with parameters
const options: FastpushResult = fastpush(process.argv)

// publish - function that can process object and distibute app with no effort.
publish(options, {
  // onPostPublish - hook that invoked each time, when app successfuly distibuted
  onPostPublish: async (platform, [prevVersion, version], [prevBuild, build]) => {
    const store = platform.type === 'ios' ? 'App Store 🍏' : 'Google Play 🤖'
    const message = `App "My App Name" 🌈 sended to ${store}, track ${options.track.toUpperCase()}.\n Version: ${tag}`
    sendMessage(message)    
  }
})

Exist some types of hooks:

  • onStart - hook that invoked first, before others hooks and before starting operations. Invoked 1 time.
  • onPostPublish - hook you can do something usefull, when app is distibuted. Add git tag or send message to team and etc. Can be invoked multiple times (if you distribute to Android and iOS together) or 0 if build not published.
  • onFinish - hook that invoked at end of all build process. Useful for aggregate information about build process and make analytics. Invoked 1 time.

Write your own build script

As described at Usage part, you can write your own implementation of build process from scratch. For inspiration you can check our implementation here.

If you do not want to use the build process written by us, but you want to quickly get a list of arguments as JS object, you can use our CLI parser named fastpush directly from code

import { fastpush, FastpushOptions } from '@lamantin/fastpush/build/src/cli/fastpush'

const options: FastpushOptions = fastpush(process.argv)
console.log("Parsed options:", options)

// options that you can get
// {
//     increment: "none" | "patch" | "minor" | "major";
//     track: "production" | "beta" | "alpha";
//     silent: boolean;
//     project: string;
//     rollout: number;
//     env: string;
//     flavor: string;
//     build: "bundle" | "assemble";
//     android: boolean;
//     ios: boolean;
// };

Roadmap

  • Typing for build and publish lanes
  • Typings to other actions and lanes
  • Use semver notation. \ For now, library api in experimental status and it can be changed without semver version updates.
  • IOSPlatform helper for increment build number, set version name and getting this values
  • AndroidPlatform helper for increment build number, set version name and getting this values
  • CLI tool fastpush for possibility publish build without writing any line of code
  • Hooks for build process support
  • Use DI for providing implementation of some build process, like up versioning, tagging and etc.
0.0.78

2 years ago

0.0.77

3 years ago

0.0.76

3 years ago

0.0.75

3 years ago

0.0.73

3 years ago

0.0.74

3 years ago

0.0.72

3 years ago

0.0.71

3 years ago

0.0.70

3 years ago

0.0.69

3 years ago

0.0.68

3 years ago

0.0.66

3 years ago

0.0.67

3 years ago

0.0.65

3 years ago

0.0.64

3 years ago

0.0.63

3 years ago

0.0.62

3 years ago

0.0.61

3 years ago

0.0.60

3 years ago

0.0.59

3 years ago

0.0.58

3 years ago

0.0.50

4 years ago

0.0.49

4 years ago

0.0.47

4 years ago

0.0.46

4 years ago

0.0.45

4 years ago

0.0.43

4 years ago

0.0.41

4 years ago

0.0.42

4 years ago

0.0.40

4 years ago

0.0.37

4 years ago

0.0.38

4 years ago

0.0.39

4 years ago

0.0.35

4 years ago

0.0.36

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.31

4 years ago

0.0.32

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.3

4 years ago

0.0.15

4 years ago

0.0.9

4 years ago

0.0.16

4 years ago

0.0.8

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.1

4 years ago