{"id":13903012,"url":"https://github.com/awinogradov/jo-cli","last_synced_at":"2025-04-15T17:41:39.107Z","repository":{"id":40756858,"uuid":"261823877","full_name":"awinogradov/jo-cli","owner":"awinogradov","description":"Jo — command line code generator that works.","archived":false,"fork":false,"pushed_at":"2024-10-07T21:34:27.000Z","size":284,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T23:11:14.437Z","etag":null,"topics":["boilerplate","cli","generator","templates","tools"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awinogradov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-06T16:57:06.000Z","updated_at":"2024-10-07T21:34:30.000Z","dependencies_parsed_at":"2024-01-22T20:28:36.417Z","dependency_job_id":"0ec5fa98-e181-43fb-97a9-8d57929a5fce","html_url":"https://github.com/awinogradov/jo-cli","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awinogradov%2Fjo-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awinogradov%2Fjo-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awinogradov%2Fjo-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awinogradov%2Fjo-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awinogradov","download_url":"https://codeload.github.com/awinogradov/jo-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249121403,"owners_count":21216113,"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":["boilerplate","cli","generator","templates","tools"],"created_at":"2024-08-06T22:01:33.616Z","updated_at":"2025-04-15T17:41:39.090Z","avatar_url":"https://github.com/awinogradov.png","language":"TypeScript","funding_links":[],"categories":["cli"],"sub_categories":[],"readme":"# Jo\n\n`Jo` is a simple and scalable code generator that works. Built for developers by developers with ❤️.\n\n### Features\n\n-   🏗️ JavaScript as a template language — do what you want with any other packages in your templates;\n-   🎨 Hooks for any state — format, validate, whatever with your templates;\n-   🚀 Support templates as npm-package — share templates between teams and projects;\n-   🎩 Support [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) as known from sh/bash;\n-   💪 Command templates etending and overriding.\n\n## Usage\n\n```bash\n$ npm i -D jo-cli\n```\n\n### Command config\n\nAdd to `templates` directory first templates via folder `component` and populate command config.\n\n**templates/component/.joconfig.js**\n\n```js\nconst { pascalCase } = require('change-case');\n\nmodule.exports = {\n    title: 'React Component',\n    default: 'js',\n    path: ({ options }, filename) =\u003e (options.directory ? `./src/components/${filename}` : './src/components'),\n    description: 'Create React component in different technologies.',\n    options: {\n        directory: {\n            type: 'boolean',\n            short: 'd',\n            description: 'create component as directory',\n        },\n        module: {\n            type: 'string',\n            short: 'm',\n            description: 'Sub module',\n            parse: pascalCase,\n        },\n    },\n    hooks: {\n        preFileName: (_, filename) =\u003e pascalCase(filename),\n    },\n};\n```\n\n### Template\n\nAdd template files with name to extension matching.\n\n**templates/component/js.js**\n\n```js\nmodule.exports.template = ({ directory }, fileName) =\u003e\n    `import React from 'react';\n\n    export const ${fileName} = props =\u003e \u003cdiv\u003e${directory ? 'in direcotory' : 'one file'}\u003c/div\u003e;`;\n```\n\n**templates/component/css.js**\n\n```js\nmodule.exports.template = (_, fileName) =\u003e `.${fileName} {}`;\n```\n\n### Run it!\n\n```bash\n$ jo component tabs.{js,css} menu -d\n```\n\nWait for magic! 🐰\n\n```\nsrc\n└── components\n    ├── Menu\n    │   └── Menu.js\n    └── Tabs\n        ├── Tabs.css\n        └── Tabs.js\n```\n\n## CLI\n\n### Help\n\n```bash\n$ jo -h\n```\n\n```\nUsage: jo [options] [command]\n\nOptions:\n  -V, --version        output the version number\n  -h, --help           display help for command\n\nCommands:\n  component [options]  Create React component in different technologies.\n  help [command]       display help for command\n```\n\n```bash\n$ jo component -h\n```\n\n```\nUsage: jo component [options]\n\nCreate React component in different technologies.\n\nOptions:\n  -f, --force      override existing files\n  -d, --directory  create component as directory\n  -h, --help       display help for command\n```\n\n## Configure\n\nAdd `.joconfig.js` to your project root directory.\n\n```js\nmodule.exports = {\n    templates: [\n        'react-jo-templates', // name of package with templates\n        'bem-jo-templates',\n        'blog-jo-templates',\n        'path/to/your/templates', // templates by default\n    ],\n    logMode: 'silent', // verbose, short — verbose by default\n};\n```\n\n### Customize path for any template\n\n**templates/component/test.js.js**\n\n```js\nmodule.exports.path = ({ options, path, extension }, fileName) =\u003e\n    options.directory ? `${path}/${fileName}.test/${options.module}.${extension}` : `${path}/${fileName}.${extension}`;\n\nmodule.exports.template = (_, fileName) =\u003e `\ntest('${fileName}');\n`;\n```\n\n```bash\n$ jo component menu.test.js -d -m base\n```\n\n```\nsrc\n└── components\n    └── Menu\n        └── Menu.test\n            └── Base.test.js\n```\n\n## Hooks\n\n### preFileName(meta, filname)\n\nCalls before the filename will be created. Use it to customize naming with your team guides.\n\n```js\nconst { pascalCase } = require('change-case');\n\nmodule.exports = {\n    //...\n    hooks: {\n        preFileName: (_, filename) =\u003e pascalCase(filename),\n    },\n};\n```\n\n### preFileSave(meta, filname)\n\nCalls before the file content will be saved. Use it to format or any other magic.\n\n```js\nconst prettier = require('prettier');\n\nmodule.exports = {\n    //...\n    hooks: {\n        preFileSave: (_, content) =\u003e prettier.format(content),\n    },\n};\n```\n\n## Extends\n\nYou can base your command on any other. Override command config, add or override templates for any file exetensions.\n\n```js\nmodule.exports = {\n    extends: 'react-jo-templates/templates/react',\n    description: 'Styled React components',\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawinogradov%2Fjo-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawinogradov%2Fjo-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawinogradov%2Fjo-cli/lists"}