Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Update to API Docs 24.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Schmalfeldt committed Mar 22, 2024
1 parent 6a7156c commit f5b3a8b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ BUILD_ID="local"
NEXT_PUBLIC_GOOGLE_ANALYTICS="G-G1ER54K5N0"
NEXT_PUBLIC_SITE_URL="https://sfccdocs.com"
PORT=3000
SELECTED_VERSION="23.9"
SELECTED_VERSION="24.3"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 SFCC DevOps
Copyright (c) 2024 SFCC DevOps

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 14 additions & 14 deletions bin/cmd/build-nav.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export default (cli) => {
// First pass to create parents
metaKeys.forEach((key) => {
// Check for existing primary nav
const idx = nav.findIndex((parent) => parent.title === meta[key]?.nav.parent)
const idx = nav.findIndex((parent) => parent.title.trim() === meta[key]?.nav.parent.trim())

// Make new nav group if necessary
if (idx < 0) {
nav.push({
title: meta[key].nav.parent,
alt: `Choose a ${meta[key].nav.parent}`,
title: meta[key].nav.parent.trim(),
alt: `Choose a ${meta[key].nav.parent.trim()}`,
href: '#',
links: [],
})
Expand All @@ -48,14 +48,14 @@ export default (cli) => {
// Second Pass to create groups within parents
metaKeys.forEach((key) => {
// Check for existing primary nav
const idx = nav.findIndex((parent) => parent.title === meta[key]?.nav.parent)
const groupIdx = nav[idx].links.findIndex((group) => group.title === meta[key]?.nav.child)
const idx = nav.findIndex((parent) => parent.title.trim() === meta[key]?.nav.parent.trim())
const groupIdx = nav[idx].links.findIndex((group) => group.title.trim() === meta[key]?.nav.child.trim())

// Make new nav group if necessary
if (groupIdx < 0) {
nav[idx].links.push({
title: meta[key].nav.child,
alt: `${meta[key]?.nav.parent}${meta[key].nav.child}`,
title: meta[key].nav.child.trim(),
alt: `${meta[key]?.nav.parent.trim()}${meta[key].nav.child.trim()}`,
href: '#',
children: [],
})
Expand All @@ -65,26 +65,26 @@ export default (cli) => {
// Last pass to create links within groups
metaKeys.forEach((key) => {
// Check for existing primary nav
const idx = nav.findIndex((parent) => parent.title === meta[key]?.nav.parent)
const groupIdx = nav[idx].links.findIndex((group) => group.title === meta[key]?.nav.child)
const idx = nav.findIndex((parent) => parent.title.trim() === meta[key]?.nav.parent.trim())
const groupIdx = nav[idx].links.findIndex((group) => group.title.trim() === meta[key]?.nav.child.trim())

if (idx > -1 && groupIdx > -1) {
nav[idx].links[groupIdx].children.push({
title: meta[key].nav.title,
alt: meta[key].nav.alt,
title: meta[key].nav.title.trim(),
alt: meta[key].nav.alt.trim(),
href: meta[key].deprecated ? `/deprecated${key}` : key,
deprecated: meta[key].deprecated,
})
}
})

// Sort all the things
nav.sort((a, b) => (a.title > b.title ? 1 : -1))
nav.forEach((page) => page.links.sort((a, b) => (a.title > b.title ? 1 : -1)))
nav.sort((a, b) => (a.title.trim() > b.title.trim() ? 1 : -1))
nav.forEach((page) => page.links.sort((a, b) => (a.title.trim() > b.title.trim() ? 1 : -1)))
nav.forEach((page) =>
page.links.forEach((sub) => {
if (sub.children) {
sub.children.sort((a, b) => (a.title > b.title ? 1 : -1))
sub.children.sort((a, b) => (a.title.trim() > b.title.trim() ? 1 : -1))
}
})
)
Expand Down
7 changes: 7 additions & 0 deletions bin/cmd/prep.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ export default async (cli) => {
description = meta[url].deprecated ? `[DEPRECATED] ${parent}: ${title}` : `${parent}: ${title}`
}

// Trim Text
parent = parent.trim()
title = title.trim()
description = description.trim()
groupTitle = groupTitle.trim()

// Update Mapping
meta[url].parent = parent
meta[url].group = groupTitle
Expand All @@ -476,6 +482,7 @@ export default async (cli) => {
navTitle = navTitle.replace(reParent, '')
navTitle = navTitle.replace(reGroup, '')
navTitle = navTitle.replace(reGroupAlt, '')
navTitle = navTitle.trim()

meta[url].nav = {
parent: parent,
Expand Down
4 changes: 2 additions & 2 deletions bin/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ if (fs.existsSync(SUPPORTED_VERSIONS_FILE)) {

// Export version information
export const SUPPORTED_VERSIONS = supportedVersions
export const UPCOMING_VERSION = supportedVersions ? supportedVersions.find((version) => version.release === 'upcoming').value : null
export const CURRENT_VERSION = supportedVersions ? supportedVersions.find((version) => version.release === 'current').value : null
export const UPCOMING_VERSION = supportedVersions ? supportedVersions.find((version) => version.release === 'upcoming')?.value : null
export const CURRENT_VERSION = supportedVersions ? supportedVersions.find((version) => version.release === 'current')?.value : null
export const SELECTED_VERSION = process.env.SELECTED_VERSION && supportedVersions ? supportedVersions.find((version) => version.value === process.env.SELECTED_VERSION.toString()).value : CURRENT_VERSION
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sfccdevops/sfcc-docs",
"version": "0.6.0",
"version": "0.7.0",
"description": "Unofficial community edition of the Salesforce Commerce Cloud developer documentation.",
"license": "MIT",
"author": "Peter Schmalfeldt <[email protected]>",
Expand Down
3 changes: 2 additions & 1 deletion src/components/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ export function Layout({ children, title, tableOfContents, isMarkdoc = false, is
<Prose>{children}</Prose>

{/* Salesforce Copyright Added Back */}
{!isHomePage && isEmbedded === false && <div className="mt-8 font-display text-sm font-medium text-slate-500 dark:text-slate-400">&copy; {new Date().getUTCFullYear()} salesforce.com, inc. All rights reserved.</div>}
{!isHomePage && isEmbedded === false && <div className="mt-8 font-display text-sm font-medium text-slate-500 dark:text-slate-400">&copy; Copyright 2000-{new Date().getUTCFullYear()} salesforce.com inc. All rights reserved. Various
trademarks held by their respective owners.</div>}

{/* GitHub Search Button */}
{!isHomePage && isEmbedded === false && (
Expand Down

0 comments on commit f5b3a8b

Please sign in to comment.