Skip to content

Commit a92e2b0

Browse files
committed
Merge branch 'main' into feat/add-certification-process2
Signed-off-by: Kurt Garloff <[email protected]>
2 parents 034de5c + 6ed445a commit a92e2b0

File tree

11 files changed

+174
-116
lines changed

11 files changed

+174
-116
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/standards/*/*.md
2020
/standards/*/*.mdx
2121
/standards/scs-*.yaml
22+
/user-docs/application-examples
2223

2324
# Dependencies
2425
node_modules

docs.package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,11 @@
135135
"source": ["documentation/overview.md"],
136136
"target": "docs/turnkey-solution",
137137
"label": ""
138+
},
139+
{
140+
"repo": "SovereignCloudStack/opendesk-on-scs",
141+
"source": "docs/*",
142+
"target": "user-docs/application-examples",
143+
"label": "opendesk-on-scs"
138144
}
139145
]

docusaurus.config.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ const config = {
8181
// ... other options
8282
}
8383
],
84+
[
85+
'@docusaurus/plugin-content-docs',
86+
{
87+
id: 'user-docs',
88+
path: 'user-docs',
89+
routeBasePath: 'user-docs',
90+
sidebarPath: require.resolve('./sidebarsUserDocs.js')
91+
// ... other options
92+
}
93+
],
8494
[
8595
'@docusaurus/plugin-content-docs',
8696
{
@@ -120,6 +130,11 @@ const config = {
120130
label: 'For Contributors',
121131
position: 'left'
122132
},
133+
{
134+
to: '/user-docs',
135+
label: 'For Users',
136+
position: 'left'
137+
},
123138
{ to: '/community', label: 'Community', position: 'left' },
124139
{ to: '/docs/faq', label: 'FAQ', position: 'left' },
125140
{
@@ -194,12 +209,19 @@ const config = {
194209
// @ts-ignore
195210
({
196211
hashed: true,
197-
docsDir: ['docs', 'community', 'standards', 'contributor-docs'],
212+
docsDir: [
213+
'docs',
214+
'community',
215+
'standards',
216+
'contributor-docs',
217+
'user-docs'
218+
],
198219
docsRouteBasePath: [
199220
'docs',
200221
'community',
201222
'standards',
202-
'contributor-docs'
223+
'contributor-docs',
224+
'user-docs'
203225
]
204226
})
205227
]

package-lock.json

Lines changed: 50 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"write-translations": "docusaurus write-translations",
3030
"write-heading-ids": "docusaurus write-heading-ids",
3131
"typecheck": "tsc",
32-
"postinstall": "node getDocs.js && node populateStds.js && node populateCerts.js",
32+
"postinstall": "node getDocs.js && node populateStds.js && node populateCerts.js && node populateClouds.js",
3333
"test": "echo \"Error: no test specified\" && exit 1",
3434
"lint:md": "markdownlint-cli2 \"**/*.md\"",
3535
"fix:md": "markdownlint-cli2-fix \"**/*.md\"",
@@ -54,6 +54,7 @@
5454
"lint-staged": "^13.1.2",
5555
"markdownlint-cli2": "^0.7.1",
5656
"markdownlint-rule-search-replace": "^1.0.9",
57+
"node-fetch": "^2.7.0",
5758
"prettier": "^2.8.4",
5859
"prism-react-renderer": "^2.3.1",
5960
"react": "^18.2.0",

populateCerts.js

Lines changed: 28 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,46 @@
1+
const fetch = require('node-fetch')
12
const fs = require('fs')
23
const YAML = require('yaml')
34

5+
async function fetchScopeTable(uuid, title, path) {
6+
const response = await fetch(
7+
`https://compliance.sovereignit.cloud/markdown/scope/${uuid}`
8+
)
9+
var text = await response.text()
10+
text = `# ${title}\n\n${text}`
11+
fs.writeFileSync(path, text, 'utf8')
12+
}
13+
414
// how many outdated versions of any scope to include
515
const MAX_OLD = 1
616

717
const filenames = fs
8-
.readdirSync('standards/')
9-
.filter((fn) => fn.startsWith('scs-') && fn.endsWith('.yaml'))
18+
.readdirSync('standards/')
19+
.filter((fn) => fn.startsWith('scs-') && fn.endsWith('.yaml'))
1020

1121
const scopes = filenames.map((filename) => {
12-
return {
13-
...YAML.parseDocument(fs.readFileSync(`standards/${filename}`, 'utf8')).toJSON(),
14-
filename,
15-
id: filename.substring(0, filename.length - 5),
16-
}
22+
return {
23+
...YAML.parseDocument(
24+
fs.readFileSync(`standards/${filename}`, 'utf8')
25+
).toJSON(),
26+
filename,
27+
id: filename.substring(0, filename.length - 5)
28+
}
1729
})
1830

1931
const today = new Date().toISOString().slice(0, 10)
2032

2133
const sidebarItems = scopes.map((scope) => {
22-
const matrix = {}
23-
const versionsShown = {}
24-
var numOld = 0
25-
var modules = {}
26-
scope.modules.forEach((module) => {
27-
modules[module.id] = module
28-
module.prettyName = module.id.startsWith('scs-') ? `${module.id}: ${module.name}` : module.name
29-
})
30-
scope.timeline.sort((a, b) => b.date.localeCompare(a.date))
31-
const current = scope.timeline.filter((entry) => entry.date <= today)
32-
const lookup = current.length ? current[0].versions : {}
33-
// sort in descending order, so we get the MAX_OLD most recent obsolete versions
34-
scope.versions.sort((a, b) => b.version.localeCompare(a.version));
35-
scope.versions.forEach((version) => {
36-
version.state = lookup[version.version] || 'deprecated'
37-
version.isStable = version.stabilized_at !== undefined && version.stabilized_at <= today
38-
version.isEffective = version.state == 'effective'
39-
if (['warn', 'effective', 'draft'].indexOf(version.state) == -1) {
40-
numOld += 1
41-
if (numOld > MAX_OLD) return
42-
}
43-
if (version.include === undefined) return
44-
versionsShown[version.version] = version
45-
version.include.forEach((include) => {
46-
if (include.ref === undefined) {
47-
include = {ref: include, parameters: {}}
48-
}
49-
const module = modules[include.ref]
50-
if (matrix[module.id] === undefined) {
51-
matrix[module.id] = {
52-
name: module.prettyName,
53-
columns: {},
54-
url: module.url,
55-
}
56-
}
57-
matrix[module.id].columns[version.version] = {
58-
parameters: include.parameters,
59-
}
60-
})
61-
})
62-
63-
const rows = Object.values(matrix)
64-
const columns = Object.keys(versionsShown)
65-
rows.sort((a, b) => a.name.localeCompare(b.name));
66-
columns.sort((a, b) => a.localeCompare(b));
67-
68-
lines = [`# ${scope.name}
69-
70-
Note that the state _Stable_ is shown here if _stabilized at_ is in the future, whereas _Effective_ is shown here if _stabilized at_ is in the past and _deprecated at_ is unset or in the future.
71-
`]
72-
lines.push('| Scope versions -> | ' + columns.join(' | ') + ' |')
73-
lines.push('| :-- | ' + columns.map(() => ':--').join(' | ') + ' |')
74-
lines.push('| State | ' + columns.map((c) => versionsShown[c].state).join(' | ') + ' |')
75-
lines.push('| Stabilized at | ' + columns.map((c) => versionsShown[c].stabilized_at || '').join(' | ') + ' |')
76-
// lines.push('| Deprecated at | ' + columns.map((c) => versionsShown[c].deprecated_at || '').join(' | ') + ' |')
77-
// md doesn't allow intermediate header rows
78-
// lines.push('| :-- | ' + columns.map(() => ':--').join(' | ') + ' |')
79-
lines.push('| **Modules** | ' + columns.map((c) => ' '.repeat(c.length)).join(' | ') + ' |')
80-
// md doesn't allow intermediate header rows
81-
// lines.push('| :-- | ' + columns.map(() => ':--').join(' | ') + ' |')
82-
rows.forEach((row) => {
83-
lines.push(`| [${row.name}](${row.url}) | ` + columns.map((c) => row.columns[c]).map((col) => {
84-
if (col === undefined) {
85-
// this version of the cert does not include this standard
86-
return ''
87-
}
88-
let params = Object.entries(col.parameters || {}).map((entry) =>
89-
entry[1].startsWith('https://') ? `[${entry[0]}](${entry[1]})` : `${entry[0]}=${entry[1]}`
90-
).join(', ')
91-
if (params.length) {
92-
params = ` (${params})`
93-
}
94-
return `X${params}`
95-
}).join(' | ') + ' |')
96-
})
97-
lines.push('') // file should end with a single newline character
98-
fs.writeFileSync(`standards/${scope.id}.md`, lines.join('\n'), 'utf8')
99-
100-
const state = columns.filter((c) => versionsShown[c].isEffective).length ? '📜' : '✏️'
101-
return {
102-
type: 'doc',
103-
label: scope.name,
104-
id: scope.id,
34+
fetchScopeTable(scope.uuid, scope.name, `standards/${scope.id}.md`).catch(
35+
(e) => {
36+
console.log(e)
10537
}
38+
)
39+
return {
40+
type: 'doc',
41+
label: scope.name,
42+
id: scope.id
43+
}
10644
})
10745

10846
var newSidebars = `module.exports = ${JSON.stringify(sidebarItems, null, ' ')}`

populateClouds.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const fetch = require('node-fetch')
2+
const fs = require('fs')
3+
4+
async function insertCloudTable(pathIn, pathOut) {
5+
const template = fs.readFileSync(pathIn, 'utf8')
6+
const response = await fetch(
7+
`https://compliance.sovereignit.cloud/markdown/table`
8+
)
9+
const text = template.replace('<!--CLOUDS-->', await response.text())
10+
fs.writeFileSync(pathOut, text, 'utf8')
11+
}
12+
13+
insertCloudTable(
14+
`standards/certification/overview.template.md`,
15+
`standards/certification/overview.md`
16+
).catch((e) => {
17+
console.log(e)
18+
})

sidebarsUserDocs.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// @ts-check
2+
3+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
4+
const sidebars = {
5+
userDocs: [
6+
'index',
7+
{
8+
type: 'category',
9+
label: 'Application Examples',
10+
items: [
11+
{
12+
type: 'category',
13+
label: 'OpenDesk on SCS',
14+
link: {
15+
type: 'generated-index'
16+
},
17+
items: [
18+
'application-examples/opendesk-on-scs/overview',
19+
'application-examples/opendesk-on-scs/quickstart',
20+
'application-examples/opendesk-on-scs/requirements',
21+
'application-examples/opendesk-on-scs/getting_started',
22+
'application-examples/opendesk-on-scs/configuration',
23+
'application-examples/opendesk-on-scs/user-import',
24+
'application-examples/opendesk-on-scs/contribute'
25+
]
26+
}
27+
]
28+
}
29+
]
30+
}
31+
32+
module.exports = sidebars

0 commit comments

Comments
 (0)