{"id":16183720,"url":"https://github.com/opuscapita/sequelize-to-markdown","last_synced_at":"2025-04-02T00:31:39.067Z","repository":{"id":63264278,"uuid":"84943204","full_name":"OpusCapita/sequelize-to-markdown","owner":"OpusCapita","description":"DEPRECATED Create Markdown documentations out of sequelize models.","archived":false,"fork":false,"pushed_at":"2022-11-14T15:27:40.000Z","size":142,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-30T14:35:07.835Z","etag":null,"topics":["andariel","bnp","library","tool","util"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpusCapita.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-14T11:50:20.000Z","updated_at":"2022-09-20T07:39:20.000Z","dependencies_parsed_at":"2022-11-16T01:15:30.824Z","dependency_job_id":null,"html_url":"https://github.com/OpusCapita/sequelize-to-markdown","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpusCapita%2Fsequelize-to-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpusCapita%2Fsequelize-to-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpusCapita%2Fsequelize-to-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpusCapita%2Fsequelize-to-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpusCapita","download_url":"https://codeload.github.com/OpusCapita/sequelize-to-markdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246735087,"owners_count":20825213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["andariel","bnp","library","tool","util"],"created_at":"2024-10-10T07:06:17.470Z","updated_at":"2025-04-02T00:31:35.427Z","avatar_url":"https://github.com/OpusCapita.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sequelize-to-markdown\n\n[![Coverage Status](https://coveralls.io/repos/github/OpusCapita/sequelize-to-markdown/badge.svg?branch=master)](https://coveralls.io/github/OpusCapita/sequelize-to-markdown?branch=master)\n\nSequelize to Markdown is a simple tool to document the data structure of [sequelize](https://www.npmjs.com/package/sequelize) models. Its output is template based to enable developers to change the output structure, style or even the output type e.g. by creating html [templates](#templating).\n\nThis module provides a comfortable APIs and a full featured command line client.\n\n# WARNING\n\nPlease, do NOT use it. This module has several importain issues:\n\n- Markdown is meant to be manually edited, not auto-generated - you should NOT push markdown to wiki automatically\n- This module is very outdated - if you are still using it for whatever you should think again\n- This module has messy dependencies and sqlite3 is used for tests but is marked as dependency - and it is not that simple to install it on newer node images\n- No one is maitaining this repository for years\n\n### Install\n\n```\nnpm install -g sequelize-to-markdown\n```\n\n##### Requirements\n\nThis module works by including code. That means, that your model files get required like common modules. To enable sequelize-to-markdown to correctly load your models, each file included by this tool has to either provide a default function call or an init() method.\n\n```JS\nmodule.exports = function(db, config) { ... }\n - or -\nmodule.exports.init = function(db, config) { ... }\n```\n\nTo get your models documented, you will have to provide a small amount of doc comments in your code. To start a minimal setup, you only have to provide the **@class** or **@lends** (or @memberof) tags from [JSDoc](http://usejsdoc.org/). If you add text to your class and field definitions, it will be used as descriptions in the output.\n\n```JS\nconst DataTypes = require('sequelize');\n\n/**\n * Class description.\n * @class MyUser\n */\nsequelize.define('MyUser',\n/** @lends MyUser */\n{\n    /** Test comment. */\n    id : {\n        type : DataTypes.INTEGER(),\n        allowNull : false,\n        primayKey : true,\n        autoIncrement : true\n    },\n    /** Test name comment. */\n    name : {\n        type : DataTypes.STRING(128),\n        allowNull : false\n    }\n});\n```\n\n### Command-line interface\n\nAfter installing and having your code ready, you may use the command-line interface (CLI) on the terminal of your computer. The command is named \"sq2md\".\n\n```\nsq2md --help\n\n  Usage: sq2md [options] [path]\n\n  Options:\n\n    -h, --help                     output usage information\n    -r, --recursive                Scan \u003cpath\u003e recursively.\n    -t, --template \u003ctemplate\u003e      Template file to use for output generation.\n    -o, --output-type \u003ctype\u003e       Where to put the output. Possible values: stdout, file, file-per-class, file-per-src.\n    -f, --output-file \u003cfile\u003e       File to output results to if output type is file.\n    -p, --output-path \u003cpath\u003e       Path to output results to if output type is file-per-class or file-per-src.\n    -c, --config \u003cfile\u003e            Path to a JSON config file to use.\n    --init \u003cname\u003e                  Initialization function to be called for every source file.\n    --init-config \u003cconfig\u003e         JSON config to be passed to an init function.\n    --output-ext \u003cextension\u003e       File extension of result files if output type is file-per-class or file-per-src.\n    --field-bl \u003cfield\u003e[,\u003cfields\u003e]  List of fields to ignore.\n    --dir-filter \u003cregexp\u003e          RegExp for filtering directories when looking for source files.\n    --file-filter \u003cregexp\u003e         RegExp for filtering files when looking for models.\n    --path-bl \u003cpath\u003e[,\u003cpath\u003e]      List of paths to ignore.\n    --sq-config \u003cconfig\u003e           JSON config to be passed to sequelize.\n```\n\n#### Config file\n\nThe config file represents all configuration options available to run the tool from command line. These are almost the same options as shown in the [DefaultConfig](#defaultconfig) section of the API description. In order to use the module programmatically, you will have to use the [DefaultConfig](#defaultconfig) settings instead.\n\n```JS\n{\n    \"fieldBlacklist\": [],\n    \"models\": {\n        \"paths\": [],\n        \"pathBlacklist\": [],\n        \"recursive\": false,\n        \"initFunction\": null,\n        \"initConfig\": {},\n        \"directoryFiler\": \"[^\\\\/\\\\.*]\",\n        \"fileFilter\": \"\\\\.js$\"\n    },\n    \"input\": {\n        \"templateFile\": \"templates/default.njk\"\n    },\n    \"output\": {\n        \"type\": \"StdOut\",\n        \"file\": {\n            \"splitting\": \"AllInOne\",\n            \"path\": null,\n            \"extension\": \".md\"\n        }\n    },\n    \"sequelize\": {}\n}\n```\n\n### API\n\nYou might also want to use the API of this tool as a library. The library provides two methods to call. A parse() and a render() method.\n\nThe **parse()** method returns an object containing all information extracted from the source.\n\nThe **render()** method does the same but outputs a processed template depending on the input and output settings of the passed configuration object.\n\n```JS\nconst sq2md = require('sequelize-to-markdown');\n\nvar resultObj = sq2md.parse({ models : { paths : [ '...' ] } });\nvar resultStr = sq2md.render({ models : { paths : [ '...' ] } });\n\nconsole.log(resultObj);\nconsole.log(resultStr);\n```\n\nFor configuration options please have a look at the [DefaultConfig](#defaultconfig) section.\n\n#### Templating\n\nThis module uses [Nunjucks](https://www.npmjs.com/package/nunjucks) in order to structure the parsed sequelize models. By changing the provided or creating a new template, you would be able to create almost every formatted text output.\n\n#### DefaultConfig\n\n```JS\n{\n    fieldBlacklist : [ ],\n    models : {\n        paths : [ ],\n        pathBlacklist : [ ],\n        recursive : false,\n        initFunction : null,\n        initConfig : { },\n        directoryFiler : new RegExp('[^\\/\\.*]'),\n        fileFilter : new RegExp('\\.js$')\n    },\n    input : {\n        templateFile : 'templates/default.njk'\n    },\n    output : {\n        type : this.OutputType.ReturnOnly,\n        file : {\n            splitting : this.FileSplitting.AllInOne,\n            path : null,\n            extension : '.md'\n        },\n        contentFilter : item =\u003e item.replace(/\\n{3,}/g, \"\\n\\n\")\n    },\n    sequelize : {\n\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopuscapita%2Fsequelize-to-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopuscapita%2Fsequelize-to-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopuscapita%2Fsequelize-to-markdown/lists"}