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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vinikir1/versionamento-push

v0.1.2

Published

Biblioteca React Native para versionamento e atualizacao remota de bundle Android.

Downloads

167

Readme

versionamento-push

Biblioteca para React Native que faz:

  • consulta de versao de bundle remoto;
  • download de bundle atualizado (zip);
  • extracao e substituicao do index.android.bundle;
  • atualizacao de assets Android (drawable-*);
  • persistencia da versao local aplicada.

Escopo atual

Implementacao atual focada em Android.

Instalacao

yarn add versionamento-push

Dependencias usadas pela lib:

yarn add react-native-fs react-native-device-info react-native-restart react-native-zip-archive

Configuracao Android

No AndroidManifest.xml, inclua:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Crie o arquivo de configuracao no assets Android:

android/app/src/main/assets/versionamento-vktech-config.json

Conteudo minimo:

{
  "app_secret": "SEU_PROJETO_ID"
}

app_secret e obrigatorio e identifica o projeto no backend.

API

getVersao()

Retorna a versao local salva em DocumentDirectoryPath/db.json.

Exemplo de retorno:

{
  "bundle": "1.0.0",
  "versao": 12,
  "titulo": "1.0.0.12"
}

checkUpdate(antes?, depois?)

Fluxo:

  1. Le versao local.
  2. Consulta endpoint remoto de versao com projetoId e versaoBuild.
  3. Se versao remota diferente da local, chama atualizar(...).

Retorno esperado:

  • { update: true } quando versao remota > local.
  • { rollback: true } quando versao remota < local.
  • {} quando nao ha mudanca.

atualizar(versao, projetoId, antes?, depois?)

Fluxo:

  1. Baixa arquivo zip do bundle.
  2. Extrai em pasta temporaria.
  3. Move assets drawable-*.
  4. Move temp-cdd/index.android.bundle para DocumentDirectoryPath/index.android.bundle.
  5. Salva versao local.
  6. Exibe alerta para reiniciar o app (usa react-native-restart).

Exemplo de uso

import { checkUpdate, getVersao } from 'versionamento-push';

async function validarAtualizacao() {
  const versaoAtual = await getVersao();
  console.log('Versao local:', versaoAtual);

  const result = await checkUpdate(
    () => console.log('Iniciando atualizacao...'),
    () => console.log('Atualizacao finalizada.')
  );

  if (result?.update) {
    console.log('Nova versao aplicada.');
  } else if (result?.rollback) {
    console.log('Rollback aplicado.');
  } else {
    console.log('Sem alteracoes.');
  }
}

Observacoes importantes

  • Os endpoints do backend estao hardcoded no codigo da lib.
  • Nao ha validacao criptografica de integridade do bundle (hash/assinatura).
  • Para o bundle baixado ser efetivamente usado no boot, o app React Native precisa estar configurado para carregar o JS bundle do caminho local.
  • O README descreve o comportamento atual do codigo em index.js.