一个JavaScript代码工具箱.
[jscodeshit] (https://jscodeshift.com/) [https://opensource.fb.com/support-ukraine] [https://github.com/facebook/jscodeshift/actions/workflows/test.yml?query=branch%3Amain] (英语).
jscodeshift是一个工具箱,用于在多个JavaScript上运行编码器或 TypeScript档案. 它规定:
□ 安装
从 [npm] (ZZURL3Z) 得到 jscodeshift :
(原始内容存档于2019-09-29) (英语). ``` $ npm install -g jscodeshift
这将安装跑道作为"jscodeshift".
□ VSCode 调试器
[配置 VSCode 以调试代码调试] (# vscode-debugging)
□ 用法(CLI)
完整文件见[网站](https://jscodeshift.com/)。
国家行动倡议提供以下选择:
ZZ1ZZ
将所有源通过指定的变换模块
带有`-t'或`---转化' (在当前
目录). 下一节解释变相模块的结构.
□用(JS).
(原始内容存档于2019-09-29). ```js
const {run: jscodeshift} = require('jscodeshift/src/Runner')
const path = require('node:path');
const transformPath = path.resolve('transform.js')
const paths = ['foo.js', 'bar']
const options = {
dry: true,
print: true,
verbose: 1,
// ...
}
const res = await jscodeshift(transformPath, paths, options)
console.log(res)
/*
{
stats: {},
timeElapsed: '0.001',
error: 0,
ok: 0,
nochange: 0,
skip: 0
}
*/□ 变形模块
变换只是输出形式函数的一个模块:
ZZCODE3 乐团
截至v0.6.1,这个模块也可以被写入TypeScript.
参数
`文件信息 '
持有当前处理的文件信息 .
属性 QQ 描述
此对象
我是否可以在参数前添加 inert inline `commentBlock`?
将 jscodeshift 更新到最新版本
流程 / TypeAlias / 插入正在销毁括号
在 v0.13 之后, JS 文档类型标注移动到了对象内部
无法在任何导出声明上调用 insertAfter 或 insertBefore
当输入文件只包含 LF 时, toSource() 会输出 CRLF 回车换行
find 不会遍历 TypeScript 中的 "typeParameters"
找不到
我找不到它。我甚至找不到它。
模板文本中带有换行的意外缩进