From 666782d891916dc3831816b09a6e491aa88acb60 Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Tue, 7 Nov 2023 12:56:59 +0200 Subject: [PATCH] feat(vite): add nodes - small additiongs --- packages/vite/src/plugins/plugin.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/vite/src/plugins/plugin.ts b/packages/vite/src/plugins/plugin.ts index 16f3dbce987590..cb880d455e810d 100644 --- a/packages/vite/src/plugins/plugin.ts +++ b/packages/vite/src/plugins/plugin.ts @@ -11,13 +11,14 @@ import { getRootTsConfigPath } from '@nx/js'; import { readTargetDefaultsForTarget } from 'nx/src/project-graph/utils/project-configuration-utils'; import { getNamedInputs } from '@nx/devkit/src/utils/get-named-inputs'; import { readdirSync } from 'fs'; +import { ExecutorOptions } from '@nx/js/src/utils/schema'; export interface VitePluginOptions { targetName?: string; } export const createNodes: CreateNodes = [ - '**/TODO', + '**/vite.config.{js,ts}', (configFilePath, options, context) => { const projectRoot = dirname(configFilePath); @@ -57,11 +58,11 @@ function buildViteTargets( context: CreateNodesContext ) { const viteConfig = getViteConfig(configFilePath, context); - + console.log('Here is your viteConfig', viteConfig); const targetDefaults = readTargetDefaultsForTarget( options.targetName, context.nxJsonConfiguration.targetDefaults, - 'executorName' + '@nx/vite:build' ); const namedInputs = getNamedInputs(projectRoot, context); @@ -69,7 +70,7 @@ function buildViteTargets( const targets: Record> = {}; const baseTargetConfig: TargetConfiguration = { - executor: 'executorName', + executor: '@nx/vite:build', options: { config: configFilePath, ...targetDefaults?.options, @@ -134,6 +135,6 @@ function getOutputs(projectRoot: string): string[] { function normalizeOptions(options: VitePluginOptions): VitePluginOptions { options ??= {}; - options.targetName ??= 'TODO'; + options.targetName ??= 'build'; return options; }