Files
cypress/scripts/gulp/utils/makePathMap.ts
Tim Griesser 1d5b185c5b refactor: remove nexus-decorators, add data context (#18211)
- Add `@packages/data-context`
- Add `yarn gulp makePackage` for scaffolding a new server package
- Removes `nexus-decorators` in favor of regular Nexus, creating better separation between data & schema
- Possible to launch project in different browser types

Co-authored-by: Jessica Sachs <jess@jessicasachs.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Cesar <cesaravitia@outlook.com>
2021-09-27 11:49:39 -04:00

43 lines
933 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')}
} as const
`,
)
}