Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize .mdx files as documetnation files #4

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);