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

@sweet-milktea/util-tools

v4.1.0

Published

通用工具函数

Downloads

78

Readme

@sweet/util-tools

一些通用的工具。

webp图片、视频批量转换工具

首先需要自行安装ffmpeg

使用方法:

import media2webp from '@sweet-milktea/util-tools/media2webp';

media2webp(
  './src',        // 入口文件夹
  './build',      // 输出文件夹
  true,           // 是否包含视频
  ['ogg', 'rmvb'] // 配置其他想要转换的格式
);

查看当前工程下是否有依赖需要升级

使用方法:

import update from '@sweet-milktea/util-tools/update';

update(
  ['path/to/project'], // 项目工程目录的数组
  0                    // Npm包信息地址。0:Npm,1:Yarn,2:CNpm,3:腾讯npm镜像
);

avif图片批量转换工具

首先需要自行安装sharp模块, 或者安装 avifenc (mac上使用brew安装brew install joedrago/repo/avifenc)。

使用方法:

import image2avif from '@sweet-milktea/util-tools/image2avif';

image2avif(
  './src',   // 入口文件夹
  './build', // 输出文件夹
  'sharp'    // sharp或avifenc
);

webp图片批量转换工具

首先需要自行安装imagemin-webpimagemin-gif2webp
mac下可能需要使用brew安装giflib

使用方法:

import image2webp from '@sweet-milktea/util-tools/image2webp';

image2webp(
  './src',   // 入口文件夹
  './build', // 输出文件夹
  // 图片转换选项配置
  {
    img: {},
    gif: {}
  }
);

图片压缩工具

首先需要自行安装imagemin-gifsicleimagemin-jpegoptimimagemin-pngquant
mac下可能需要使用brew安装jpeg

使用方法:

import imageCompress from '@sweet-milktea/util-tools/imageCompress';

imageCompress(
  './src',   // 入口文件夹
  './build', // 输出文件夹
  // 图片压缩选项配置
  {
    png: {},
    jpg: {},
    gif: {}
  }
);

压缩选项:

生成icns图标

使用方法:

import image2icns from '@sweet-milktea/util-tools/image2icns';

image2icns(
  './1024x1024.png',  // 输入图片
  './1024x1024.icns', // 生成图标
  {
    size: 512, // 尺寸
    retina: 2  // 1k屏或2k屏 
  }
);

如果retina的值为1:则size的值为16、32、128、256、512、1024。
如果retina的值为2:则size的值为16、32、128、256、512。