Files
cypress/scripts/gulp/gulpfile.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

70 lines
1.6 KiB
TypeScript

import gulp from 'gulp'
import { autobarrelWatcher } from './tasks/gulpAutobarrel'
import { startCypressWatch } from './tasks/gulpCypress'
import { graphqlCodegen, graphqlCodegenWatch, nexusCodegen, nexusCodegenWatch } from './tasks/gulpGraphql'
import { viteApp, viteCleanApp, viteCleanLaunchpad, viteLaunchpad } from './tasks/gulpVite'
import { makePathMap } from './utils/makePathMap'
gulp.task(
'dev',
gulp.series(
// Autobarrel watcher
autobarrelWatcher,
// Fetch the latest "remote" schema from the Cypress cloud
// TODO: with stitching bracnh
// fetchCloudSchema,
gulp.parallel(
// Clean the vite apps
viteCleanApp,
viteCleanLaunchpad,
),
// Codegen for our GraphQL Server so we have the latest schema to build the frontend codegen correctly
nexusCodegenWatch,
// ... and generate the correct GraphQL types for the frontend
graphqlCodegenWatch,
// Now that we have the codegen, we can start the frontend(s)
gulp.parallel(
viteApp,
viteLaunchpad,
),
// And we're finally ready for electron, watching for changes in /graphql to auto-restart the server
startCypressWatch,
),
)
gulp.task('buildProd', gulp.series(
nexusCodegen,
graphqlCodegen,
))
gulp.task(
'postinstall',
gulp.series(
gulp.parallel(
// Clean the vite apps
viteCleanApp,
viteCleanLaunchpad,
),
'buildProd',
),
)
// gulp.task(
// 'devLegacy', // Tim: TODO
// )
// gulp.task(
// 'debug', // Tim: TODO
// )
gulp.task(makePathMap)
gulp.task(nexusCodegen)
gulp.task(nexusCodegenWatch)
gulp.task(graphqlCodegen)
gulp.task(graphqlCodegenWatch)