Skip to content

Commit e54c845

Browse files
authored
docs: add compliance & legal link to doc site (#3147)
Signed-off-by: Akshat Patel <[email protected]>
1 parent a213947 commit e54c845

File tree

3 files changed

+88
-2
lines changed

3 files changed

+88
-2
lines changed

integration/ng16/angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
{
4848
"type": "initial",
4949
"maximumWarning": "500kb",
50-
"maximumError": "1mb"
50+
"maximumError": "1.5mb"
5151
},
5252
{
5353
"type": "anyComponentStyle",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"build": "bash scripts/build.sh",
88
"storybook": "ng run carbon-components-angular:storybook",
9-
"docs:build": "compodoc -p tsconfig.doc.json -t",
9+
"docs:build": "compodoc -p tsconfig.doc.json -t && node ./scripts/compliance.js",
1010
"docs:json": "compodoc --config compodoc.storybook.json",
1111
"lint": "tslint 'src/**/*.ts'",
1212
"lint:fix": "tslint --fix 'src/**/*.ts'",

scripts/compliance.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const entryDirectory = './documentation';
5+
6+
const componentToAppend = `
7+
8+
<footer class="carbon">
9+
<dds-footer-container key="footer" disable-locale-button="true" size="micro" />
10+
</footer>
11+
12+
<script
13+
key="8"
14+
type="module"
15+
src="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/footer.min.js">
16+
</script>
17+
18+
<!-- Storybook override -->
19+
<script>
20+
document.title = "Carbon Components Angular";
21+
</script>
22+
23+
<script
24+
src="//1.www.s81c.com/common/stats/ibm-common.js"
25+
type="text/javascript"
26+
async="async">
27+
</script>
28+
</body>`;
29+
const styleToAppend = `
30+
<style>
31+
footer.carbon {
32+
position: absolute;
33+
bottom: 0;
34+
width: 100%;
35+
z-index: 9999;
36+
}
37+
#root > div {
38+
/*
39+
* Subtracting the height of the footer to prevent
40+
* overlaying the footer ontop of content
41+
*/
42+
height: calc(100vh - 48px);
43+
}
44+
</style>
45+
</head>`;
46+
47+
48+
function rewriteHtmlFile(filePath) {
49+
fs.readFile(filePath, 'utf8', (err, data) => {
50+
if (err) {
51+
console.error('Error reading file', filePath, err);
52+
return;
53+
}
54+
55+
let newContent = data.replace('</body>', componentToAppend);
56+
newContent = newContent.replace('</head>', styleToAppend);
57+
58+
fs.writeFile(filePath, newContent, 'utf8', (err) => {
59+
if(err) {
60+
console.error('Error writing file', filePath, err);
61+
} else {
62+
console.log('Success writing file', filePath);
63+
}
64+
})
65+
})
66+
}
67+
68+
function walkDirectory(dir) {
69+
fs.readdir(dir, { withFileTypes: true }, (err, items) => {
70+
if (err) {
71+
console.error('Error reading directory', dir, err);
72+
return;
73+
}
74+
75+
items.forEach((item) => {
76+
const fullPath = path.join(dir, item.name);
77+
if (item.isDirectory()) {
78+
walkDirectory(fullPath);
79+
} else if (item.isFile() && path.extname(item.name) === '.html') {
80+
rewriteHtmlFile(fullPath);
81+
}
82+
})
83+
})
84+
}
85+
86+
walkDirectory(entryDirectory);

0 commit comments

Comments
 (0)