Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedsalem401 committed Jan 3, 2024
1 parent 7a73c17 commit 9320c4b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion examples/document-types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const schemas = {
await client.indexFolder({
folderPath: contentPath,
ignorePatterns: ignorePatterns,
schemas: schemas
schemas: schemas,
});

process.exit(0);
4 changes: 2 additions & 2 deletions examples/nextjs-blog/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
};

module.exports = nextConfig
module.exports = nextConfig;
2 changes: 1 addition & 1 deletion examples/nextjs-blog/src/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />
return <Component {...pageProps} />;
}
4 changes: 2 additions & 2 deletions examples/nextjs-blog/src/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Html, Head, Main, NextScript } from 'next/document'
import { Html, Head, Main, NextScript } from "next/document";

export default function Document() {
return (
Expand All @@ -9,5 +9,5 @@ export default function Document() {
<NextScript />
</body>
</Html>
)
);
}
8 changes: 4 additions & 4 deletions examples/nextjs-blog/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from "fs"
import fs from "fs";

export default function Home({ posts }) {
return (
Expand All @@ -16,12 +16,12 @@ export default function Home({ posts }) {
</div>
</main>
</>
)
);
}

export async function getStaticProps() {
const filePath = 'src/.markdowndb/files.json';
const fileContent = fs.readFileSync(filePath, 'utf-8');
const filePath = "src/.markdowndb/files.json";
const fileContent = fs.readFileSync(filePath, "utf-8");
const posts = JSON.parse(fileContent);

return {
Expand Down
14 changes: 7 additions & 7 deletions markdowndb.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export default {
computedFields: [], // Array of functions to computed fields
schemas: {
// Add zod schemas
},
include: [], // Pattern for files to be included
exclude: [] // Patten for files to be excluded
};
computedFields: [], // Array of functions to computed fields
schemas: {
// Add zod schemas
},
include: [], // Pattern for files to be included
exclude: [], // Patten for files to be excluded
};
6 changes: 3 additions & 3 deletions src/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let watchFlag;
const args = process.argv.slice(2);

// Check for the watch flag and its position
const watchIndex = args.indexOf('--watch');
const watchIndex = args.indexOf("--watch");
if (watchIndex !== -1) {
watchFlag = args[watchIndex];
args.splice(watchIndex, 1); // Remove the watch flag from the array
Expand All @@ -19,7 +19,7 @@ if (watchIndex !== -1) {
const [contentPath, configFilePath] = args;

if (!contentPath) {
console.error('Invalid/Missing path to markdown content folder');
console.error("Invalid/Missing path to markdown content folder");
process.exit(1);
}

Expand All @@ -36,7 +36,7 @@ await client.indexFolder({
folderPath: contentPath,
ignorePatterns: ignorePatterns,
watch: watchFlag,
configFilePath: configFilePath
configFilePath: configFilePath,
});

if (!watchFlag) {
Expand Down
12 changes: 9 additions & 3 deletions src/tests/markdowndb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ describe("MarkdownDB - default config", () => {
});
const dbFilesPaths = dbFiles.map((f) => f.file_path);

const expectedPaths = [`${pathToContentFixture}/blog/blog1.mdx`].map(normalizePathSeparator);
const expectedPaths = [`${pathToContentFixture}/blog/blog1.mdx`].map(
normalizePathSeparator
);

expect(dbFilesPaths).toHaveLength(expectedPaths.length);
dbFilesPaths.forEach((p) => {
Expand All @@ -148,7 +150,9 @@ describe("MarkdownDB - default config", () => {
});
const dbFilesPaths = dbFiles.map((f) => f.file_path);

const expectedPaths = [`${pathToContentFixture}/blog/blog2.mdx`].map(normalizePathSeparator);
const expectedPaths = [`${pathToContentFixture}/blog/blog2.mdx`].map(
normalizePathSeparator
);

expect(dbFilesPaths).toHaveLength(expectedPaths.length);
dbFilesPaths.forEach((p) => {
Expand All @@ -163,7 +167,9 @@ describe("MarkdownDB - default config", () => {
extensions: ["md", "mdx"],
});
const dbFilesPaths = dbFiles.map((f) => f.file_path);
const expectedPaths = [`${pathToContentFixture}/news/news1.mdx`].map(normalizePathSeparator);
const expectedPaths = [`${pathToContentFixture}/news/news1.mdx`].map(
normalizePathSeparator
);

expect(dbFilesPaths).toHaveLength(expectedPaths.length);
dbFilesPaths.forEach((p) => {
Expand Down

0 comments on commit 9320c4b

Please sign in to comment.