From c09d560da6fa1eb96941d67eed395f273e64c999 Mon Sep 17 00:00:00 2001 From: Nicholas Cunningham Date: Tue, 17 Jan 2023 10:52:40 -0700 Subject: [PATCH] feat(node): add Node standlone prompt using CNW --- .../bin/create-nx-workspace.ts | 25 +++++++++++++------ .../src/generators/application/application.ts | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/create-nx-workspace/bin/create-nx-workspace.ts b/packages/create-nx-workspace/bin/create-nx-workspace.ts index 0f3f638b4e3a3..d7c136a32e775 100644 --- a/packages/create-nx-workspace/bin/create-nx-workspace.ts +++ b/packages/create-nx-workspace/bin/create-nx-workspace.ts @@ -335,6 +335,8 @@ async function getConfiguration( preset = Preset.ReactStandalone; } else if (monorepoStyle === 'angular') { preset = Preset.AngularStandalone; + } else if (monorepoStyle === 'node-server') { + preset = Preset.NodeServer; } else { preset = await determinePreset(argv); } @@ -348,17 +350,19 @@ async function getConfiguration( if ( preset === Preset.ReactStandalone || - preset === Preset.AngularStandalone + preset === Preset.AngularStandalone || + preset === Preset.NodeServer ) { appName = argv.appName ?? argv.name ?? (await determineAppName(preset, argv)); name = argv.name ?? appName; - } else { - name = await determineRepoName(argv); - appName = await determineAppName(preset, argv); + if (preset === Preset.NodeServer) { framework = await determineFramework(preset, argv); } + } else { + name = await determineRepoName(argv); + appName = await determineAppName(preset, argv); } style = await determineStyle(preset, argv); } @@ -459,22 +463,27 @@ function determineMonorepoStyle(): Promise { { name: 'package-based', message: - 'Package-based monorepo: Nx makes it fast, but lets you run things your way.', + 'Package-based monorepo: Nx makes it fast, but lets you run things your way.', }, { name: 'integrated', message: - 'Integrated monorepo: Nx configures your favorite frameworks and lets you focus on shipping features.', + 'Integrated monorepo: Nx configures your favorite frameworks and lets you focus on shipping features.', }, { name: 'react', message: - 'Standalone React app: Nx configures Vite, Vitest, ESLint, and Cypress.', + 'Standalone React app: Nx configures Vite, Vitest, ESLint, and Cypress.', }, { name: 'angular', message: - 'Standalone Angular app: Nx configures Jest, ESLint and Cypress.', + 'Standalone Angular app: Nx configures Jest, ESLint and Cypress.', + }, + { + name: 'node-server', + message: + 'Standalone Node Server app: Nx configures your framework of choice (e.g. Express) along with esbuild, Eslint and Jest.', }, ], }, diff --git a/packages/node/src/generators/application/application.ts b/packages/node/src/generators/application/application.ts index 10d7872a23c01..18d175f79e238 100644 --- a/packages/node/src/generators/application/application.ts +++ b/packages/node/src/generators/application/application.ts @@ -298,6 +298,7 @@ function updateTsConfigOptions(tree: Tree, options: NormalizedSchema) { compilerOptions: { ...shared.tsConfigBaseOptions, ...json.compilerOptions, + esModuleInterop: true, }, ...json, extends: undefined,