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

nuxt-twa-module

v1.3.1

Published

A module for NUXT for converting your PWA into an Android app using 'trusted web activities'

Downloads

422

Readme

Nuxt TWA module

npm style guide Nuxt TWA module Nuxt TWA module Greenkeeper badge

Nuxt module to transform your PWA into an Android app, using Trusted Web Activities (TWA)

Trusted Web Activities (TWA) allow you to package a Progressive Web App (PWA) in an Android App. You can upload this app to the Google Play Store. This module sets the necessery configuration for running the app, creates icons and generates files used by the application.

Requirements

Trusted Web Activities only work when you are using a legitimate service worker, so we highly recommend using the PWA module or setting up a PWA yourself.

To upload an app to the Google Play Store you need a key for signing. To create one follow these instructions

Important notice

Store the key in a safe place, if you uploaded your app with a key you will need the same key for each update.

After you've created this key you will need to copy the SHA-256 for the nuxt configuration file by running this command:

keytool -list -v -keystore LOCATION_OF_YOUR_KEY.keystore

You will need Android Studio to create the signed app.

Installation 🚀

npm install nuxt-twa-module --save-dev

Setting up configuration

Add nuxt-twa-module to modules section of nuxt.config.js.

  {
    modules: [
      ['nuxt-twa-module', {
        /* module options */
        defaultUrl: 'https://your-url.com',
        hostName: 'your-url.com',
        sha256Fingerprints: ['/* your SHA-256 keys */'],
        applicationId: 'com.example.example',
        launcherName: 'Your app name',
        versionCode: 1,
        versionName: '1.0',
        statusBarColor: /* color */,

        /* optional */
        /* overwrite default location for icon */
        iconPath: '/static/icon.png'
        /* Overwrite folder where to put .wellknown */
        distFolder: '.nuxt/dist/client',
      }],
    ]
  }

the sha256Fingerprints by is an array with one SHA-256 key string. But if you have multiple you can add them to the array. More information about the website asociation: https://developer.android.com/training/app-links/verify-site-associations#web-assoc

Time to build 🏗

When the configuration is done you can run your project like you are used to.

npm run build

or

npm run generate

Output

  • An android folder in your project root, which you can open in Android Studio to build your app. When you've build and tested your app you can use Generate Signed Bundle/APK. This will generate a .aab file that can be uploaded to the Google Play Store.
  • Your Nuxt app with an added .well-known folder which is needed to make your domain trusted with the app in the store.

Debug

To be able to test the Android application, you need to tell Chrome on your device it can trust your PWA. For this you need to have android-platform-tools installed on your machine.

brew cask install android-platform-tools

In Chrome on your device, go to chrome://flags and enable Enable command line on non-rooted devices

On your machine, run the following command to whitelist your URL in Chrome:

adb shell "echo '_ --disable-digital-asset-link-verification-for-url=\"<your URL>\"' > /data/local/tmp/chrome-command-line"

Links


Licence

MIT