any-rule/scripts/genCommond.js

19 lines
648 B
JavaScript
Raw Normal View History

2019-08-02 14:23:46 +08:00
const RULES = require('../packages/www/src/RULES.js');
const pkg = require('../package.json');
const fs = require('fs');
const chalk = require('chalk');
2019-08-02 14:23:46 +08:00
pkg.activationEvents = ['*'];
pkg.contributes.commands = RULES.map((rule, index) => ({
command: 'extension.rule' + index,
title: `$(rocket) zz: ${rule.title}`
}));
2019-08-02 14:23:46 +08:00
2020-02-27 23:57:07 +08:00
pkg.contributes.commands.push({
command: 'extension.rule.callByMenu',
title: `🦕正则大全(${RULES.length}条)`
});
2019-08-02 14:23:46 +08:00
// console.log(JSON.stringify(pkg));
2019-08-02 23:58:16 +08:00
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 4), 'utf8');
console.log(chalk.green('🚀 pkg文件修改完毕, 请等待生成vsc包...'));