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

xar-js

v0.2.0

Published

JS library and command-line utility for reading and writing 'xar' archives (used by Safari extensions)

Downloads

341

Readme

xar-js

Build Status npm version

xar-js is a JavaScript library and command-line utility for reading and writing xar archives.

It was originally written to facilitate automated building of Safari Extensions.

Installation

npm install -g xar-js

Usage

Building a Safari Extension

To build a Safari extension without using Extension Builder, you will first need to get developer certificates for Safari from Apple, export the certificates and the intermediate and root certificates in the signing chain. You can then use xarjs create to generate .safariextz extensions.

  1. You will need a Developer Certificate as described in the Safari Extension Development Guide

  2. Once you have the Developer Certificate installed in your keychain, you will need to export it.

    1. Go to the 'Certificates' section of the 'Keychain Access' application, command-click on the 'Safari Developer: ...' certificate and select the 'Export' option.
    2. Save the certificate using the .p12 format.
    3. Extract the public and private keys from the resulting .p12 file using openssl:
    # export public certificate
    openssl pkcs12 -in safari-certs.p12 -nokeys -out cert.pem
    
    # export private key (note the 'nodes' option means that it will be unencrypted)
    openssl pkcs12 -nodes -in safari-certs.p12 -nocerts -out privatekey.pem
  3. Export the intermediate certificate and root certificates used to sign your developer certificate from Keychain Access.

    These are the 'Apple Worldwide Developer Relations Certification Authority' (usually in your login keychain) and the 'Apple Root CA' certificate (usually in the 'System Roots' section). (These are named apple-intermdiate.pem and apple-root.pem in the following instructions).

    In the export options dialog, select the Privacy Enhanced Mail (PEM) format.

  4. Use xarjs create to generate a .safariextz archive from your .safariextension directory containing the files for the extension:

    Note: The order of the --cert arguments is important. The leaf certificate must be specified first, followed by the intermediate and then the root.

    xarjs create extension.safariextz --cert cert.pem --cert apple-intermediate.pem --cert apple-root.pem --private-key privatekey.pem extension.safariextension
  5. Verify that Safari accepts the resulting extension:

    open extension.safariextz

    Should result in Safari showing a dialog prompting you to install the extension.