This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ServeFullstackExecutorSchema } from './schema'; | |
import { ExecutorContext } from '@nrwl/devkit'; | |
import { ChildProcess, exec } from 'child_process'; | |
import * as chalk from 'chalk'; | |
const LARGE_BUFFER = 1024 * 1000000; | |
export default async function runExecutor( | |
options: ServeFullstackExecutorSchema, | |
_context: ExecutorContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ServeFullstackExecutorSchema } from './schema'; | |
import { ExecutorContext } from '@nrwl/devkit'; | |
import { ChildProcess, exec } from 'child_process'; | |
const LARGE_BUFFER = 1024 * 1000000; | |
export default async function runExecutor( | |
options: ServeFullstackExecutorSchema, | |
_context: ExecutorContext | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function startBackendServer(options: ServeFullstackExecutorSchema) { | |
let frontendServerStarted = false; | |
return new Promise(() => { | |
const childProcess = exec(`npx nx serve ${options.backendProject}`, { | |
maxBuffer: LARGE_BUFFER, | |
}); | |
process.on('exit', () => childProcess.kill()); | |
process.on('SIGTERM', () => childProcess.kill()); | |
childProcess.stdout.on('data', (data) => { | |
if (!frontendServerStarted && data.includes('build succeeded, watching for changes...')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function startBackendServer(options: ServeFullstackExecutorSchema) { | |
let frontendServerStarted = false; | |
return new Promise(() => { | |
const childProcess = exec(`npx nx serve ${options.backendProject}`, { | |
maxBuffer: LARGE_BUFFER, | |
}); | |
process.on('exit', () => childProcess.kill()); | |
process.on('SIGTERM', () => childProcess.kill()); | |
childProcess.stdout.on('data', (data) => { | |
if (!frontendServerStarted && data.includes('build succeeded, watching for changes...')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { applicationGenerator as nodeAppGenerator } from '@nrwl/node'; | |
// ... | |
async function createNodeApplication( | |
tree: Tree, | |
options: AppGeneratorSchema, | |
serverName: string, | |
webAppName: string | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getWorkspaceLayout, names, Tree, updateJson } from '@nrwl/devkit' | |
// ... | |
function adjustDefaultDevPort(tree: Tree, options: AppGeneratorSchema) { | |
const { fileName } = names(options.name); | |
updateJson(tree, `apps/${fileName}-web/project.json`, (json) => ({ | |
...json, | |
targets: { | |
...json.targets, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { names, Tree } from '@nrwl/devkit'; | |
import { AppGeneratorSchema } from './schema'; | |
const defaultPorts = { | |
frontendPort: 3000, | |
backendPort: 3333, | |
}; | |
export default async function (tree: Tree, options: AppGeneratorSchema) { | |
const optionsWithDefaults = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ServeFullstackExecutorSchema } from './schema'; | |
import { ExecutorContext } from '@nrwl/devkit'; | |
import { ChildProcess, exec } from 'child_process'; | |
const LARGE_BUFFER = 1024 * 1000000; | |
export default async function runExecutor( | |
options: ServeFullstackExecutorSchema, | |
_context: ExecutorContext | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test-web", | |
"$schema": "../../node_modules/nx/schemas/project-schema.json", | |
"sourceRoot": "apps/test-web/src", | |
"projectType": "application", | |
"targets": { | |
// ... | |
"serve-fullstack": { | |
"executor": "@nx-trpc-example/plugin:serve-fullstack", | |
"options": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ServeFullstackExecutorSchema } from './schema'; | |
import { ExecutorContext } from '@nrwl/devkit'; | |
import { ChildProcess, exec } from 'child_process'; | |
import * as chalk from 'chalk'; | |
const LARGE_BUFFER = 1024 * 1000000; | |
export default async function runExecutor( | |
options: ServeFullstackExecutorSchema, | |
_context: ExecutorContext |
NewerOlder