mirror of
https://github.com/any86/any-rule.git
synced 2025-07-14 15:38:58 +08:00
104 lines
3.5 KiB
JavaScript
104 lines
3.5 KiB
JavaScript
const fs = require('fs');
|
|
const chalk = require('chalk');
|
|
const json = require('../packages/www/src/RULES');
|
|
const VSC_URL = 'https://marketplace.visualstudio.com/items?itemName=russell.any-rule'
|
|
const badges = [
|
|
// ``,
|
|
|
|
``,
|
|
|
|
|
|
`[](https://marketplace.visualstudio.com/items?itemName=russell.any-rule)`,
|
|
|
|
`[](https://marketplace.visualstudio.com/items?itemName=russell.any-rule)`,
|
|
|
|
`[](https://marketplace.visualstudio.com/items?itemName=russell.any-rule)`,
|
|
|
|
``,
|
|
|
|
`[](https://circleci.com/gh/any86/any-rule)`
|
|
|
|
// vscode上传不让用svg
|
|
// `[](https://github.com/any86/any-rule/actions)`
|
|
];
|
|
|
|
let content = `# 正则大全 ${badges.join(' ')}
|
|
|
|
🦕支持**web** / **vscode** / **idea** / **Alfred Workflow**多平台
|
|
|
|
## :rocket:web版本
|
|
https://any86.github.io/any-rule/
|
|
|
|
## 🍭vscode插件
|
|
|
|
### 安装
|
|
vscode应用商店中搜索"**any-rule**".
|
|
|
|
### 使用
|
|
**方式1:**
|
|
|
|
1. 按**F1**(mac下fn+F1)打开正则列表.
|
|
2. **输入关键词搜索**, 比如"手机".
|
|
|
|

|
|
|
|
**方式2:**
|
|
|
|
右键选择"🦕正则大全".
|
|
|
|

|
|
|
|
**方式3:**
|
|
|
|
在代码任意位置输入"**@zz**".
|
|
|
|

|
|
|
|
## 👩🏫图解正则
|
|
<details>
|
|
<summary>查看详情</summary>
|
|
每次在any-rule中选择正则后会弹出提示, 可点击"🤖图解正则".
|
|
|
|

|
|
|
|
点击后可以看到正则解析, 方便大家学习.
|
|
|
|

|
|
|
|
**注意**: 图解直接使用了https://regexper.com, 在此对作者表示敬意和感谢.
|
|
</details>
|
|
|
|
## 社区版本
|
|
|
|
社区版本非本人维护, 只是其他开发者使用了any-rule整理的正则内容, 如使用出现问题可直接与其开发者联系.
|
|
|
|
[idea版](https://github.com/zhoriya/idea-rule)
|
|
|
|
[Alfred Workflow版](https://github.com/cccyb/workflows)
|
|
|
|
[hyjs: 函数封装版](https://github.com/heiyehk/hyjs/tree/main/packages/utils)
|
|
|
|
[命令行版本](https://github.com/shenguanjiejie/workwork)
|
|
|
|
[uTools版本](https://github.com/trentlee0/utools-any-rule)
|
|
|
|
## :fire:关于PR
|
|
欢迎大家PR, 步骤如下:
|
|
1. **正则**请在**packages/www/src/RULES.js**中添加.
|
|
2. 运行\`npm run test:rules\`进行测试.
|
|
3. 运行\`npm run build:md\`更新**README.md**.
|
|
4. 请务必提交到**develop**分支.
|
|
|
|
在此感谢大家对**any-rule**做出的贡献!
|
|
|
|
## 🍔正则
|
|
`;
|
|
|
|
json.forEach(({title, rule})=>{
|
|
content+= `\r\n### ${title}\r\n`;
|
|
content+= `\`\`\`javascript\r\n`;
|
|
content+= `${rule}\r\n\`\`\`\r\n`;
|
|
});
|
|
fs.writeFileSync('./README.md',content,'utf-8');
|
|
console.log(chalk.green('生成完毕'));
|