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

fire-keeper

v0.0.215

Published

A little helper for automate works.

Downloads

419

Readme

Fire Keeper

一个简单的工具箱。

安装

pnpm i fire-keeper

使用

首先,在代码中引入模块。

import $ from 'fire-keeper'

之后就可以愉快地玩耍啦。

$.echo('hello world')

当然,也可以按需加载。

import echo from 'fire-keeper/dist/echo'
echo('hello world')

构建

npm run build

测试

npm run test

文档

argv

获取argv

const argv = $.argv()

backup

备份文件。

await $.backup('./readme.md') // 生成`./readme.md.bak`

copy

复制文件。

await $.copy('./readme.md', './temp')

download

下载文件。

await $.download('http://example.com', './temp')

echo

在控制台显示信息。

$.echo('hello world')
$.echo('error', 'a error message')

exec

执行命令。

await $.exec('npm run build')

getBasename

获取basename

const basename = $.getBasename('./readme.md') // `readme`

getDirname

获取dirname

const dirname = $.getDirname('./readme.md') // `./`的绝对路径

getExtname

获取extname

const extname = $.getExtname('./readme.md') // `.md`

getFilename

获取filename

const filename = $.getFilename('./readme.md') // `readme.md`

getName

获取文件名。

const name = $.getName('./readme.md')

getType

获取类型。

const type = $.getType(42) // number

glob

获取文件列表。

const listSource = await $.glob('./source/**/*')

home

获取用户主目录。

const home = $.home()

isExist

判断文件是否存在。

const isExist = await $.isExist('./readme.md')

isSame

判断两个文件是否相同。

const isSame = await $.isSame('./readme.md', './readme.md.bak')

link

创建软链接。

await $.link('./readme.md', './temp/readme.md')

mkdir

创建目录。

await $.mkdir('./temp')

move

移动文件。

await $.move('./readme.md', './temp')

normalizePath

规范化路径。

const path = $.normalizePath('./readme.md')

os

获取操作系统类型。

const os = $.os()

prompt

提示用户输入。

const answer = await $.prompt({
  list: ['a', 'b', 'c'],
  message: 'choose a letter',
  type: 'select',
})

read

读取文件。

const content = await $.read('./readme.md')

recover

恢复文件。

await $.recover('./readme.md') // 从`./readme.md.bak`恢复

remove

删除文件。

await $.remove('./temp')

rename

重命名文件。

await $.rename('./readme.md', 'readme-new.md')

root

获取项目根目录。

const root = $.root()

sleep

休眠。

await $.sleep(1e3)

stat

获取文件状态。

const stat = await $.stat('./readme.md')

toArray

转换为数组。

const list = $.toArray('hello world') // `['hello world']`

toDate

转换为日期。

const date = $.toDate('2020-01-01') // `new Date('2020-01-01')`

toJson

转换为JSON

const json = $.toJson('{"a":1}') // `{a:1}`

toString

转换为字符串。

const string = $.toString(42) // `'42'`

watch

监听文件变化。

$.watch('./source/**/*', (path) => $.echo(path))

write

写入文件。

await $.write('./readme.md', 'hello world')

zip

压缩文件。

await $.zip('./source/**/*', './temp/source.zip')