Skip to content

Commit

Permalink
Improve schema file control in the current folder
Browse files Browse the repository at this point in the history
  • Loading branch information
youngkiu committed Oct 1, 2022
1 parent 176fe55 commit 8918986
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ${E.join(`
`)}
@enduml
`}async function wo(s,t){let o=await zr.promises.readFile(s,"utf8"),E=Ea(o),T=Uo(E),c=t||Zr.default.parse(s).dir,O=Zr.default.join(c,`${Zr.default.parse(s).name}.puml`);return await zr.promises.mkdir(c,{recursive:!0}),await zr.promises.writeFile(O,T,"utf8"),{pumlFilePath:O,pumlStr:T}}0&&(module.exports={schemaToErd});
`}async function wo(s,t){let o=await zr.promises.readFile(s,"utf8"),E=Ea(o),T=Uo(E),c=t||Zr.default.parse(s).dir,O=Zr.default.join(c,`${Zr.default.parse(s).name}.puml`);return c&&await zr.promises.mkdir(c,{recursive:!0}),await zr.promises.writeFile(O,T,"utf8"),{pumlFilePath:O,pumlStr:T}}0&&(module.exports={schemaToErd});
/**
* @license
* Lodash <https://lodash.com/>
Expand Down
2 changes: 1 addition & 1 deletion dist/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ${E.join(`
`)}
@enduml
`}async function ia(s,t){let o=await go.readFile(s,"utf8"),E=oa(o),T=vo(E),c=t||Mo.parse(s).dir,O=Mo.join(c,`${Mo.parse(s).name}.puml`);return await go.mkdir(c,{recursive:!0}),await go.writeFile(O,T,"utf8"),{pumlFilePath:O,pumlStr:T}}export{ia as schemaToErd};
`}async function ia(s,t){let o=await go.readFile(s,"utf8"),E=oa(o),T=vo(E),c=t||Mo.parse(s).dir,O=Mo.join(c,`${Mo.parse(s).name}.puml`);return c&&await go.mkdir(c,{recursive:!0}),await go.writeFile(O,T,"utf8"),{pumlFilePath:O,pumlStr:T}}export{ia as schemaToErd};
/**
* @license
* Lodash <https://lodash.com/>
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": "schema-to-erd",
"version": "1.4.1",
"version": "1.4.2",
"description": "Generate ERD UML file from Schema DDL file",
"type": "module",
"main": "dist/main.cjs",
Expand Down
4 changes: 3 additions & 1 deletion src/schema_to_erd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default async function schemaToErd(schemaFilePath, outputDirPath) {

const pumlDirPath = outputDirPath || path.parse(schemaFilePath).dir;
const pumlFilePath = path.join(pumlDirPath, `${path.parse(schemaFilePath).name}.puml`);
await fs.mkdir(pumlDirPath, { recursive: true });
if (pumlDirPath) {
await fs.mkdir(pumlDirPath, { recursive: true });
}
await fs.writeFile(pumlFilePath, pumlStr, 'utf8');

return { pumlFilePath, pumlStr };
Expand Down

0 comments on commit 8918986

Please sign in to comment.