npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lamantin/fastpush

v0.0.78

Published

Typed fastlane frontend for pushing builds to store

Downloads

361

Readme

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

  • [x] 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.
  • [x] IOSPlatform helper for increment build number, set version name and getting this values
  • [x] AndroidPlatform helper for increment build number, set version name and getting this values
  • [x] CLI tool fastpush for possibility publish build without writing any line of code
  • [x] Hooks for build process support
  • [ ] Use DI for providing implementation of some build process, like up versioning, tagging and etc.