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

weapp-obfuscate-ts

v1.0.0

Published

A tool to generate code_obfuscation_config.json of weixin miniprogram.

Downloads

1

Readme

weapp-obfuscate

微信小程序加固配置文件生成工具,可以快速生成 code_obfuscation_config.json 文件。

背景

在 2022 年 7 月份,微信开发者工具上线了代码加固插件,可以对代码进行混淆加固,具体使用方法可以查阅 官方文档

出于安全考虑,部分小程序可能会有代码加固的需要,但由于官方没有提供快速批量加固的功能,如果手动编写 code_obfuscation_config.json 文件需要耗费大量时间,毕竟有些小程序可能包含几十个甚至上百个页面,再加上组件,工作量会非常巨大。

安装

npm install weapp-obfuscate-ts -D

使用

编辑 package.json 文件 scripts

{
  "scripts": {
    "obfuscate": "weapp-obfuscate-ts"
  }
}

或者执行

npm pkg set scripts.obfuscate="weapp-obfuscate-ts"

然后执行

npm run obfuscate

即可生成相应的 code_obfuscation_config.json 文件。

CLI 参数

  • --config or -C 指定对应的配置文件,比如指定 obfuscate.config.js
    {
      "scripts": {
        "obfuscate": "weapp-obfuscate --config obfuscate.config.js"
      }
    }

配置文件

配置文件接受以下类型:

  • .json 文件,比如:
    {
     "excludes": [
       "node_modules",
       "libs"
     ]
    }
  • .js 文件,需要对外暴露一个对象,比如:
    module.exports = {
     excludes: ["node_modules", "libs"]
    }

配置选项

entry

type: string

入口目录,会生成该目录下的所有 js 文件的加固配置。默认为项目的根目录。

如果想只对分包 package 目录下的 js 进行加固,可以修改该配置:

module.exports = {
  entry: "./package"
}

excludes

type: array

排除的目录名或者文件名。默认为 ["node_modules"]

如果是目录名称,则该目录下的所有文件都不会生成对应的加固配置。

desc

type: string

code_obfuscation_config.json 文件的 desc 字段。

switch

type: boolean

code_obfuscation_config.json 文件的 switch 字段。

License

MIT License