Files
cypress/scripts/gulp/utils/makePathMap.ts
Tim Griesser a851d797a8 feat: improved DX for unified-desktop-gui (#18099)
- Moves graphql-codegen config to the root, which will serve all packages needing it
- Adds gulpfile for coordinating scripts related to dev environment in launchpad app
- yarn dev from the root runs yarn gulp dev, which:
  Runs autobarrel for rolling up the @packages/graphql files
  Cleans the dist & cache for .vite
  Starts the a codegen watcher for Nexus
  Starts the graphql-codegen --watch & highlights output
  Starts vite servers for launchpad & app
  Starts electron watch.js
2021-09-15 11:54:14 -04:00

43 lines
924 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'),
${dirs
.filter((f) => f)
.map((dir) => {
return ` ${_.camelCase(
`pkg-${dir}`,
)}: path.join(__dirname, '../../packages/${dir}')`
}).join(',\n')}
}
`,
)
}