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

justme-cli

v0.3.0

Published

一个对文件内容指定的正则匹配内容进行加解密的 CLI 工具

Readme

justMe-cli

一个对文件内容指定的正则匹配内容进行加解密的 CLI 工具。

功能特性

  • 🔒 支持对文件中匹配的内容进行加密/解密
  • 🔍 支持自定义正则表达式或使用默认注释正则
  • 📁 支持单个文件或整个文件夹的批量处理
  • 🛡️ 支持多种加密算法(Base64、AES、DES)
  • 👀 支持实时监听文件变化自动处理
  • 🚫 智能跳过已处理内容,避免重复加密/解密
  • 🏷️ 自动标识符管理 - 为已加密/解密内容添加标识符,防止重复处理
  • 🌍 兼容 Windows、macOS、Linux 系统
  • ⚡ 高性能的文件处理和错误处理机制

标识符功能

为了防止重复加密/解密,工具会自动为处理后的内容添加标识符:

  • 加密标识符: !! - 标识内容已被加密
  • 解密标识符: ! - 标识内容已被解密

标识符工作原理

  1. 加密时:原始内容被加密后,前面会添加 !! 标识符
  2. 解密时:加密内容被解密后,前面会添加 ! 标识符
  3. 重复保护:工具会自动检测标识符,跳过已处理的内容
  4. 转换处理:可以在已解密内容和已加密内容之间相互转换

标识符示例

<!-- 原始内容 -->
<!-- !页面组件 -->

<!-- 加密后 -->
<!-- !!6aG16Z2i57uE5Lu2 -->

<!-- 解密后 -->  
<!-- !页面组件 -->

安装

全局安装

npm install -g justme-cli

本地开发

git clone <repository-url>
cd justme-cli
npm install

使用方法

基本命令格式

justme -i <输入路径> -o <输出路径> [选项]

命令行参数

| 参数 | 长参数 | 描述 | 必需 | |------|--------|------|------| | -i | --input | 输入文件或文件夹路径 | ✅ | | -o | --output | 输出文件或文件夹路径 | ✅ | | -r | --regex | 完整正则表达式数组 | ⚠️* | | -n | --normal-regex | 使用默认注释类型正则表达式 | ⚠️* | | -e | --encrypt | 加密模式 | ⚠️** | | -d | --decrypt | 解密模式 | ⚠️** | | -er | --encrypt-rule | 加密规则 (默认: base64) | ❌ | | -dr | --decrypt-rule | 解密规则 (默认: base64) | ❌ | | -p | --password | 加解密密码 (AES/DES 需要) | ❌ | | -w | --watch | 实时监听文件变化 | ❌ | | | --verbose | 显示详细输出 | ❌ |

⚠️* 必须指定 -r-n 中的一个
⚠️** 必须指定 -e-d 中的一个,不能同时指定

支持的加密规则

  • base64 - Base64 编码(默认)
  • aes - AES 加密(需要密码)
  • des - DES 加密(需要密码)

支持的文件类型

  • JavaScript: .js, .ts, .jsx, .tsx
  • Web: .vue, .html, .htm
  • 样式: .css, .scss, .sass, .less
  • 后端: .py, .rb, .php, .java, .c, .cpp, .h
  • 脚本: .sh, .bash, .zsh
  • 配置: .json, .xml, .yaml, .yml

使用示例

1. 加密 Vue 文件中的注释

输入文件 example.vue:

<template>
  <!-- !页面组件 -->
  <div class="page-flex page-home">
    <div class="page-container"></div>
  </div>
</template>

<script>
export default {
  methods: {
    // !复制文本
    onCopy(text) {},
  },
};
</script>

<style lang="scss" scoped>
/* !站地址样式 */
.station-address {
  display: flex;
}
</style>

加密命令:

justme -i example.vue -o output.vue -e -n

输出文件 output.vue(带标识符):

<template>
  <!-- !!6aG16Z2i57uE5Lu2 -->
  <div class="page-flex page-home">
    <div class="page-container"></div>
  </div>
</template>

<script>
export default {
  methods: {
    // !!5aSN5Yi25paH5pys
    onCopy(text) {},
  },
};
</script>

<style lang="scss" scoped>
/* !!56uZ5Zyw5Z2A5qC35byP */
.station-address {
  display: flex;
}
</style>

2. 解密文件

justme -i output.vue -o decrypted.vue -d -n

解密后的文件 decrypted.vue(带解密标识符):

<template>
  <!-- !页面组件 -->
  <div class="page-flex page-home">
    <div class="page-container"></div>
  </div>
</template>

<script>
export default {
  methods: {
    // !复制文本
    onCopy(text) {},
  },
};
</script>

<style lang="scss" scoped>
/* !站地址样式 */
.station-address {
  display: flex;
}
</style>

3. 重复处理保护

当你再次对已处理的文件进行相同操作时,工具会自动跳过:

# 第一次加密 - 处理 3 个内容
justme -i example.vue -o output.vue -e -n
# 输出: 📊 统计: 处理了 1 个文件,匹配了 3 个内容

# 第二次加密同一文件 - 跳过所有内容
justme -i output.vue -o output2.vue -e -n  
# 输出: 📊 统计: 处理了 1 个文件,匹配了 0 个内容

4. 批量处理文件夹

justme -i ./src -o ./dist -e -n --verbose

5. 使用自定义正则表达式

justme -i example.js -o output.js -e -r "/\/\/\s*TODO:\s*(.+)/g" "/\/\*\s*FIXME:\s*([^*]+)\*\//g"

6. 使用 AES 加解密

justme -i examples/test-input.vue -o examples/output.vue -e -er aes -p "your-secret-key"

justme -i examples/output.vue -o examples/decrypted.vue -d -dr aes -p "your-secret-key"

7. 使用 AES 加解密

justme -i examples/test-input.vue -o examples/output.vue -e -er des -p "your-secret-key"

justme -i examples/output.vue -o examples/decrypted.vue -d -dr des -p "your-secret-key"

8. 实时监听文件变化

# 监听单个文件
justme -i examples/test-input.vue -o examples/output.vue -e -w

# 监听整个文件夹
justme -i ./src -o ./dist -e -w

监听模式下,工具会:

  • 首先执行一次完整处理
  • 然后持续监听文件变化
  • 文件修改时自动重新处理
  • Ctrl+C 退出监听

默认注释正则表达式

工具内置了以下注释类型的正则表达式:

// HTML 注释 (Vue template)
/<!--\s*!([^>]+)-->/g

// JavaScript 单行注释
/\/\/\s*!(.+)/g

// CSS 注释
/\/\*\s*!([^*]+)\*\//g

// Python 注释
/#\s*!(.+)/g

// Shell 注释
/#\s*!(.+)/g

注意:这些正则表达式匹配以 ! 开头的注释内容。

开发

安装依赖

npm install

运行测试

npm test

构建

npm run build

更新日志

v0.3.0

  • ✨ 新增标识符功能,自动管理加密/解密状态
  • 🛡️ 智能防重复处理,提高工具安全性
  • 🔄 支持加密/解密状态之间的转换
  • 📝 完善文档和示例

v0.2.0

  • 👀 新增实时监听功能
  • 🚫 新增重复检测机制
  • ⚡ 性能优化和错误处理改进

v0.1.0

  • 🎉 首次发布
  • 🔒 基本加密/解密功能
  • 📁 文件和文件夹批量处理
  • 🛡️ 多种加密算法支持

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request 来改进这个项目。