test(采集数据): 判据读源码前先归一行尾——本仓 autocrlf 开着,别人机器检出是 CRLF,bodyOf 按 \n} 找闭合会在 checkout 后红(两种行尾实测各 4 绿)
This commit is contained in:
@@ -12,10 +12,10 @@ import { dirname, resolve } from 'node:path'
|
||||
import { readFileSync } from 'node:fs'
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url))
|
||||
const TAB = readFileSync(
|
||||
resolve(here, '../src/pages/brand/components/BrandCollectDataTab.vue'), 'utf8')
|
||||
const CHAIN = readFileSync(
|
||||
resolve(here, '../src/shared/composables/useCollectDataDispatch.ts'), 'utf8')
|
||||
// 该仓 core.autocrlf 开着,别人机器上检出是 CRLF:判据读的是形状不是行尾,先归一再比
|
||||
const read = (rel: string) => readFileSync(resolve(here, rel), 'utf8').replace(/\r\n/g, '\n')
|
||||
const TAB = read('../src/pages/brand/components/BrandCollectDataTab.vue')
|
||||
const CHAIN = read('../src/shared/composables/useCollectDataDispatch.ts')
|
||||
|
||||
/** 取函数体:从声明行到与之配对的行首 `}`(两个文件都是 0 缩进收尾) */
|
||||
function bodyOf(source: string, signature: string): string {
|
||||
|
||||
Reference in New Issue
Block a user