Skip to content

Commit

Permalink
fix(docs): warning normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Leandro Cruz Ferrer committed Aug 25, 2022
1 parent 29200e3 commit 036a100
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
5 changes: 5 additions & 0 deletions packages/documentation/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"parserOptions": {
"sourceType": "module"
}
}
19 changes: 10 additions & 9 deletions packages/documentation/scripts/generate-api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import path, { join } from 'path';

const __dirname = path.resolve();

function autoGenerationWarning(previewPath) {
// unix/win normalization
previewPath = previewPath.replace(/\\/g, '/')

return `<!-- Auto generated! Please edit here: ${previewPath.substring(previewPath.indexOf('siemens-ix/packages/'))} -->`;
}

function formatMultiline(str) {
return str.split('\n\n').join('<br /><br />').split('\n').join(' ');
}
Expand Down Expand Up @@ -95,9 +102,7 @@ function writeWebComponentPreviews() {
.trimEnd();
}

const markdown = `<!-- Auto generated! Please edit here: ${previewPath.substring(
previewPath.indexOf('siemens-ix/packages/')
)} -->
const markdown = `${autoGenerationWarning(previewPath)}
\`\`\`html
${code}
\`\`\`
Expand Down Expand Up @@ -154,9 +159,7 @@ function writeReactPreviews() {

const code = fs.readFileSync(previewPath).toString();

const markdown = `<!-- Auto generated! Please edit here: ${previewPath.substring(
previewPath.indexOf('siemens-ix/packages/')
)} -->
const markdown = `${autoGenerationWarning(previewPath)}
\`\`\`tsx
${code.trimEnd()}
\`\`\`
Expand Down Expand Up @@ -215,9 +218,7 @@ function writeAngularPreviews() {

const code = fs.readFileSync(previewPath).toString();

const markdown = `<!-- Auto generated! Please edit here: ${previewPath.substring(
previewPath.indexOf('siemens-ix/packages/')
)} -->
const markdown = `${autoGenerationWarning(previewPath)}
\`\`\`typescript
${code.trimEnd()}
\`\`\`
Expand Down
10 changes: 7 additions & 3 deletions packages/documentation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"extends": "@tsconfig/docusaurus/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"jsx": "react",
"lib": ["DOM"],
"lib": [
"DOM"
],
"noEmit": true,
"noImplicitAny": false,
"types": [
Expand All @@ -14,7 +16,9 @@
],
"baseUrl": ".",
"paths": {
"@site/*": ["./*"]
"@site/*": [
"./*"
]
},
"resolveJsonModule": true,
"preserveSymlinks": true
Expand Down

0 comments on commit 036a100

Please sign in to comment.