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

@stardyn/angular-updater

v2.0.11

Published

Angular Version Tracker Package - Lightweight, configurable version tracking and update notification service for Angular applications with Service Worker support

Readme

@stardyn/angular-updater

Lightweight, configurable version tracking and update notification service for Angular applications with Service Worker support. Provides automatic version checking and user-friendly update prompts.

Features

  • Service Worker Integration: Seamless integration with Angular Service Worker
  • Automatic Version Checking: Configurable interval-based version checking
  • User-Friendly Update Prompts: Customizable dialog for update notifications
  • Performance Focused: Zero overhead when Service Worker is disabled
  • Singleton Pattern: Prevents multiple instances and ensures efficient resource usage
  • Rich Logging: Debug mode with detailed logging for development
  • Theme Support: Customizable UI themes for update dialogs
  • Production Ready: Automatically optimized for production environments

Installation

npm install @stardyn/angular-updater

Prerequisites

This package requires Angular Service Worker to be configured in your application:

ng add @angular/pwa

Quick Start

1. App Module Configuration

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ServiceWorkerModule } from '@angular/service-worker';
import { provideXconVersionTracker } from '@stardyn/angular-updater';
import { ActionTheme } from '@xcon-platform/core-ui-actions';

import { AppComponent } from './app.component';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    ServiceWorkerModule.register('ngsw-worker.js', {
      enabled: environment.production,
      registrationStrategy: 'registerWhenStable:30000'
    })
  ],
  providers: [
    provideXconVersionTracker({
      checkInterval: 300, // Check every 5 minutes
      debugMode: !environment.production,
      theme: ActionTheme.DARK
    })
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

2. Standalone Application Configuration

// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { provideServiceWorker } from '@angular/service-worker';
import { provideXconVersionTracker } from '@stardyn/angular-updater';
import { ActionTheme } from '@xcon-platform/core-ui-actions';

import { AppComponent } from './app/app.component';
import { environment } from './environments/environment';

bootstrapApplication(AppComponent, {
  providers: [
    provideServiceWorker('ngsw-worker.js', {
      enabled: environment.production,
      registrationStrategy: 'registerWhenStable:30000'
    }),
    provideXconVersionTracker({
      checkInterval: 180, // Check every 3 minutes
      debugMode: !environment.production,
      theme: ActionTheme.LIGHT
    })
  ]
});

3. Manual Service Usage

import { Component, OnInit } from '@angular/core';
import { XconVersionTrackerService } from '@stardyn/angular-updater';

@Component({
  selector: 'app-root',
  template: `
    <h1>{{ title }}</h1>
    <button (click)="checkForUpdates()">Check for Updates</button>
  `
})
export class AppComponent implements OnInit {
  title = 'My App with Version Tracking';

  constructor(private versionTracker: XconVersionTrackerService) {}

  ngOnInit() {
    // Service is automatically initialized via APP_INITIALIZER
    console.log('Version tracker is ready');
  }

  checkForUpdates() {
    // Manual configuration if needed
    this.versionTracker.configure({
      checkInterval: 60,
      debugMode: true,
      theme: ActionTheme.DARK
    });
  }
}

API Reference

XconVersionTrackerConfig

interface XconVersionTrackerConfig {
  debugMode?: boolean;     // Enable/disable debug logging (default: false)
  checkInterval?: number;  // Version check interval in seconds (default: 60)
  theme: ActionTheme;     // UI theme for update dialogs (required)
}

XconVersionTrackerService

Configuration

// Configure the service
versionTracker.configure(config: XconVersionTrackerConfig): void

Initialization

The service is automatically initialized when provided via provideXconVersionTracker(). Manual initialization is not required.

// Automatic initialization via APP_INITIALIZER
versionTracker.initialize(): void

Provider Function

// Provide the version tracker service with configuration
provideXconVersionTracker(config: XconVersionTrackerConfig): (Provider | EnvironmentProviders)[]

Utility Functions

// Reset singleton instance (useful for testing)
resetVersionTrackerInstance(): void

Configuration Examples

Development Configuration

provideXconVersionTracker({
  checkInterval: 30, // Check every 30 seconds for quick testing
  debugMode: true,   // Enable detailed logging
  theme: ActionTheme.LIGHT
})

Production Configuration

provideXconVersionTracker({
  checkInterval: 600, // Check every 10 minutes
  debugMode: false,   // Disable logging for performance
  theme: ActionTheme.DARK
})

Environment-Based Configuration

// environments/environment.ts
export const environment = {
  production: false,
  versionTracker: {
    checkInterval: 60,
    debugMode: true,
    theme: ActionTheme.LIGHT
  }
};

// app.module.ts or main.ts
provideXconVersionTracker(environment.versionTracker)

Update Flow

  1. Version Detection: Service Worker detects a new version is available
  2. Download: New version is downloaded in the background
  3. Ready Notification: User is prompted with an update dialog
  4. User Choice: User can accept or decline the update
  5. Update Application: If accepted, page reloads with the new version

Debug Output Examples

When debug mode is enabled, console outputs appear in this format:

[XconVersionTracker] XconVersionTracker service initialized
[XconVersionTracker] XconVersionTracker configured {checkInterval: 60, debugMode: true, theme: "light"}
[XconVersionTracker] Version Tracker Initializing
[XconVersionTracker] New application version found, beginning download: abc123def
[XconVersionTracker] New app version ready: xyz789ghi

Dependencies

Peer Dependencies

  • @angular/core >= 16.0.0
  • @angular/common >= 16.0.0
  • @angular/service-worker >= 16.0.0
  • rxjs >= 7.0.0

Internal Dependencies

  • @stardyn/angular-console - Console logging service
  • @stardyn/angular-core-ui-actions - UI action dialogs and themes

Performance

  • Service Worker Disabled: Zero overhead - service returns early
  • Singleton Pattern: Only one instance created regardless of provider calls
  • Zone Optimization: Version checking runs outside Angular zone
  • Memory Efficient: Minimal memory footprint with proper cleanup

TypeScript Support

Full TypeScript support with intellisense and type safety:

import { XconVersionTrackerConfig, ActionTheme } from '@stardyn/angular-updater';

const config: XconVersionTrackerConfig = {
  checkInterval: 300,
  debugMode: false,
  theme: ActionTheme.DARK
};

Troubleshooting

Service Worker Not Working

Ensure Angular Service Worker is properly configured:

ng add @angular/pwa

Update Dialog Not Appearing

  1. Check if Service Worker is enabled in your environment
  2. Verify debug mode is enabled to see console logs
  3. Ensure the app is served over HTTPS (required for Service Workers)

Multiple Instance Warning

The service uses a singleton pattern. If you see multiple initialization messages, ensure you're only calling provideXconVersionTracker() once in your application.

License

MIT License - see LICENSE file for details.

Repository

https://github.com/stardyn/angular-updater