mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-18 00:33:59 +00:00
fix(bots/discord/scripts): unintentional escaping on windows
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
import { readdirSync, writeFileSync } from 'fs'
|
import { readdirSync, writeFileSync } from 'fs'
|
||||||
import { join, relative } from 'path'
|
import { join, sep as pathSep, relative } from 'path'
|
||||||
|
import { sep as posixPathSep } from 'path/posix'
|
||||||
|
|
||||||
export const listAllFilesRecursive = (dir: string): string[] =>
|
export const listAllFilesRecursive = (dir: string): string[] =>
|
||||||
readdirSync(dir, { recursive: true, withFileTypes: true })
|
readdirSync(dir, { recursive: true, withFileTypes: true })
|
||||||
.filter(x => x.isFile())
|
.filter(x => x.isFile())
|
||||||
.map(x => join(x.parentPath, x.name))
|
.map(x => join(x.parentPath, x.name).replaceAll(pathSep, posixPathSep))
|
||||||
|
|
||||||
export const generateCommandsIndex = (dirPath: string) => generateIndexes(dirPath, x => !x.endsWith('types.ts'))
|
export const generateCommandsIndex = (dirPath: string) => generateIndexes(dirPath, x => !x.endsWith('types.ts'))
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ export const generateEventsIndex = (dirPath: string) => generateIndexes(dirPath)
|
|||||||
const generateIndexes = async (dirPath: string, pathFilter?: (path: string) => boolean) => {
|
const generateIndexes = async (dirPath: string, pathFilter?: (path: string) => boolean) => {
|
||||||
const files = listAllFilesRecursive(dirPath)
|
const files = listAllFilesRecursive(dirPath)
|
||||||
.filter(x => (x.endsWith('.ts') && !x.endsWith('index.ts') && pathFilter ? pathFilter(x) : true))
|
.filter(x => (x.endsWith('.ts') && !x.endsWith('index.ts') && pathFilter ? pathFilter(x) : true))
|
||||||
.map(x => relative(dirPath, x))
|
.map(x => relative(dirPath, x).replaceAll(pathSep, posixPathSep))
|
||||||
|
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
join(dirPath, 'index.ts'),
|
join(dirPath, 'index.ts'),
|
||||||
|
|||||||
Reference in New Issue
Block a user