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

alfred-tools

v2.0.5

Published

Alfred Tools === [![npm version](https://img.shields.io/npm/v/alfred-tools.svg?style=flat)](https://www.npmjs.org/package/alfred-tools) ![](https://img.shields.io/bundlephobia/minzip/alfred-tools)

Downloads

4

Readme

Alfred Tools

npm version

A more elegant way to develop with Alfred Workflow

TOC

API

class: AlfredOutputBuilder

AlfredOutputBuilder can help you build a standard Alfred Workflow output easily. Natural IntelliSense auto-complete with TypeScript and no longer need to look at the official Script Filter JSON Format document all the time

import { AlfredOutputBuilder } from 'alfred-tools'

const output = new AlfredOutputBuilder()
output
  .append('My first item', 'https://google.com', 'subtitle of first item', {
    valid: false,
    icon: {
      path: './icon.png'
    }
  })
  .append('Second item')
  .print()

constructor()

output.append(title, arg, subtitle, params)

  • title: <string> option title
  • arg: <string> option arg, pass to next node as an argument
  • subtitle: <string> option subtitle
  • params: <AlfredOutputItem> optional alfred output option config

Append a single option

output
  .append('first option', 'A', 'choose this one will get A')
  .print()

output.append(items)

Shortcut for output.append().append()

output.tips(title, subtitle, icon)

  • title: <string> option title
  • subtitle: <string> option subtitle
  • icon: <string> absolute path of icon for option

Append a static option more easily

output.tips('Not support', 'Please install dependencies first', path.resolve(__dirname, './icon.png'))

output.info(title, subtitle)

  • title: <string> option title
  • subtitle: <string> option subtitle

Shortcut for output.tips(), built-in icon for information

output.alert(title, subtitle)

  • title: <string> option title
  • subtitle: <string> option subtitle

Shortcut for output.tips(), built-in icon for alarm

output.clear()

Clear all existing options

output.print()

Show output with Alfred options

class: RecentlyUsed

Storage your history options or just read common links from config.

const { RecentlyUsed, AlfredOutputBuilder } = require('alfred-tools');
const { detectURL } = require('./endpoint');

const pageHistory = RecentlyUsed.use('history.json', 10);
const output = new AlfredOutputBuilder()

output.append('First Row')

const histories = pageHistory.read().map(url => ({
  title: url,
  arg: url,
  subtitle: detectURL(url),
  icon: {
    path: './assets/ic_history.png',
  },
}));

output.append(histories)

use(filename, maxNum)

  • filename: <string> history file path
  • maxNum: <number> max number of histories

Returns an instance of RecentlyUsed

recently.read(limit)

  • limit: <number> maximum limit of the records
  • returns: <object[]>

Read the recently used list from the local file, you can specify a maximum limit

recently.record(nextRecord) {

  • nextRecord: <object> object to be store

Updating a new record item into the local file

recently.replace(data) {

  • data: <object[]> the whole data to replace

Overwrite all of the data

recently.reset() {

Clean up all of the data

const: history

Provide a constant history to read, record, and replace the operation history, defaults save at .cache/history.json

const { history } = require('alfred-tools');

const output = new AlfredOutputBuilder()

output.append('First Row')
output.append(history.read())

history.read(limit)

Read the history list from the local file, you can specify a maximum limit

history.record(data) {

  • data: <HistoryConfig> object to be store

Updating a new record item into the local file

history.config(params) {

Setup the default configuration of the history options

history.reset() {

Clean up all of the histories

License

MIT