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

Commit

Permalink
Lot's of goodies
Browse files Browse the repository at this point in the history
- Added Quota Docs for #17
- Added Schema Docs for #16
- Added Progressive Web App support
- Added note for how to use search on home page for #9
- Added Sitemap Generator to Build Script
- Added some cleanup to generator scripts to remove old folders before recreating ( cause of #10 )
- Fixed #10 where incorrect URLs were showing up in search results
- Fixed #11 Mobile Menu Filter page tap issue
- Fixed #12 Mobile Menu Overscroll
- Fixed #13 Page Scroll resetting
- Fixed #14 where Mobile Active Link was not scrolled into viewport
- Fixed #18 where scrolling issue was causing iPad devices to scroll search off screen
- Started support for #15 that wants Offline Doc support ( getting PWA setup first was key )
  • Loading branch information
manifestinteractive committed Sep 18, 2023
1 parent ff19639 commit e047e54
Show file tree
Hide file tree
Showing 46 changed files with 4,151 additions and 236 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SELECTED_VERSION="23.8"
SITE_URL="https://sfccdocs.com"
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,13 @@ src/data
public/json
*.zip
.env

#PWA
public/sw.js
public/sw.js.map
public/workbox-*.js
public/workbox-*.js.map
public/fallback-*.js
public/sitemap.xml
public/sitemap-*.xml
public/robots.txt
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ audit=false
fund=false
loglevel=error
legacy-peer-deps=true
enable-pre-post-scripts=true
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

> Here's our record of all notable changes
## v0.4.0

- Added Quota Docs for #17
- Added Schema Docs for #16
- Added Progressive Web App support
- Added note for how to use search on home page for #9
- Added Sitemap Generator to Build Script
- Added some cleanup to generator scripts to remove old folders before recreating ( cause of #10 )
- Fixed #10 where incorrect URLs were showing up in search results
- Fixed #11 Mobile Menu Filter page tap issue
- Fixed #12 Mobile Menu Overscroll
- Fixed #13 Page Scroll resetting
- Fixed #14 where Mobile Active Link was not scrolled into viewport
- Fixed #18 where scrolling issue was causing iPad devices to scroll search off screen
- Started support for #15 that wants Offline Doc support ( getting PWA setup first was key )

## v0.3.0

- Major updates to Search Engine to make it easier to use
Expand Down
4 changes: 1 addition & 3 deletions bin/cmd/build-nav.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ export default (cli) => {
}
})

const rootSort = ['ISML', 'Script', 'Job Step', 'Pipelet']

