diff --git a/.github/workflows/content-release.yml b/.github/workflows/content-release.yml index 89eddbe4b..66ac3842e 100644 --- a/.github/workflows/content-release.yml +++ b/.github/workflows/content-release.yml @@ -206,7 +206,52 @@ jobs: fi - name: Build sitemap - run: cd main && yarn build:sitemap + run: | + cd main && yarn build:sitemap + cd out + if [ -f sitemap.xml ]; then + echo "File found!" + cp sitemap.xml sitemap-nb.xml + else + touch sitemap-nb.xml + fi + shell: bash + + - name: setup bucket descriptor + id: bucket-descriptor + run: | + if [ "${{ inputs.build_type }}" == 'dev' ]; then + echo NEXT_SITEMAP_LOCATION="https://dev.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT + echo OLD_SITEMAP_LOCATION="https://dev.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + elif [ "${{ inputs.build_type }}" == 'staging'] ; then + echo NEXT_SITEMAP_LOCATION="https://staging.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT + echo OLD_SITEMAP_LOCATION="https://staging.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + elif [ "${{ inputs.build_type }}" == 'prod' ]; then + echo NEXT_SITEMAP_LOCATION="https://www.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT + echo OLD_SITEMAP_LOCATION="https://www.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + else + echo NEXT_SITEMAP_LOCATION="https://www.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT + echo OLD_SITEMAP_LOCATION="https://www.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + fi + shell: bash + + - name: Generate new sitemap + run: | + cd main + cd out + echo "${{steps.bucket-descriptor.outputs.OLD_SITEMAP_LOCATION}}" + cat <<'EOF' >> sitemap.xml + + + + ${{steps.bucket-descriptor.outputs.NEXT_SITEMAP_LOCATION}} + + + ${{steps.bucket-descriptor.outputs.OLD_SITEMAP_LOCATION}} + + + EOF + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4.0.2 diff --git a/.yarn/cache/@types-lodash-npm-4.17.10-033d752d27-4600f2f252.zip b/.yarn/cache/@types-lodash-npm-4.17.10-033d752d27-4600f2f252.zip new file mode 100644 index 000000000..5abaada71 Binary files /dev/null and b/.yarn/cache/@types-lodash-npm-4.17.10-033d752d27-4600f2f252.zip differ diff --git a/READMEs/business-logic.md b/READMEs/business-logic.md index 1d0aa4375..e44c5e27d 100644 --- a/READMEs/business-logic.md +++ b/READMEs/business-logic.md @@ -52,7 +52,7 @@ For event articles, it was decided to keep time localization on Next rather than ## Implementation -The timezone calculations can be found in the [date.ts](src/lib/utils/date.ts) file line 219 `deriveFormattedTimestamp`. +The timezone calculations can be found in the [date.ts](../src/lib/utils/date.ts) file line 219 `deriveFormattedTimestamp`. ## Contact/Owner @@ -85,7 +85,7 @@ Next has a condition that detects whether an event has passed. If the event has ## Implementation -The business logic can be found in the [event index.ts](src/templates/layouts/event/index.tsx) file line 224. +The business logic can be found in the [event index.ts](../src/templates/layouts/event/index.tsx) file line 224. ## Contact/Owner diff --git a/READMEs/quickstart.md b/READMEs/quickstart.md index 09e3706b0..3dbc1ca0a 100644 --- a/READMEs/quickstart.md +++ b/READMEs/quickstart.md @@ -4,13 +4,13 @@ The goal of this document is to be used as a reference sheet to quickstart devel ## Recommended READMEs to start with -- [generators.md](READMEs/generators.md) : Read to understand how to quickly generate layout, component, and query templates -- [queries.md](READMEs/quickstart.md) : Read to understand the database queries or search parameters that are being used in your project, as this file typically contains information or documentation related to database interactions. -- [templates.md](READMEs/templates.md) : Read to understand the structure and organization of front-end templates in the src/templates directory, including their categorization, required files, and usage of React components and types. -- [typescript.md](READMEs/typescript.md) : Read to understand how Typescript is used in the next-build application, including the structure and usage of specific types, the flow of data through the application, and how to configure Typescript for development. It also provides insights into the application's architecture and the rationale behind certain design decisions. -- [testing.md](READMEs/testing.md) : Read to understand the testing procedures. -- [[...slug.md]]() : Read to understand how next-build handles page routing and the history and thought process to its decision. -- [preview.md](READMEs/preview.md) : Recommended README for preview issue during setup +- [generators.md](generators.md) : Read to understand how to quickly generate layout, component, and query templates +- [queries.md](queries.md) : Read to understand the database queries or search parameters that are being used in your project, as this file typically contains information or documentation related to database interactions. +- [templates.md](templates.md) : Read to understand the structure and organization of front-end templates in the src/templates directory, including their categorization, required files, and usage of React components and types. +- [typescript.md](typescript.md) : Read to understand how Typescript is used in the next-build application, including the structure and usage of specific types, the flow of data through the application, and how to configure Typescript for development. It also provides insights into the application's architecture and the rationale behind certain design decisions. +- [testing.md](testing.md) : Read to understand the testing procedures. +- [[...slug.md]]([[...slug]].md) : Read to understand how next-build handles page routing and the history and thought process to its decision. +- [preview.md](preview.md) : Recommended README for preview issue during setup The rest of the READMEs still hold valuable information, but might be running in the background, used for specific situations, or holds information that will make the development process easier, but is not mandatory to get things up and running @@ -52,9 +52,8 @@ This is a high-level breakdown of what will the core areas in the repository you ## Generating a layout -As listed above, please read [generators.md](READMEs/generators.md) +As listed above, please read [generators.md](generators.md) -[Link to environment setup documentation](https://github.com/department-of-veterans-affairs/next-build/tree/main?tab=readme-ov-file#next-build) A video walkthrough should be available to assist in setting up. If not compressed and posted here yet. The Slack thread in which they exist is [here](https://dsva.slack.com/archives/D071CCW690E/p1723650927105169). The 30 minute video is the layout creation walkthrough. > [!NOTE] @@ -90,7 +89,7 @@ When creating a new layout, create a new feature branch from main and use `yarn - Path `src/data/queries/tests/snapshots/` - Automatically generated jest snapshot - Compares current output of `formatData` to the snapshot - - Snapshot may not update immediately and would require to run a manual `yarn test -- -u`. Details from [testing.md](READMEs/testing.md) + - Snapshot may not update immediately and would require to run a manual `yarn test -- -u`. Details from [testing.md](testing.md) - Path `src/mocks/` - Copy and paste one JSON object from Drupal API to be used in Jest tests - Path `playwright/tests/` @@ -179,7 +178,7 @@ You won’t be able to commit unless: - Yarn test will run tests on the entirety of next-build - Once you commit and push for pull request, a series of tests will run on the pull request - One of the common points of failed passing is tugboat which will have an error log to view why tugboat failed - - Our [tugboat ReadME](READMEs/tugboat.md) is brief but should redirect to the VA tugboat doc for more information. + - Our [tugboat ReadME](tugboat.md) is brief but should redirect to the VA tugboat doc for more information. ## Test commands diff --git a/docker-run.sh b/docker-run.sh index 1e12f44bc..b0ffe6b08 100644 --- a/docker-run.sh +++ b/docker-run.sh @@ -1,3 +1,3 @@ #!/bin/sh -ls -al envs + APP_ENV=$APP_ENV yarn build:preview && yarn start diff --git a/envs/.env.dev b/envs/.env.dev index 928e70742..77d7dc457 100644 --- a/envs/.env.dev +++ b/envs/.env.dev @@ -21,5 +21,8 @@ NEXT_PUBLIC_GOOGLE_TAG_MANAGER_AUTH=N9BisSDKAwJENFQtQIEvXQ NEXT_PUBLIC_GOOGLE_TAG_MANAGER_PREVIEW=env-423 # Feature flags for enabling content types. These should only be added when you are preparing to go to prod and are testing on dev. -FEATURE_NEXT_BUILD_CONTENT_EVENT=true +# It is better to test these from the CMS backend for dev than here. FEATURE_NEXT_BUILD_CONTENT_EVENT_LISTING=true +FEATURE_NEXT_BUILD_CONTENT_EVENT=true + + diff --git a/envs/.env.prod b/envs/.env.prod index a3d830ad8..03334a046 100644 --- a/envs/.env.prod +++ b/envs/.env.prod @@ -25,7 +25,3 @@ NEXT_PUBLIC_GOOGLE_TAG_MANAGER_PREVIEW=env-1 # For example, never add and enable a variable like the following to this file: # FEATURE_NEXT_BUILD_CONTENT_EVENT=true # Again, do NOT add these here. - -# ... Except, prior to initial launch, we will need these here for prod testing. -FEATURE_NEXT_BUILD_CONTENT_EVENT=true -FEATURE_NEXT_BUILD_CONTENT_EVENT_LISTING=true diff --git a/envs/.env.staging b/envs/.env.staging index 7c6d796bd..4cbac0894 100644 --- a/envs/.env.staging +++ b/envs/.env.staging @@ -18,5 +18,4 @@ NEXT_PUBLIC_GOOGLE_TAG_MANAGER_AUTH=inC4EKQce9vlWpRVcowiyQ NEXT_PUBLIC_GOOGLE_TAG_MANAGER_PREVIEW=env-661 # Feature flags for enabling content types. These should only be added when you are preparing to go to prod and are testing on staging. -FEATURE_NEXT_BUILD_CONTENT_EVENT=true -FEATURE_NEXT_BUILD_CONTENT_EVENT_LISTING=true +# It is better to test these from the CMS backend for staging than here. diff --git a/next-sitemap.config.js b/next-sitemap.config.js index 742be3d89..ff528d2e1 100644 --- a/next-sitemap.config.js +++ b/next-sitemap.config.js @@ -4,11 +4,12 @@ const sitemapConfig = { siteUrl: process.env.SITE_URL || 'https://localhost:8001', // output: 'export' directory from next config outDir: 'out', - generateIndexSitemap: true, + generateIndexSitemap: false, + sitemapSize: 100000, //set some large size in bytes so we have one sitemap.xml? // relative paths to exclude exclude: [], - generateRobotsTxt: true, // (optional) + generateRobotsTxt: false, // (optional) // todo: migrate to server side sitemap to include last edited date from content for lastmod // will need to update static-path-resources to optionally include that field when requested diff --git a/package.json b/package.json index c932e79ce..bc7c94796 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^14.5.1", "@types/jest": "^29.5.12", - "@types/lodash": "^4.17.7", + "@types/lodash": "^4.17.10", "@types/node": "22.5.4", "@types/react": "^18.3.1", "@types/react-dom": "^18.2.18", diff --git a/packages/env-loader/src/env-file.ts b/packages/env-loader/src/env-file.ts index 50e5f6689..9a80ddea3 100644 --- a/packages/env-loader/src/env-file.ts +++ b/packages/env-loader/src/env-file.ts @@ -5,21 +5,17 @@ import { EnvVars } from '.' const loadEnvVarsFromPath = (path: string): EnvVars => { const envVars = {} - // eslint-disable-next-line no-console - console.log(`trying to load vars from ${path}`) dotenvExpand.expand( dotenv.config({ - path: path, + path, override: true, processEnv: envVars, - debug: true, }) ) // eslint-disable-next-line no-console console.log(`Using environment variables from: ${path}`) - // eslint-disable-next-line no-console - console.log(envVars) + return envVars } diff --git a/src/assets/styles/globals.css b/src/assets/styles/globals.css index a788f3360..2008a97be 100644 --- a/src/assets/styles/globals.css +++ b/src/assets/styles/globals.css @@ -30,3 +30,25 @@ body { height: 44px; width: 133px; } + +/* header search styles */ +.header-search { + input { + max-width: unset; + } +} + +.search-input-container { + max-width: unset !important; +} + +.search-input { + max-width: unset !important; +} + +.search-button { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + height: 42px; + width: 45px; +} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 19b68339d..be54cb2ce 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -17,7 +17,7 @@ type AppPropsWithLayout = AppProps & { export function reportWebVitals(metric: object) { // eslint-disable-next-line no-console - console.log(metric) + // console.log(metric) } export default function MyApp({ diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index c070a36fa..94a729449 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -1,126 +1,148 @@ -import { Html, Main, NextScript, Head } from 'next/document' +import Document, { Html, Main, NextScript, Head } from 'next/document' import { GTM_ID } from '@/lib/analytics' import Script from 'next/script' +import React from 'react' -const Document = () => { - const ASSETS_URL = process.env.NEXT_PUBLIC_ASSETS_URL || '/generated/' +class CustomHead extends Head { + getScripts(files) { + const originalScripts = super.getScripts(files) + return originalScripts.map((script) => { + return React.cloneElement(script, { + 'data-nb-nonce': '**CSP_NONCE**', + }) + }) + } +} + +class CustomDocument extends Document { + #ASSETS_URL = process.env.NEXT_PUBLIC_ASSETS_URL || '/generated/' + #nonce = '**CSP_NONCE**' - return ( - - - - - + render() { + return ( + + + + + -