purescript-axon/scripts/common.js

21 lines
533 B
JavaScript
Raw Normal View History

2024-12-01 23:11:10 +00:00
import Fs from 'fs/promises'
import Path from 'path'
export const rootDir = Path.resolve(__dirname, '..')
2024-12-01 23:14:19 +00:00
export const packageDirs = async () => ['./src', './test']
2024-12-01 23:11:10 +00:00
export const packageSources = async () => {
const packages = await packageDirs()
const sources = []
for (const p of packages) {
const files = await Fs.readdir(p, { recursive: true, withFileTypes: true })
sources.push(
...files.flatMap(e =>
e.isFile() ? [Path.resolve(rootDir, e.path, e.name)] : [],
),
)
}
return sources
}