Skip to content
Open
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
53 changes: 46 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions projects/core/src/tabs/tabs.examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ export const Links = {
render: () => html`
<nve-tabs>
<nve-tabs-item selected>
<a href="./docs/elements/tabs/#links">Tab 1</a>
<a href="#links">Tab 1</a>
</nve-tabs-item>
<nve-tabs-item>
<a href="./docs/elements/tabs/#links">Tab 2</a>
<a href="#links">Tab 2</a>
</nve-tabs-item>
<nve-tabs-item>
<a href="/docs/elements/tabs/#links">Tab 3</a>
<a href="#links">Tab 3</a>
</nve-tabs-item>
</nve-tabs>`
};
Expand Down
25 changes: 11 additions & 14 deletions projects/site/eleventy.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { EleventyRenderPlugin, IdAttributePlugin } from '@11ty/eleventy';
import { EleventyRenderPlugin, HtmlBasePlugin, IdAttributePlugin } from '@11ty/eleventy';
import EleventyPluginVite from '@11ty/eleventy-plugin-vite';
import litPlugin from '@lit-labs/eleventy-plugin-lit';

Expand All @@ -19,6 +19,7 @@ import { llmsTxtPlugin } from './src/_11ty/plugins/llms-txt.js';
import { sitemapPlugin } from './src/_11ty/plugins/sitemap-xml.js';
import { elementLoaderTransform } from './src/_11ty/transforms/element-loader.js';
import { anchorGeneratorTransform } from './src/_11ty/transforms/anchor-generator.js';
import { siteUrlsTransform } from './src/_11ty/transforms/site-urls.js';
import { htmlMinifyTransform } from './src/_11ty/transforms/html-minify.js';
import { envReplaceTransform } from './src/_11ty/transforms/env-replace.js';
import {
Expand All @@ -42,6 +43,7 @@ import { svgLogoShortcode, svgLogosShortcode } from './src/_11ty/shortcodes/svg-
import { tokensShortcode } from './src/_11ty/shortcodes/tokens.js';
import markdown from './src/_11ty/libraries/markdown.js';
import { ApiService } from '@internals/metadata';
import { ELEMENTS_SITE_ORIGIN } from './src/_11ty/utils/site-url.js';

const apis = await ApiService.getData();

Expand Down Expand Up @@ -88,6 +90,8 @@ const entrypoints = [
* Sets up plugins, transforms, collections, and build options
*/
export default function (eleventyConfig) {
eleventyConfig.pathPrefix = BASE_URL;

// Add core 11ty plugins
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(IdAttributePlugin, { checkDuplicates: false });
Expand Down Expand Up @@ -154,18 +158,6 @@ export default function (eleventyConfig) {
}
});

// Configure server options for development
eleventyConfig.setServerOptions({
onRequest: {
'/': () => ({
status: 307,
headers: {
Location: BASE_URL
}
})
}
});

// Add search plugin for documentation search functionality
if (process.env.ELEVENTY_RUN_MODE === 'build') {
eleventyConfig.addPlugin(searchPlugin, {
Expand Down Expand Up @@ -209,6 +201,10 @@ export default function (eleventyConfig) {
eleventyConfig.addTransform('env-replace', envReplaceTransform);
eleventyConfig.addTransform('element-loader', elementLoaderTransform);
eleventyConfig.addTransform('anchor-generator', anchorGeneratorTransform);
eleventyConfig.addPlugin(HtmlBasePlugin, {
baseHref: process.env.ELEVENTY_RUN_MODE === 'build' ? ELEMENTS_SITE_ORIGIN : '/'
});
eleventyConfig.addTransform('site-urls', siteUrlsTransform);

if (process.env.ELEVENTY_RUN_MODE === 'build') {
eleventyConfig.addTransform('html-minify', htmlMinifyTransform);
Expand Down Expand Up @@ -263,6 +259,7 @@ export default function (eleventyConfig) {
input: 'src',
output: 'dist',
layouts: '_11ty/layouts'
}
},
pathPrefix: BASE_URL
};
}
32 changes: 17 additions & 15 deletions projects/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
"ELEMENTS_SITE_URL": {
"external": true,
"default": "https://nvidia.github.io"
},
"LOCAL_PREVIEW": {
"external": true,
"default": "false"
}
}
},
Expand Down Expand Up @@ -197,14 +201,11 @@
]
},
"test": {
"command": "vitest run src/_11ty/layouts/metadata.test.ts src/_11ty/shortcodes/api.test.ts",
"command": "vitest run src/_11ty/layouts/metadata.test.ts src/_11ty/layouts/links.test.ts src/_11ty/transforms/site-urls.test.ts src/_11ty/shortcodes/api.test.ts",
"files": [
"src/docs/**/*.md",
"src/_11ty/layouts/common.js",
"src/_11ty/layouts/metadata.js",
"src/_11ty/layouts/metadata.test.ts",
"src/_11ty/shortcodes/api.js",
"src/_11ty/shortcodes/api.test.ts",
"src/**/*.js",
"src/**/*.md",
"src/**/*.ts",
"vitest.config.ts"
],
"output": []
Comment on lines +204 to 211

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚖️ Poor tradeoff

Consider narrowing the test watch patterns to test files only.

The files array now watches all source files (src/**/*.js, src/**/*.md, src/**/*.ts) rather than just test files. This means tests will re-run whenever any source file changes, not just when test files change. While this ensures tests stay fresh, it may cause unnecessary test runs during development.

If tests should only re-run when test files change, consider:

 "files": [
-  "src/**/*.js",
-  "src/**/*.md",
-  "src/**/*.ts",
+  "src/**/*.test.ts",
+  "src/**/*.test.js",
   "vitest.config.ts"
 ],

Otherwise, if the current behavior is intentional (to ensure tests run on any source change), this is fine.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"command": "vitest run src/_11ty/layouts/metadata.test.ts src/_11ty/layouts/links.test.ts src/_11ty/transforms/site-urls.test.ts src/_11ty/shortcodes/api.test.ts",
"files": [
"src/docs/**/*.md",
"src/_11ty/layouts/common.js",
"src/_11ty/layouts/metadata.js",
"src/_11ty/layouts/metadata.test.ts",
"src/_11ty/shortcodes/api.js",
"src/_11ty/shortcodes/api.test.ts",
"src/**/*.js",
"src/**/*.md",
"src/**/*.ts",
"vitest.config.ts"
],
"output": []
"command": "vitest run src/_11ty/layouts/metadata.test.ts src/_11ty/layouts/links.test.ts src/_11ty/transforms/site-urls.test.ts src/_11ty/shortcodes/api.test.ts",
"files": [
"src/**/*.test.ts",
"src/**/*.test.js",
"vitest.config.ts"
],
"output": []
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/site/package.json` around lines 204 - 211, The current package.json
test task watches all source files via the "files" array which causes tests
defined in the "command" (e.g., metadata.test.ts, links.test.ts,
site-urls.test.ts, api.test.ts) to re-run on any src change; update the "files"
array to only match test files (for example restrict to patterns like
src/**/*.{test,spec}.ts or src/**/*.test.ts and include matching .js/.md if you
have test variants) so that vitest only reruns when test files change, leaving
the "command" unchanged.

Expand Down Expand Up @@ -233,42 +234,43 @@
}
},
"dependencies": {
"3d-force-graph": "1.79.0",
"chart.js": "4.5.1",
"lit": "catalog:",
"3d-force-graph": "1.79.0"
"lit": "catalog:"
},
"devDependencies": {
"@11ty/eleventy": "catalog:",
"@11ty/eleventy-plugin-vite": "catalog:",
"@eslint/js": "catalog:",
"@lit-labs/eleventy-plugin-lit": "catalog:",
"@lit-labs/ssr-client": "catalog:",
"@internals/eslint": "workspace:*",
"@internals/metadata": "workspace:*",
"@internals/tools": "workspace:*",
"@internals/patterns": "workspace:*",
"@internals/tools": "workspace:*",
"@internals/vite": "workspace:*",
"@lit-labs/eleventy-plugin-lit": "catalog:",
"@lit-labs/ssr-client": "catalog:",
"@nvidia-elements/code": "workspace:*",
"@nvidia-elements/core": "workspace:*",
"@nvidia-elements/forms": "workspace:*",
"@nvidia-elements/lint": "workspace:*",
"@nvidia-elements/markdown": "workspace:*",
"@nvidia-elements/media": "workspace:*",
"@nvidia-elements/core": "workspace:*",
"@nvidia-elements/monaco": "workspace:*",
"@nvidia-elements/styles": "workspace:*",
"@nvidia-elements/themes": "workspace:*",
"@vitest/coverage-istanbul": "catalog:",
"compare-versions": "6.1.1",
"eslint": "catalog:",
"stylelint": "catalog:",
"stylelint-config-standard": "catalog:",
"html-minifier-next": "5.2.2",
"lighthouse": "catalog:",
"lightningcss": "1.30.2",
"markdown-it": "catalog:",
"markdown-it-link-attributes": "catalog:",
"pagefind": "1.3.0",
"parse5": "7.1.2",
"playwright": "catalog:",
"stylelint": "catalog:",
"stylelint-config-standard": "catalog:",
"typescript": "catalog:",
"vite": "catalog:",
"vitest": "catalog:"
Expand Down
Loading