Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何分析一个文件夹下面的所有文件呢? #8

Closed
tianweicc opened this issue Mar 16, 2021 · 2 comments
Closed

如何分析一个文件夹下面的所有文件呢? #8

tianweicc opened this issue Mar 16, 2021 · 2 comments

Comments

@tianweicc
Copy link

const $ = require('gogocode')

const input = `

const list = [
{
text: "A策略",
value: 1,
tips: "Atip",
},
{
text: "B策略",
value: 2,
tips: "Btip",
},
{
text: "C策略",
value: 3,
tips: "Ctip",
},
];
const output = $(input2).replace(
'{ text: $$1, value: $$2, $$$ }',
'{ name: $$1, id: $$2, $$$ }'
).generate();

// 上面这样仅仅分析了一段代码
希望可以直接分析文件夹下面的所有内容

@xcsweb
Copy link

xcsweb commented Mar 16, 2021

这个自己玩node ,读取文件夹所有文件啊

@wudi3
Copy link
Member

wudi3 commented Mar 16, 2021

https://github.com/thx/gogocode/tree/main/packages/gogocode-starter
1、clone gogocode 到本地
2、进入 /packages/gogocode-starter 目录
3、 执行 node ./src/batch-transform.js
即可看到批量操作js文件过程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants