Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jest.debug.config.js
/nx-dev/nx-dev/public/documentation
/nx-dev/nx-dev/public/tutorials
/nx-dev/nx-dev/public/images/open-graph
/nx-dev/nx-dev/public/robots.txt
/nx-dev/nx-dev/public/sitemap-0.xml
/nx-dev/nx-dev/public/sitemap.xml

# Banner JSON files are generated during static builds
/nx-dev/nx-dev/lib/banner.json
Expand Down
1 change: 0 additions & 1 deletion astro-docs/validate-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const sitemapIndexPath = path.join(distDir, 'sitemap-index.xml');
const sitemapFallbackPath = path.join(distDir, 'sitemap-0.xml');
const nxDevSitemapPath = path.join(
workspaceRoot,
'dist',
'nx-dev',
'nx-dev',
'public',
Expand Down
6 changes: 6 additions & 0 deletions nx-dev/nx-dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Build output from next build
.next/

# Generated by next-sitemap during build
public/robots.txt
public/sitemap*.xml
10 changes: 2 additions & 8 deletions nx-dev/nx-dev/next-sitemap.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ const path = require('path');
const siteUrl = process.env.NX_DEV_URL || 'https://nx.dev';
const noIndex = process.env.NEXT_PUBLIC_NO_INDEX === 'true';

// On Netlify, the build output is in nx-dev/nx-dev/.next instead of dist/nx-dev/nx-dev/.next
const isNetlify = process.env.NETLIFY === 'true';
const buildOutputDir = isNetlify
? path.resolve(__dirname, '.next')
: path.resolve(__dirname, '../../dist/nx-dev/nx-dev/.next');
const publicOutputDir = isNetlify
? path.resolve(__dirname, 'public')
: path.resolve(__dirname, '../../dist/nx-dev/nx-dev/public');
const buildOutputDir = path.resolve(__dirname, '.next');
const publicOutputDir = path.resolve(__dirname, 'public');

/**
* @type {import('next-sitemap').IConfig}
Expand Down
13 changes: 9 additions & 4 deletions nx-dev/nx-dev/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ module.exports = withNx({
],
},
},
async redirects() {
return [
{
source: '/',
destination: '/blog',
permanent: false,
},
];
},
async rewrites() {
// Only configure rewrites if NEXT_PUBLIC_ASTRO_URL is set
// Remove trailing slash to prevent double slashes in rewrite destinations
Expand Down Expand Up @@ -146,10 +155,6 @@ module.exports = withNx({
'@nx/nx-dev-ui-video-courses',
'@nx/nx-dev-util-ai',
],
// For both client and server
env: {
VERCEL: process.env.VERCEL,
},
async headers() {
return [
{
Expand Down
61 changes: 47 additions & 14 deletions nx-dev/nx-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,60 @@
"type": "commonjs",
"private": true,
"dependencies": {
"ai": "3.0.19",
"@nx/nx-dev-data-access-documents": "workspace:*",
"@docsearch/react": "3.9.0",
"@grafana/faro-web-sdk": "1.19.0",
"@headlessui/react": "2.2.4",
"@heroicons/react": "2.2.0",
"@markdoc/markdoc": "0.2.2",
"@nx/graph": "1.0.5",
"@nx/nx-darwin-arm64": "21.6.2",
"@nx/nx-dev-data-access-courses": "workspace:*",
"@nx/nx-dev-data-access-documents": "workspace:*",
"@nx/nx-dev-feature-ai": "workspace:*",
"@nx/nx-dev-feature-analytics": "workspace:*",
"@nx/nx-dev-feature-feedback": "workspace:*",
"@nx/nx-dev-feature-search": "workspace:*",
"@nx/nx-dev-ui-animations": "workspace:*",
"@nx/nx-dev-ui-blog": "workspace:*",
"@nx/nx-dev-ui-common": "workspace:*",
"@nx/nx-dev-ui-courses": "workspace:*",
"@nx/nx-dev-ui-fence": "workspace:*",
"@nx/nx-dev-ui-icons": "workspace:*",
"@nx/nx-dev-util-ai": "workspace:*",
"@nx/nx-dev-ui-markdoc": "workspace:*",
"@nx/nx-dev-feature-analytics": "workspace:*",
"@nx/nx-dev-ui-podcast": "workspace:*",
"@nx/nx-dev-ui-pricing": "workspace:*",
"@nx/nx-dev-ui-primitives": "workspace:*",
"@nx/nx-dev-feature-feedback": "workspace:*",
"@nx/nx-dev-ui-theme": "workspace:*",
"@nx/nx-dev-feature-ai": "workspace:*",
"@nx/nx-dev-ui-animations": "workspace:*",
"@nx/nx-dev-feature-search": "workspace:*",
"@nx/nx-dev-ui-references": "workspace:*",
"@nx/nx-dev-ui-fence": "workspace:*",
"@nx/nx-dev-ui-blog": "workspace:*",
"@nx/nx-dev-ui-resources": "workspace:*",
"@nx/nx-dev-ui-podcast": "workspace:*",
"@nx/nx-dev-ui-pricing": "workspace:*",
"@nx/nx-dev-ui-video-courses": "workspace:*"
"@nx/nx-dev-ui-theme": "workspace:*",
"@nx/nx-dev-ui-video-courses": "workspace:*",
"@nx/nx-dev-util-ai": "workspace:*",
"@tailwindcss/aspect-ratio": "0.4.2",
"@tailwindcss/forms": "0.5.10",
"@tailwindcss/typography": "0.5.13",
"@yarnpkg/lockfile": "1.1.0",
"@yarnpkg/parsers": "3.0.2",
"ai": "3.0.19",
"axios": "1.12.0",
"classnames": "2.5.1",
"cliui": "8.0.1",
"enquirer": "2.3.6",
"framer-motion": "11.18.2",
"front-matter": "4.0.2",
"ignore": "7.0.5",
"next": "14.2.35",
"next-seo": "5.15.0",
"node-machine-id": "1.1.12",
"npm-run-path": "4.0.1",
"react": "18.3.1",
"react-copy-to-clipboard": "5.1.0",
"react-dom": "18.3.1",
"react-syntax-highlighter": "15.6.1",
"sharp": "0.33.5",
"string-width": "4.2.3",
"tailwind-merge": "2.6.0",
"tailwindcss": "3.4.4",
"tslib": "2.8.1",
"typescript": "5.9.2"
}
}
153 changes: 45 additions & 108 deletions nx-dev/nx-dev/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,93 +4,48 @@
"sourceRoot": "nx-dev/nx-dev",
"projectType": "application",
"targets": {
"build": {
"dependsOn": [
{
"target": "build-base"
}
],
"executor": "nx:run-commands",
"options": {
"commands": ["nx run nx-dev:sitemap"],
"parallel": false
},
"next:build": {
"dependsOn": ["copy-docs", "prebuild-banner"],
"inputs": [
"production",
"^production",
{ "env": "NEXT_PUBLIC_ASTRO_URL" }
"{projectRoot}/lib/banner.json",
{ "env": "NEXT_PUBLIC_ASTRO_URL" },
{ "env": "NX_DEV_URL" },
{ "env": "NEXT_PUBLIC_NO_INDEX" }
],
"outputs": ["{workspaceRoot}/dist/nx-dev/nx-dev"],
"configurations": {
"netlify": {
"outputs": ["{workspaceRoot}/nx-dev/nx-dev/.next"]
}
}
},
"check-links": {
"cache": true,
"dependsOn": ["nx-dev:build", "astro-docs:build"],
"executor": "nx:run-commands",
"options": {
"command": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/documentation/internal-link-checker.ts"
},
"inputs": [
"{workspaceRoot}/docs/**/*",
{ "dependentTasksOutputFiles": "**/sitemap*.xml" },
"{workspaceRoot}/scripts/tsconfig.scripts.json",
"{workspaceRoot}/scripts/documentation/internal-link-checker.ts"
"outputs": [
"{workspaceRoot}/nx-dev/nx-dev/.next",
"{workspaceRoot}/nx-dev/nx-dev/public/sitemap*.xml",
"{workspaceRoot}/nx-dev/nx-dev/public/robots.txt"
]
},
"test": {
"dependsOn": ["check-links"]
},
"sitemap": {
"dependsOn": ["build-base"],
"executor": "nx:run-commands",
"dependsOn": ["nx-dev:next:build"],
"inputs": [
"{workspaceRoot}/docs/**/*",
"production",
"{projectRoot}/next-sitemap.config.js",
{ "env": "NX_DEV_URL" },
{ "env": "NEXT_PUBLIC_NO_INDEX" }
],
"outputs": ["{workspaceRoot}/dist/nx-dev/nx-dev/public"],
"outputs": ["{workspaceRoot}/nx-dev/nx-dev/public/sitemap*.xml"],
"command": "pnpm next-sitemap --config ./next-sitemap.config.js && node ./scripts/patch-sitemap-index.mjs",
"options": {
"command": "pnpm next-sitemap --config ./nx-dev/nx-dev/next-sitemap.config.js && node ./nx-dev/nx-dev/scripts/patch-sitemap-index.mjs"
"cwd": "nx-dev/nx-dev"
}
},
"prebuild-banner": {
"executor": "nx:run-commands",
"cache": false,
"outputs": ["{projectRoot}/lib/banner.json"],
"command": "node ../../scripts/documentation/prebuild-banner.mjs",
"options": {
"command": "node ../../scripts/documentation/prebuild-banner.mjs",
"cwd": "nx-dev/nx-dev",
"env": {
"BANNER_OUTPUT_PATH": "lib/banner.json"
}
}
},
"build-base": {
"parallelism": false,
"executor": "@nx/next:build",
"dependsOn": ["copy-docs", "prebuild-banner"],
"inputs": ["production", "^production", "{projectRoot}/lib/banner.json"],
"outputs": ["{options.outputPath}"],
"options": {
"root": "nx-dev/nx-dev",
"outputPath": "dist/nx-dev/nx-dev"
},
"configurations": {
"development": {
"outputPath": "nx-dev/nx-dev"
},
"production": {},
"netlify": {
"outputPath": "nx-dev/nx-dev"
}
}
},
"copy-docs": {
"inputs": ["{workspaceRoot}/docs/**/*"],
"outputs": ["{projectRoot}/public/documentation"],
Expand All @@ -99,65 +54,47 @@
"cwd": "nx-dev/nx-dev"
}
},
"serve-docs": {
"copy-redirects": {
"dependsOn": ["nx-dev:next:build"],
"inputs": ["{projectRoot}/_redirects"],
"outputs": ["{projectRoot}/.next/_redirects"],
"command": "cp nx-dev/nx-dev/_redirects nx-dev/nx-dev/.next/_redirects"
},
"build": {
"dependsOn": ["sitemap", "copy-redirects"],
"outputs": ["{projectRoot}/.next"]
},
"deploy-build": {
"dependsOn": ["build"],
"outputs": ["{projectRoot}/.next"]
},
"serve": {
"executor": "nx:run-commands",
"dependsOn": ["copy-docs", "prebuild-banner"],
"options": {
"commands": [
"nx watch --projects=docs -- nx run-many -t=copy-docs -p nx-dev",
"nx run nx-dev:serve"
"nx dev nx-dev"
],
"parallel": true
}
},
"start": {
"dependsOn": ["build-base"],
"command": "nx run nx-dev:serve:production"
"command": "nx next:start nx-dev"
},
"serve": {
"executor": "@nx/next:server",
"dependsOn": ["copy-docs", "prebuild-banner"],
"options": {
"buildTarget": "nx-dev:build-base",
"dev": true
},
"configurations": {
"production": {
"buildTarget": "nx-dev:build-base:production",
"dev": false
},
"development": {
"buildTarget": "nx-dev:build-base:development",
"dev": true
}
},
"defaultConfiguration": "development"
"check-links": {
"cache": true,
"dependsOn": ["nx-dev:sitemap", "astro-docs:build"],
"command": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/documentation/internal-link-checker.ts",
"inputs": [
"{workspaceRoot}/docs/**/*",
{ "dependentTasksOutputFiles": "**/sitemap*.xml" },
"{workspaceRoot}/scripts/tsconfig.scripts.json",
"{workspaceRoot}/scripts/documentation/internal-link-checker.ts"
]
},
"deploy-build": {
"executor": "nx:run-commands",
"outputs": ["{projectRoot}/public/documentation"],
"options": {
"commands": [
{
"command": "nx run nx-dev:build",
"description": "NextJs build step"
}
],
"color": true,
"parallel": false,
"env": {
"NODE_OPTIONS": "--max-old-space-size=4096"
}
},
"configurations": {
"netlify": {
"commands": [
{
"command": "nx run nx-dev:build-base:netlify && cp nx-dev/nx-dev/_redirects nx-dev/nx-dev/.next/_redirects && nx run nx-dev:sitemap",
"description": "NextJs build for Netlify"
}
]
}
}
"test": {
"dependsOn": ["check-links"]
}
},
"tags": ["scope:nx-dev", "type:app"],
Expand Down
5 changes: 1 addition & 4 deletions nx-dev/nx-dev/scripts/patch-sitemap-index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import { readFileSync, writeFileSync } from 'fs';
import { resolve } from 'path';

const siteUrl = process.env.NX_DEV_URL || 'https://nx.dev';
const isNetlify = process.env.NETLIFY === 'true';
const outDir = isNetlify
? resolve(import.meta.dirname, '../public')
: resolve(import.meta.dirname, '../../../dist/nx-dev/nx-dev/public');
const outDir = resolve(import.meta.dirname, '../public');

const sitemapPath = resolve(outDir, 'sitemap.xml');

Expand Down
6 changes: 2 additions & 4 deletions nx-dev/nx-dev/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"lib": ["dom", "dom.iterable", "es2021", "esnext"],
"outDir": "../../dist/nx-dev/nx-dev",
"tsBuildInfoFile": "../../dist/nx-dev/nx-dev/tsconfig.tsbuildinfo",
"tsBuildInfoFile": "./tsconfig.tsbuildinfo",
"jsx": "preserve",
"allowJs": true,
"esModuleInterop": true,
Expand Down Expand Up @@ -34,9 +33,8 @@
"**/*.tsx",
"next-env.d.ts",
".next/types/**/*.ts",
"../../dist/nx-dev/nx-dev/.next/types/**/*.ts",
"public/documentation/**/*.json",
"dist/nx-dev/nx-dev/.next/types/**/*.ts"
"../../nx-dev/nx-dev/.next/types/**/*.ts"
],
"references": [
{
Expand Down
1 change: 1 addition & 0 deletions nx-dev/ui-video-courses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"types": "./src/index.ts",
"dependencies": {
"@nx/nx-dev-data-access-courses": "workspace:*",
"@nx/nx-dev-ui-icons": "workspace:*",
"@nx/nx-dev-ui-primitives": "workspace:*",
"@nx/nx-dev-ui-common": "workspace:*"
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
"@xstate/inspect": "0.7.0",
"@xstate/react": "3.0.1",
"@zkochan/js-yaml": "catalog:",
"ai": "3.0.19",
"ajv": "^8.12.0",
"angular-eslint": "catalog:eslint",
"autoprefixer": "10.4.13",
Expand Down
Loading
Loading