Skip to content

Commit

Permalink
Merge pull request #86 from tuatmcc/develop
Browse files Browse the repository at this point in the history
deploy
  • Loading branch information
OJII3 authored Nov 17, 2023
2 parents fec7558 + 1b0918a commit 8f747c7
Show file tree
Hide file tree
Showing 9 changed files with 837 additions and 203 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/bin/
/scripts/
/examples/
/.mdorganizer/
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: action/checkout@v4
- uses: action/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- run: npm ci
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/dist/

/examples/
/.mdorganizer/
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,20 @@ export default {
type: 'string[]',
after: (tags: string[]) => tags.map((tag) => tag.toLowerCase()),
},
author: {
type: 'string',
},
img: {
type: 'string',
},
},
},
],
} satisfies UserConfig;
```

Available field types are `string`, `string[]`, `boolean`, `number`.

2. Add `npm scripts`

`package.json`(for example with Next.js)
Expand All @@ -66,7 +74,7 @@ npm run build

`prebuild` script will be automatically run before `build`.

Or, you can run command using `npx`.
Or, you can run manually using `npx`.

```sh
npx mdorganizer
Expand All @@ -79,7 +87,7 @@ Example of original markdown file
```md
---
title: Hello World
date: 2021-09-01
date: '2021-09-01'
description: This is a sample post.
img: /img/hello-world.png
tags: [sample, hello, world]
Expand All @@ -92,22 +100,18 @@ author: tuatmcc
Example usage of generated module

```ts
import type { PostTypeBlog } from '.mdorganizer';
import { allBlog } from '.mdorganizer'; // allBlog is an array of PostTypeBlog
import type { BlogDocument } from '.mdorganizer/generated'; // import generated type
import { allBlogDocuments } from '.mdorganizer/generated'; // import generated modules

const { documentCategory, rootPath, fields, content } = allBlogDocuments[0];

const {
title, // string
date, // string
description, // string | undefined
img, // string | undefined
tags, // string[] | undefined
author, // string | undefined
rootPath, // string
globPattern, // string
postType, // string
markdown, // string
html, // string
} = allBlog[0];
} = feilds;
```

---
Expand Down
File renamed without changes.
Loading

0 comments on commit 8f747c7

Please sign in to comment.