/
githubmirror
/
Chart.js
Обзор
Документация
Войти
/
githubmirror
/
Chart.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/types/autogen.js
25 строк
701 B
Dan Onoshko
fix: move types to src dir to escape src / dist dirs in paths (#10993)
16 дек 2022, 15:56
Не верифицирован
16 дек 2022, 15:56
64a0278
Код
Авторство
О чём код?
import * as fs from 'fs'; import * as path from 'path'; import { fileURLToPath } from 'url'; import * as helpers from '../../dist/helpers.js'; const __dirname = fileURLToPath(new URL('.', import.meta.url)); let fd; try { const fn = path.resolve(__dirname, 'autogen_helpers.ts'); fd = fs.openSync(fn, 'w+'); fs.writeSync(fd, 'import * as helpers from \'../../dist/helpers/index.js\';\n\n'); fs.writeSync(fd, 'const testKeys: unknown[] = [];\n'); for (const key of Object.keys(helpers)) { if (key[0] !== '_' && typeof helpers[key] === 'function') { fs.writeSync(fd, `testKeys.push(helpers.${key});\n`); } } } finally { if (fd !== undefined) { fs.closeSync(fd); } }