diff --git a/.env.example b/.env.example index 64dd9ba97..464d2983f 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,8 @@ -# for uploading to portal +# Example environment variables +# These are for reference only - use .env.local for local development + +# For uploading to Code PushUp portal CP_API_KEY= + +# Note: For local development with tsx/TypeScript execution, +# copy .env.local.example to .env.local and configure NODE_OPTIONS there diff --git a/.env.local b/.env.local new file mode 100644 index 000000000..67d48d392 --- /dev/null +++ b/.env.local @@ -0,0 +1,9 @@ +# Local development environment variables +# Copy this to .env.local (gitignored) and customize for your setup + +# Enable tsx for TypeScript execution in Nx +# This allows running local generator/executor directly as .ts files without pre-compilation +# This allowes the local plugins to import files with .js extensions (same as the packages in the repository) +NODE_OPTIONS=--import tsx +# This is used to resolve the paths in the local generator/executor so local packages can be imported as path aliases +TSX_TSCONFIG_PATH=tsconfig.base.json diff --git a/.env.local.example b/.env.local.example new file mode 100644 index 000000000..fe63e05ee --- /dev/null +++ b/.env.local.example @@ -0,0 +1,12 @@ +# Local development environment variables +# Copy this to .env.local (gitignored) and customize for your setup + +# Enable tsx for TypeScript execution in Nx +# This allows running local generator/executor directly as .ts files without pre-compilation +# This allowes the local plugins to import files with .js extensions (same as the packages in the repository) +NODE_OPTIONS=--import tsx +# This is used to resolve the paths in the local generator/executor so local packages can be imported as path aliases +TSX_TSCONFIG_PATH=tsconfig.base.json + +# Local API keys (optional - only if testing upload features) +# CP_API_KEY=your_api_key_here diff --git a/.gitignore b/.gitignore index 31d7e1678..6ba3d0b23 100644 --- a/.gitignore +++ b/.gitignore @@ -57,4 +57,4 @@ vitest.config.*.timestamp* .cursor/rules/nx-rules.mdc .github/instructions/nx.instructions.md -code-pushup.config.bundled_*.mjs \ No newline at end of file +code-pushup.config.bundled_*.mjs diff --git a/nx.json b/nx.json index 7e7265dfe..65f0c76fd 100644 --- a/nx.json +++ b/nx.json @@ -41,7 +41,12 @@ { "env": "NODE_OPTIONS" }, { "env": "TSX_TSCONFIG_PATH" } ], - "sharedGlobals": [{ "runtime": "node -v" }, { "runtime": "npm -v" }] + "sharedGlobals": [ + { "runtime": "node -v" }, + { "runtime": "npm -v" }, + { "env": "NODE_OPTIONS" }, + { "env": "TSX_TSCONFIG_PATH" } + ] }, "targetDefaults": { "lint": { diff --git a/tools/zod2md-jsdocs/src/lib/constants.ts b/tools/zod2md-jsdocs/src/lib/constants.ts new file mode 100644 index 000000000..28992a132 --- /dev/null +++ b/tools/zod2md-jsdocs/src/lib/constants.ts @@ -0,0 +1,2 @@ +export const ZOD2MD_CONFIG_FILE = 'zod2md.config.ts'; +export const GENERATE_DOCS_TARGET_NAME = 'generate-docs'; diff --git a/tools/zod2md-jsdocs/src/nx-plugin.ts b/tools/zod2md-jsdocs/src/nx-plugin.ts index 36cefc983..ae8ff14cc 100644 --- a/tools/zod2md-jsdocs/src/nx-plugin.ts +++ b/tools/zod2md-jsdocs/src/nx-plugin.ts @@ -1,8 +1,9 @@ import type { CreateNodesV2, NxPlugin, TargetConfiguration } from '@nx/devkit'; import * as path from 'node:path'; - -const ZOD2MD_CONFIG_FILE = 'zod2md.config.ts'; -const GENERATE_DOCS_TARGET_NAME = 'generate-docs'; +import { + GENERATE_DOCS_TARGET_NAME, + ZOD2MD_CONFIG_FILE, +} from './lib/constants.js'; type DocsTargetConfigParams = { config: string;