Files
cypress/scripts/gulp/utils/makePathMap.ts
Tim Griesser 4a9d6831ba chore: system test tooling improvements (#20966)
* chore: fixture tooling improvements

* simplifying the imports of the @tooling/system-tests

* A bit of cleanup

* browser export path for fixture dirs
2022-04-07 15:32:51 -04:00

44 lines
991 B
TypeScript

import fs from 'fs-extra'
import path from 'path'
import _ from 'lodash'
const ROOT_DIR = path.join(__dirname, '../../..')
/**
* Builds
*/
export async function makePathMap () {
const packages = await fs.readdir(path.join(ROOT_DIR, 'packages'))
const dirs = await Promise.all(
packages.map(async (p) => {
try {
await fs.stat(path.join(ROOT_DIR, `packages/${p}/package.json`))
return p
} catch (e) {
return null
}
}),
)
await fs.writeFile(
path.join(__dirname, '../monorepoPaths.ts'),
`/* eslint-disable */
// Auto-generated by makePathMap.ts
import path from 'path'
export const monorepoPaths = {
root: path.join(__dirname, '../..'),
pkgDir: path.join(__dirname, '../../packages'),
toolingDir: path.join(__dirname, '../../system-tests'),
${dirs
.filter((f) => f)
.map((dir) => {
return ` ${_.camelCase(
`pkg-${dir}`,
)}: path.join(__dirname, '../../packages/${dir}')`
}).join(',\n')}
} as const
`,
)
}