Skip to content

Commit

Permalink
perf(demo): update demo file names
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 committed Feb 15, 2024
1 parent 749e4f7 commit 57f2c7b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions demo/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
See LICENSE in the project root for license information.
HTML in this document is standardized and NOT to be edited.
All demo code should be added/edited in ./demo/apiExamples.md
All demo code should be added/edited in ./demo/api.md
With the exception of adding custom elements if needed for the demo.
----------------------- DO NOT EDIT -----------------------------
-->
Expand All @@ -28,7 +28,7 @@
<script type="module">
import 'https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js';
import 'https://cdn.jsdelivr.net/npm/prismjs@latest/prism.js';
fetch('/demo/apiExamples.md')
fetch('/demo/api.md')
.then((response) => response.text())
.then((text) => {
const rawHtml = marked.parse(text);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See LICENSE in the project root for license information.
HTML in this document is standardized and NOT to be edited.
All demo code should be added/edited in ./demo/demo.md
All demo code should be added/edited in ./demo/index.md
With the exception of adding custom elements if needed for the demo.
Expand Down Expand Up @@ -32,7 +32,7 @@
<script type="module">
import 'https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js';
import 'https://cdn.jsdelivr.net/npm/prismjs@latest/prism.js';
fetch('/demo/demo.md')
fetch('/demo/index.md')
.then((response) => response.text())
.then((text) => {
const rawHtml = marked.parse(text);
Expand Down
4 changes: 2 additions & 2 deletions demo/demo.md → demo/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
The demo.md file is a compiled document. No edits should be made directly to this file.
The index.md file is a compiled document. No edits should be made directly to this file.
README.md is created by running `npm run build:docs`.
This file is generated based on a template fetched from `./docs/partials/demo.md`
This file is generated based on a template fetched from `./docs/partials/index.md`
-->

# Toast
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/partials/demo.md → docs/partials/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
The demo.md file is a compiled document. No edits should be made directly to this file.
The index.md file is a compiled document. No edits should be made directly to this file.
README.md is created by running `npm run build:docs`.
This file is generated based on a template fetched from `./docs/partials/demo.md`
This file is generated based on a template fetched from `./docs/partials/index.md`
-->

# Toast
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
"./CHANGELOG.md",
"./README.md",
"./docs/api.md",
"./demo/demo.md",
"./demo/apiExamples.md"
"./demo/index.md",
"./demo/api.md"
]
}
],
Expand Down
28 changes: 14 additions & 14 deletions scripts/generateDocs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ function formatApiTableContents(content, destination) {

fs.writeFileSync(destination, result, { encoding: 'utf8'});

fs.readFile('./demo/apiExamples.md', 'utf8', function(err, data) {
formatTemplateFileContents(data, './demo/apiExamples.md');
fs.readFile('./demo/api.md', 'utf8', function(err, data) {
formatTemplateFileContents(data, './demo/api.md');
});
}

Expand Down Expand Up @@ -123,17 +123,17 @@ function processReadme() {
}

/**
* Compiles `./docTemplates/demo.md` -> `./demo/demo.md`
* Compiles `./docTemplates/index.md` -> `./demo/index.md`
*/

function processDemo() {
const callback = function(updatedContent, outputConfig) {
if (fs.existsSync('./demo/demo.md')) {
fs.readFile('./demo/demo.md', 'utf8', function(err, data) {
formatTemplateFileContents(data, './demo/demo.md');
if (fs.existsSync('./demo/index.md')) {
fs.readFile('./demo/index.md', 'utf8', function(err, data) {
formatTemplateFileContents(data, './demo/index.md');
});
} else {
console.log('ERROR: ./demo/demo.md file is missing');
console.log('ERROR: ./demo/index.md file is missing');
}
};

Expand All @@ -142,23 +142,23 @@ function processDemo() {
outputDir: './demo'
};

const markdownPath = path.join(__dirname, '../docs/partials/demo.md');
const markdownPath = path.join(__dirname, '../docs/partials/index.md');

markdownMagic(markdownPath, configDemo, callback);
}

/**
* Compiles `./docTemplates/apiExamples.md` -> `./demo/apiExamples.md`
* Compiles `./docTemplates/api.md` -> `./demo/api.md`
*/

function processApiExamples() {
const callback = function(updatedContent, outputConfig) {
if (fs.existsSync('./demo/apiExamples.md')) {
fs.readFile('./demo/apiExamples.md', 'utf8', function(err, data) {
formatApiTableContents(data, './demo/apiExamples.md');
if (fs.existsSync('./demo/api.md')) {
fs.readFile('./demo/api.md', 'utf8', function(err, data) {
formatApiTableContents(data, './demo/api.md');
});
} else {
console.log('ERROR: ./demo/apiExamples.md file is missing');
console.log('ERROR: ./demo/api.md file is missing');
}
};

Expand All @@ -167,7 +167,7 @@ function processApiExamples() {
outputDir: './demo'
};

const markdownPath = path.join(__dirname, '../docs/partials/apiExamples.md');
const markdownPath = path.join(__dirname, '../docs/partials/api.md');

markdownMagic(markdownPath, config, callback);
}
Expand Down

0 comments on commit 57f2c7b

Please sign in to comment.