Skip to content

Commit

Permalink
Recognize .mdx files as documetnation files (#4)
Browse files Browse the repository at this point in the history
* Recognize .mdx files as doc files

* Build

* 0.4.1
  • Loading branch information
treycucco authored Sep 6, 2023
1 parent ad874d7 commit 200c707
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/cjs/actions/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function writeAction({ srcPath, docsPath, generatedPath, codeUrl, options, }) {
}
exports.default = writeAction;
/**
* Writes best practices out to md doc files.
* Writes best practices out to Markdown doc files.
*/
const writeBestPractices = (contentDir, bestPractices, codeUrl, options) => __awaiter(void 0, void 0, void 0, function* () {
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/cjs/types/actions/write.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type WriteArgs = {
*/
export default function writeAction({ srcPath, docsPath, generatedPath, codeUrl, options, }: WriteArgs): Promise<BestPractice[]>;
/**
* Writes best practices out to md doc files.
* Writes best practices out to Markdown doc files.
*/
export declare const writeBestPractices: (contentDir: string, bestPractices: BestPractice[], codeUrl: string, options: WriteOptions) => Promise<void>;
export declare const SPECIAL_META_KEYS: Set<string>;
Expand Down
2 changes: 1 addition & 1 deletion lib/cjs/types/utils/fs.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/cjs/types/utils/replace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BestPractice from '../BestPractice';
*/
export declare const replaceAllBestPracticesInDocs: (docsRoot: string, bestPractices: BestPractice[], getBestPracticeLines: (bestPracitce: BestPractice) => string[]) => Promise<Set<string>>;
/**
* Scan through a static documentation file and replace best practices ines
* Scan through a static documentation file and replace best practices lines
*/
export declare const insertBestPracticesIntoDoc: (filename: string, index: Map<string, BestPractice>, getBestPracticeLines: (bestPracitce: BestPractice) => string[]) => Promise<Set<string>>;
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/cjs/utils/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ const writeFileLines = (filename, lines) => __awaiter(void 0, void 0, void 0, fu
exports.writeFileLines = writeFileLines;
const isCodeFile = (filename) => /\.(js|jsx|ts|tsx)$/i.test(filename);
exports.isCodeFile = isCodeFile;
const isDocFile = (filename) => /\.md$/i.test(filename);
const isDocFile = (filename) => /\.mdx?$/i.test(filename);
exports.isDocFile = isDocFile;
2 changes: 1 addition & 1 deletion lib/cjs/utils/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const replaceAllBestPracticesInDocs = (docsRoot, bestPractices, getBestPracticeL
});
exports.replaceAllBestPracticesInDocs = replaceAllBestPracticesInDocs;
/**
* Scan through a static documentation file and replace best practices ines
* Scan through a static documentation file and replace best practices lines
*/
const insertBestPracticesIntoDoc = (filename, index, getBestPracticeLines) => __awaiter(void 0, void 0, void 0, function* () {
const oldLines = yield (0, fs_1.readFileLines)(filename);
Expand Down
2 changes: 1 addition & 1 deletion lib/esm/actions/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function writeAction({ srcPath, docsPath, generatedPath, codeUrl, options,
}
exports.default = writeAction;
/**
* Writes best practices out to md doc files.
* Writes best practices out to Markdown doc files.
*/
const writeBestPractices = async (contentDir, bestPractices, codeUrl, options) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/esm/types/actions/write.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type WriteArgs = {
*/
export default function writeAction({ srcPath, docsPath, generatedPath, codeUrl, options, }: WriteArgs): Promise<BestPractice[]>;
/**
* Writes best practices out to md doc files.
* Writes best practices out to Markdown doc files.
*/
export declare const writeBestPractices: (contentDir: string, bestPractices: BestPractice[], codeUrl: string, options: WriteOptions) => Promise<void>;
export declare const SPECIAL_META_KEYS: Set<string>;
Expand Down
2 changes: 1 addition & 1 deletion lib/esm/types/utils/fs.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/esm/types/utils/replace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BestPractice from '../BestPractice';
*/
export declare const replaceAllBestPracticesInDocs: (docsRoot: string, bestPractices: BestPractice[], getBestPracticeLines: (bestPracitce: BestPractice) => string[]) => Promise<Set<string>>;
/**
* Scan through a static documentation file and replace best practices ines
* Scan through a static documentation file and replace best practices lines
*/
export declare const insertBestPracticesIntoDoc: (filename: string, index: Map<string, BestPractice>, getBestPracticeLines: (bestPracitce: BestPractice) => string[]) => Promise<Set<string>>;
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/esm/utils/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ const writeFileLines = async (filename, lines) => {
exports.writeFileLines = writeFileLines;
const isCodeFile = (filename) => /\.(js|jsx|ts|tsx)$/i.test(filename);
exports.isCodeFile = isCodeFile;
const isDocFile = (filename) => /\.md$/i.test(filename);
const isDocFile = (filename) => /\.mdx?$/i.test(filename);
exports.isDocFile = isDocFile;
2 changes: 1 addition & 1 deletion lib/esm/utils/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const replaceAllBestPracticesInDocs = async (docsRoot, bestPractices, getBestPra
};
exports.replaceAllBestPracticesInDocs = replaceAllBestPracticesInDocs;
/**
* Scan through a static documentation file and replace best practices ines
* Scan through a static documentation file and replace best practices lines
*/
const insertBestPracticesIntoDoc = async (filename, index, getBestPracticeLines) => {
const oldLines = await (0, fs_1.readFileLines)(filename);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@closeio/best-practices-documentation",
"version": "0.4.0",
"version": "0.4.1",
"description": "Tooling to document best practices in your code base.",
"author": "Trey Cucco",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ export const writeFileLines = async (filename: string, lines: string[]) => {
export const isCodeFile = (filename: string) =>
/\.(js|jsx|ts|tsx)$/i.test(filename);

export const isDocFile = (filename: string) => /\.md$/i.test(filename);
export const isDocFile = (filename: string) => /\.mdx?$/i.test(filename);

0 comments on commit 200c707

Please sign in to comment.