0.0.3 • Published 5 months ago
jsbox-cmd v0.0.3
jsbox-cmd
此工具为 Jsbox 的命令行工具
作用是将demo的文件夹生成一个配置文件 来供jsbox 使用
Demo可以参考 此处
npm install jsbox-cmd -g
1. gen
生成 jsboxConfig 的配置文件
jsbox gen ./your/dir --format --watch --output {outputPath} --config {configFilePath}
后面的参数都为可选参数
- format: 是否对生成的配置文件格式化
- watch: 是否开启监听同步
- output: 输出的文件路径
- config: 基础配置文件路径
该功能会将目标目录下面的js、html文件作为内容生成配置文件
js demo
// @needUI=false
// @hideLog=false
// @dep=xxx,xxx
// @desc=副标题
// @title=章节标题
console.log('Hello')
html demo
<!-- @hideLog=false -->
<!-- 注释内容与js一致 -->
<div>Hello</div>
markdown 文件
与js和html文件前缀名称相同即可
代码使用
const {initCodeMap} = require('jsbox-cmd');
initCodeMap({
input: string,
output?: string,
configFile?: string,
format?: boolean,
watch?: boolean,
});
const {generateCodeMap} = require('jsbox-cmd');
const config = generateCodeMap({}, inputPath);
2. open
jsbox open [type=value]
如:
jsbox open github=theajack.eveit
具体用法参考 Jsbox
-D 安装
npm install jsbox-cmd -D
package.json
"scripts": {
"gen": "npx jsbox-gen <path>"
},