Skip to content

Commit

Permalink
chore: clear docs/native directory when generating markdown (#2812)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-perkins authored Mar 8, 2023
1 parent cb7a235 commit 5045ed4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
29 changes: 17 additions & 12 deletions scripts/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ async function buildPluginApiDocs(pluginId) {

const apiContent = createApiPage(pluginId, readme, pkgJson);
const fileName = `${pluginId}.md`;

// Delete all existing generated markdown files in docs/native
fs.readdirSync('docs/native').forEach((file) => {
if (file.endsWith('.md')) {
fs.rmSync(`docs/native/${file}`);
}
});

fs.writeFileSync(`docs/native/${fileName}`, apiContent);
fs.writeFileSync(`versioned_docs/version-v6/native/${fileName}`, apiContent);
}
Expand Down Expand Up @@ -85,18 +93,15 @@ function toTitleCase(str) {
}

if (!String.prototype.replaceAll) {
String.prototype.replaceAll = function(str, newStr){

// If a regex pattern
if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
return this.replace(str, newStr);
}

// If a string
return this.replace(new RegExp(str, 'g'), newStr);

};
String.prototype.replaceAll = function (str, newStr) {
// If a regex pattern
if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
return this.replace(str, newStr);
}

// If a string
return this.replace(new RegExp(str, 'g'), newStr);
};
}

main();

1 change: 0 additions & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function renderOptions(title, data) {
### ${title}
${data
.map((item) => {
console.log(item);
const alias = item.aliases.length > 0 ? '(or ' + item.aliases.map((alias) => `\`-${alias}\``).join(' ') + ')' : '';
let name = item.type === 'boolean' && item.default === true ? `no-${item.name}` : item.name;
if (item.type === 'string') name += `=<${item.spec.value}>`;
Expand Down

1 comment on commit 5045ed4

@vercel
Copy link

@vercel vercel bot commented on 5045ed4 Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ionic-docs – ./

ionic-docs-gqykycf8t.vercel.app
ionic-docs-git-main-ionic1.vercel.app
ionic-docs-ionic1.vercel.app

Please sign in to comment.