Skip to content

Commit

Permalink
Merge pull request #81 from tuatmcc/feature/update_ver
Browse files Browse the repository at this point in the history
[fix]: module
  • Loading branch information
OJII3 authored Nov 17, 2023
2 parents fc31947 + ebf8401 commit eb866eb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
13 changes: 2 additions & 11 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mdorganizer",
"version": "2.2.3",
"version": "2.3.0",
"description": "A cli tool to convert Markdown into TypeScript Module",
"author": "tuatmcc",
"license": "MIT",
Expand Down Expand Up @@ -28,7 +28,6 @@
"node": ">=18.0.0"
},
"dependencies": {
"commander": "^11.1.0",
"esbuild": "^0.17.19",
"glob": "^10.2.6",
"gray-matter": "^4.0.3",
Expand Down
17 changes: 6 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { program } from 'commander';
import { UserConfig } from '@/types';
import { MdOrganizer } from './mdorganizer';
import { getConfig } from './config';
Expand All @@ -13,14 +12,10 @@ export const generate = async (userConfig: UserConfig): Promise<void> => {
};

export const main = async () => {
program
.action(async () => {
try {
const config = await getConfig();
await generate(config);
} catch (err) {
console.error(err);
}
})
.parse(process.argv);
try {
const config = await getConfig();
await generate(config);
} catch (err) {
console.error(err);
}
};
2 changes: 1 addition & 1 deletion src/modulegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default {
documentCategory: '${documentConfig.documentCategory}',
globPattern: '${documentConfig.globPattern}',
rootPath: '${rootPath}',
content: '${content.replace(/\n/g, '\\n').replace(/'/g, "\\'")}',
content: '${content.replace(/\r\n|\n/g, '\\n').replace(/'/g, "\\'")}',
fields: {
${Object.keys(frontmatter)
.map((key) => {
Expand Down

0 comments on commit eb866eb

Please sign in to comment.