// Sort all the things
nav.sort((a, b) => (rootSort.indexOf(a.title) > rootSort.indexOf(b.title) ? 1 : -1))
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.forEach((page) =>
page.links.forEach((sub) => {
Expand Down
8 changes: 7 additions & 1 deletion bin/cmd/convert.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import TurndownService from 'turndown'

import { Glob } from 'glob'
import { minify } from 'html-minifier'
import { spawnSync } from 'child_process'

import { getVersion } from '../utils.mjs'
import { DATA_FOLDER, MARKDOWN_FOLDER, PREP_FOLDER } from '../config.mjs'
Expand Down Expand Up @@ -69,7 +70,12 @@ export default (cli) => {
process.exit()
}

// Make markdown folder if needed
// Remove old prep folder for version if it exists
if (fs.existsSync(markdownFolder)) {
spawnSync('rm', ['-fr', markdownFolder])
}

// Recreate Markdown folder
if (!fs.existsSync(markdownFolder)) {
fs.mkdirSync(markdownFolder, { recursive: true })
}
Expand Down
42 changes: 33 additions & 9 deletions bin/cmd/prep.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ export default async (cli) => {
groupTitle = groupTitle.replace(/ \(internal\)/gi, '')
}

if (!groupTitle && file.toLowerCase().includes(`${SEP}specification${SEP}isml${SEP}`)) {
groupTitle = 'ISML'
}

if (!groupTitle && file.toLowerCase().includes(`${SEP}specification${SEP}quota${SEP}`)) {
groupTitle = 'Quota'
}

if (!groupTitle && file.toLowerCase().includes(`${SEP}specification${SEP}schema${SEP}`)) {
groupTitle = 'Schema'
}

// Set a new file name for prepped HTML file
const newFile = prepURI(file, version, groupTitle)

Expand Down Expand Up @@ -157,7 +169,7 @@ export default async (cli) => {
dom.querySelector('body').removeAttribute('onload')

// Remove elements that are not helpful for search indexer of markdown conversion
dom.querySelectorAll('div:empty, a:empty, link, script, meta, div.banner, img, div.packageName').forEach((x) => {
dom.querySelectorAll('div:empty, a:empty, link, script, meta, style, div.banner, img, div.packageName').forEach((x) => {
x.remove()
})

Expand All @@ -167,6 +179,14 @@ export default async (cli) => {
$hr.remove()
}

// Generate H1 Tags
const $code = dom.querySelectorAll('p.className')
if ($code) {
$code.forEach((x) => {
x.tagName = 'code'
})
}

// Generate H1 Tags
const $h1 = dom.querySelectorAll('div.className, span.newTitle')
if ($h1) {
Expand Down Expand Up @@ -208,9 +228,9 @@ export default async (cli) => {
}

// Covert elements to code
const $code = dom.querySelectorAll('div.parameterDetail')
if ($code) {
$code.forEach((x) => {
const $blockquote = dom.querySelectorAll('div.parameterDetail')
if ($blockquote) {
$blockquote.forEach((x) => {
x.tagName = 'blockquote'
})
}
Expand Down Expand Up @@ -346,6 +366,10 @@ export default async (cli) => {
let title = dom.querySelector('title')?.innerText.replace(/\n/g, ' ').trim() || null
let description = dom.querySelector('div.topLevelDescription')?.innerText.replace(/\n/g, ' ').trim() || null

if (!title) {
title = dom.querySelector('h1')?.innerText.replace(/\n/g, ' ').trim() || null
}

if (!groupTitle) {
const splitGroup = newFilePath.match(/script\/([^\/]+)/)
groupTitle = splitGroup ? splitGroup[1] : null
Expand Down Expand Up @@ -413,15 +437,15 @@ export default async (cli) => {
} else if (newFilePath.includes(`${SEP}pipelet${SEP}`)) {
title = title !== groupTitle ? title.replace('Pipelet ', `${groupTitle} `) : title.replace('Pipelet ', '')
parent = 'Pipelet'
} else if (newFilePath.includes(`${SEP}quota${SEP}`)) {
parent = 'Quota'
} else if (newFilePath.includes(`${SEP}script${SEP}`)) {
title = title.replace('Class ', groupTitle === 'Top Level' ? `Class ${groupTitle} ` : `Class ${groupTitle}.`)
parent = 'Script'
} else if (newFilePath.includes(`${SEP}isml${SEP}`)) {
} else if (newFilePath.includes(`${SEP}specification${SEP}`)) {
parent = 'Specification'
}

if (newFilePath.includes(`${SEP}isml${SEP}`)) {
title = title.replace('ISML ', '').replace(' Element', '')
groupTitle = 'Element'
parent = 'ISML'
}

// Last check to see if we have a description
Expand Down
19 changes: 19 additions & 0 deletions bin/cmd/update-site.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ export default (cli) => {

debug(chalk.green.bold(`UPDATING SITE: v${version}`))

// Dynamic folders we should trash
const folderDeprecated = path.resolve(SRC_PAGES_FOLDER, 'deprecated')
const folderJobStep = path.resolve(SRC_PAGES_FOLDER, 'jobstep')
const folderPipelet = path.resolve(SRC_PAGES_FOLDER, 'pipelet')
const folderSpecification = path.resolve(SRC_PAGES_FOLDER, 'specification')

// Remove old version folder if it exists
if (fs.existsSync(folderDeprecated)) {
spawnSync('rm', ['-fr', folderDeprecated])
}

if (fs.existsSync(folderJobStep)) {
spawnSync('rm', ['-fr', folderJobStep])
}

if (fs.existsSync(folderSpecification)) {
spawnSync('rm', ['-fr', folderSpecification])
}

// Copy new version folder
spawnSync('cp', ['-R', path.join(MARKDOWN_FOLDER, version, '/*'), SRC_PAGES_FOLDER], { shell: true })

Expand Down
1 change: 0 additions & 1 deletion bin/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export function isHelpfulFile(string) {
!uri.endsWith(`${SEP}grouplist.html`) &&
!uri.endsWith(`${SEP}jobstepapi${SEP}html${SEP}index.html`) &&
!uri.endsWith(`${SEP}jobsteplist.html`) &&
!uri.endsWith(`${SEP}overview.html`) &&
!uri.endsWith(`${SEP}packagelist.html`) &&
!uri.endsWith(`${SEP}pipeletapi${SEP}html${SEP}index.html`) &&
!uri.endsWith(`${SEP}pipeletlist.html`) &&
Expand Down
9 changes: 9 additions & 0 deletions next-sitemap.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'dotenv/config'

/** @type {import('next-sitemap').IConfig} */
export default {
siteUrl: process.env.SITE_URL || 'https://sfccdocs.com',
generateRobotsTxt: true,
sitemapSize: 1000,
changefreq: 'weekly',
}
13 changes: 10 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import withMarkdoc from '@markdoc/next.js'

import nextPWA from 'next-pwa'
import runtimeCaching from 'next-pwa/cache.js'
import withSearch from './src/markdoc/search.mjs'

const withPWA = nextPWA({
dest: 'public',
runtimeCaching,
disable: process.env.NODE_ENV === 'development',
})

/** @type {import('next').NextConfig} */
const nextConfig = {
trailingSlash: false,
Expand All @@ -10,9 +17,9 @@ const nextConfig = {
output: 'export',
distDir: 'dist',
images: {
unoptimized: true
unoptimized: true,
},
pageExtensions: ['js', 'jsx', 'md'],
}

export default withSearch(withMarkdoc({ schemaPath: './src/markdoc' })(nextConfig))
export default withSearch(withMarkdoc({ schemaPath: './src/markdoc' })(withPWA(nextConfig)))
Loading

0 comments on commit e047e54

Please sign in to comment.