Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(documentation): add base search url #2799

Merged
merged 7 commits into from
Dec 19, 2022
Merged

fix(documentation): add base search url #2799

merged 7 commits into from
Dec 19, 2022

Conversation

nickschaap
Copy link
Contributor

@nickschaap nickschaap commented Dec 13, 2022

Description

Currently clicking on search results in production will lead you to 404 due to the fact that the base-url or SWC_DIR is not correctly set on production environments.

Carve out the build:search-index step from build:assets to conditionally apply build:search-index or build:search-index:prod based off the environment.

Related issue(s)

Motivation and context

How has this been tested?

  • Test case 1
    1. Run yarn docs:production
    2. Inspect searchIndex.json in the generated output for item refs to be prefixed with /spectrum-web-components/

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@github-actions
Copy link

github-actions bot commented Dec 13, 2022

Branch Preview

@github-actions
Copy link

github-actions bot commented Dec 13, 2022

Tachometer results

Currently, no packages are changed by this PR...

@@ -72,7 +74,7 @@ export async function search(value: string): Promise<ResultGroup[]> {
catagoryData.results.push({
name,
label: label(name),
url: item.ref,
url: BASE_URL + item.ref,
Copy link
Contributor

Choose a reason for hiding this comment

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

This work was previously being managed here and here. I'd definitely like to continue to process this at index build time, rather than site build time. This would likely involve a deeper understanding of how we leveraging our scripting in association with wireit to build and run the docs site. Something along the lines of breaking "build:search-index" out of the "build:assets" script and running a context specific version in each of "build"/"serve", which will likely be the same for the two contexts, and "build:production", which would need a value set for process.eng.SWC_DIR or possibly update the underlying script to accept a flag in the CLI instead...

@@ -13,8 +13,6 @@ governing permissions and limitations under the License.
import { build } from 'esbuild';
import { litCssPlugin } from 'esbuild-plugin-lit-css';
import postcss from 'postcss';
// import { postCSSPlugins } from '../../../scripts/css-processing.cjs';
import purgecss from '@fullhuman/postcss-purgecss';
Copy link
Contributor Author

@nickschaap nickschaap Dec 14, 2022

Choose a reason for hiding this comment

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

Removed unused import

@@ -192,7 +192,7 @@ body {
width: 36px;
height: 31px;
display: block;
margin-right: var(--spectrum-global-dimension-size-200);
Copy link
Contributor Author

@nickschaap nickschaap Dec 14, 2022

Choose a reason for hiding this comment

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

Used logical operators for RTL margins of the sidenav header

@@ -10,13 +10,13 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

import postHTMLSpectrumTypeography from './posthtml-spectrum-typography.js';
export { postHTMLSpectrumTypeography };
Copy link
Contributor Author

@nickschaap nickschaap Dec 14, 2022

Choose a reason for hiding this comment

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

Fixed typo

@nickschaap nickschaap marked this pull request as ready for review December 14, 2022 19:56
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for working through this. Really points out that we need a more reliable testing context for the code that actually makes it out to the live site for this, or we need to work on getting that context more like the review context. I've some ideas that I hopefully have some time for during the holiday lull this week and after the New Year.

@Westbrook Westbrook merged commit f7af7cd into main Dec 19, 2022
@Westbrook Westbrook deleted the search-base-url branch December 19, 2022 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants