{"_id":"mochi-cli","_rev":"38-cb1cd9d8d00211d16d2b46023ba9175f","name":"mochi-cli","dist-tags":{"latest":"2.0.16"},"versions":{"2.0.15":{"name":"mochi-cli","version":"2.0.15","description":"A simple scaffolding tool","main":"dist/src/cli.js","type":"commonjs","bin":{"mochi-cli":"dist/src/cli.js"},"scripts":{"build":"tsc","build:watch":"tsc --watch","clean":"rm -rf ./dist && rm -rf ./tmp","copy:templates":"cp -r ./test/templates/. /tmp/.mochi/","prepublishOnly":"npm run release","test:unit":"jest --testPathPattern=test/unit && echo Unit tests passed 🔬","test:integ":"jest --testPathPattern=test/integ && echo Integration tests passed 🤖","test":"npm run test:unit && npm run test:integ && echo All tests passed 🧪","release":"npm run clean && npm run build && npm run test && echo Build Succeeded 👍"},"keywords":[],"author":{"name":"Chance Linz","email":"clinz.dev@gmail.com"},"license":"ISC","devDependencies":{"@types/glob":"^7.2.0","@types/jest":"^27.4.0","@types/node":"^17.0.17","@types/yargs":"^17.0.8","jest":"^27.5.1","prettier":"^2.5.1","ts-jest":"^27.1.3","typescript":"^4.5.5"},"dependencies":{"chalk":"^4.1.2","glob":"^7.2.0","table":"^6.8.0","yargs":"^17.3.1"},"jest":{"preset":"ts-jest","modulePathIgnorePatterns":["<rootDir>/dist/"]},"publishConfig":{"access":"public"},"gitHead":"3fd8c07b96071be3585b5e421e74d37e2a40c37a","_id":"mochi-cli@2.0.15","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-yhFpn2LWEHoi7haE0Pcf18gVl/BGxuHe8ydtxsWxo+SdKHyRxwK7n1igsoKiFFd3lfy4FeSKk38bVpDx1G8/4g==","shasum":"2afe36a79b583851754a9b3cf2eff5eabbb771e5","tarball":"https://registry.npmjs.org/mochi-cli/-/mochi-cli-2.0.15.tgz","fileCount":12,"unpackedSize":27718,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIqK1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmratBAAkoV9TTzzng2ktmQvXBCdyy1FmP1vSllPUjLOYW77jSL9kYpX\r\nsIkVmTTXy8Qeyy72I63I6EnXzlgsNpCKXmt2w1+OuNwbiQXq8yzE+1Zb8ZJ3\r\nDXisWmEcsqLKo5XVy1uodWlZUp+B7QJyOSR+GOmwJBZwUI/FEPELs91UIiz4\r\nMw1qs1tCAvseKuCiSx+TQVjYr1+Q1QqmFxm/HZ8BhFJRvU1cBPqVtSudPNyf\r\nlv24cFyQcdN+v8hJY/TkPQnf6KAYwBkaaRgBzNv/PaaIEH6UYoYm8C8YPsl/\r\nz5FZz0Lqi058z1Q/ZFHwk4zD2v0Suq+PUmWuNHeVnK5SRVEtHyjNnKtEjf0e\r\n2C+ljCJ5XjrAVoHbkFVtM62iQgW5Vu11Jsa5+rXwBEFOEcO6q8AYgRUDFHBt\r\nme9OOthcwwXsDQx/NKqpz3nwHJt58o9k/7ic+OH51xkUCM/y8tqhZu8IUpIg\r\n1SLowcSv6MD9yBnZ/EWcGHSmn81b48BUS8C16tz3350P5c8XRU5KNXQ+2miY\r\nA68nEUSMk6wtYpDy6P1g6uLQ3WgPtvf2w2eDjQs2Y4w2F/GiisOmyvffgYKe\r\nHqoghlkQUkRtGxH/VH2AOgOqzbx8lSAa/KchD48Zd3kGl6UrpMekUwhfIoeV\r\nrFqR57Ypx9ssNMVaUuGxdUI2N1tqPKarErA=\r\n=aWui\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICLLj+ZLOt5p9OHnqL0dlEQi0VyNZGCdUMxVQw1J2NhhAiBWOnqR/dAZ5b7BQjCVPYBcN1FUK/DxJ3x5JltzwVPfPg=="}]},"_npmUser":{"name":"chancehl","email":"chlinz@outlook.com"},"directories":{},"maintainers":[{"name":"chancehl","email":"chlinz@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mochi-cli_2.0.15_1646437045186_0.6296064627366955"},"_hasShrinkwrap":false},"2.0.16":{"name":"mochi-cli","version":"2.0.16","description":"A simple scaffolding tool","main":"dist/src/cli.js","type":"commonjs","bin":{"mochi-cli":"dist/src/cli.js"},"scripts":{"build":"tsc","build:watch":"tsc --watch","clean":"rm -rf ./dist && rm -rf ./tmp","copy:templates":"cp -r ./test/templates/. /tmp/.mochi/","prepublishOnly":"npm run release","test:unit":"jest --testPathPattern=test/unit && echo Unit tests passed 🔬","test:integ":"jest --testPathPattern=test/integ && echo Integration tests passed 🤖","test":"npm run test:unit && npm run test:integ && echo All tests passed 🧪","release":"npm run clean && npm run build && npm run test && echo Build Succeeded 👍"},"keywords":[],"author":{"name":"Chance Linz","email":"clinz.dev@gmail.com"},"license":"ISC","devDependencies":{"@types/glob":"^7.2.0","@types/jest":"^27.5.2","@types/node":"^17.0.45","@types/yargs":"^17.0.8","jest":"^27.5.1","prettier":"^2.5.1","ts-jest":"^27.1.3","typescript":"^4.5.5"},"dependencies":{"chalk":"^4.1.2","glob":"^7.2.0","table":"^6.8.0","yargs":"^17.3.1"},"jest":{"preset":"ts-jest","modulePathIgnorePatterns":["<rootDir>/dist/"]},"publishConfig":{"access":"public"},"gitHead":"3fd8c07b96071be3585b5e421e74d37e2a40c37a","_id":"mochi-cli@2.0.16","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-PZfJhbyCFFAAHJHaydFKs1ne7PzRJF3HuVJcfK4kspX9cqe/sYg54Dksk85Sje09lFZzWC57lep0UFw81IyxsQ==","shasum":"d76c66c9b78c2ac3b043052ada570122495f56ef","tarball":"https://registry.npmjs.org/mochi-cli/-/mochi-cli-2.0.16.tgz","fileCount":12,"unpackedSize":28188,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBjsMCwJEoRAsXAgsFNGderIYc47KnvIF3Z0yoFjiwVgAiEA3n1C1skeeqBE9pxhaHL4ZlgZEG5Dk/SSPv0Pbm0C1o8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjO4Q4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoNFA//XfMPcTd0UsHwz47VYBbosz12Z6H8ZrxMPU6Hz1UKgnIB+t5g\r\nhnwK7QuV3gAWDIMWdW2xU2ewa3uvWO25/RJ+dQmVW1XiRWR54qYwR9DAq906\r\nDDiGUFZUHM85S8myKRrnTGTArS5jc+ZnReVmoNWgqefpFPQJOs4DUND/MnIq\r\nqEggYHP9EUO6sWmCmJ5CGxXe0KMDpnMnk9HjYQZPBr1QBmAIQdHya+BS47+s\r\nBbfQVqugScbU30M0LtX4LJnSU9kF58kitp/ix9fmuN/WqrpYZWcRdDdZV6im\r\ntUB0NbRLTc7MsjSVsoCfDZPfPMG/LGLAts+FeVq5dTqMDBAgL9pZ6hzjk1w+\r\n+ohbOsMEgdy0Y1kE4eArf/Wizq6g08Np6YjCOE1VRafjeCtIiVcSpM3PgfBt\r\nPhbqyqopLn5U3034hoqy24wvrn27klWhD/yIna1XHIHQ5Xxay8gCxQfpXnJJ\r\nuBp7Ml/LaSRkSRdfUr7rDzlUqNcx3NeTyU8dhLrSHeP3AqELDtW67oRSla8x\r\neJOsmUPgUVuwmT6N8SazJcqsghtHfDkqHqgwPNI820m66zSlY7lL6Q/xisUU\r\njh7vhoSkALVT/yBQYdyGKU8R5MoxlElZxRgkSJJzeoz2ehQGVQAgtt1JLR8f\r\n5ETfQalAbQtV0RJP1qMhyKOZ5lyniyxTbdw=\r\n=62hk\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"chancehl","email":"chlinz@outlook.com"},"directories":{},"maintainers":[{"name":"chancehl","email":"chlinz@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mochi-cli_2.0.16_1664844855845_0.7396268414148757"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-26T06:26:44.018Z","1.0.0":"2022-02-26T06:26:44.506Z","modified":"2022-10-04T00:54:16.114Z","1.0.1":"2022-02-26T06:28:31.263Z","1.0.2":"2022-02-26T06:32:00.082Z","2.0.0":"2022-02-27T23:54:29.238Z","2.0.1":"2022-02-27T23:55:55.678Z","2.0.2":"2022-02-27T23:57:06.027Z","2.0.3":"2022-02-28T00:04:46.129Z","2.0.4":"2022-02-28T00:07:05.474Z","2.0.5":"2022-02-28T00:09:52.870Z","2.0.6":"2022-02-28T00:14:24.197Z","2.0.7":"2022-02-28T00:17:35.232Z","2.0.8":"2022-02-28T00:20:39.659Z","2.0.9":"2022-02-28T07:08:08.266Z","2.0.10":"2022-03-01T02:03:37.640Z","2.0.11":"2022-03-01T02:05:45.580Z","2.0.12":"2022-03-01T02:16:13.734Z","2.0.13":"2022-03-03T17:45:15.342Z","2.0.14":"2022-03-03T21:29:14.265Z","2.0.15":"2022-03-04T23:37:25.386Z","2.0.16":"2022-10-04T00:54:16.053Z"},"maintainers":[{"name":"chancehl","email":"chlinz@outlook.com"}],"description":"A simple scaffolding tool","keywords":[],"author":{"name":"Chance Linz","email":"clinz.dev@gmail.com"},"license":"ISC","readme":"# Install\n\n```\n# Locally\nnpm install --save-dev mochi-cli\n\n# Globally\nnpm install -g mochi-cli\n```\n\n# Usage\n\n## Mochi templates\n\nA mochi template is simply a `.mdx` file with a _super fancy_ extension: `.mochi.mdx`. The template is broken into two parts:\n\n-   The template **definition**\n-   The template **body**\n\n### Mochi template defintions\n\nA mochi template definition complies to the following type when serialized via `JSON.serialize()`:\n\n```\nexport type MochiConfiguration = {\n    /**\n     * The template name\n     */\n    templateName: string\n\n    /**\n     * The tokens to be replaced wtihin the file\n     */\n    tokens: string[]\n\n    /**\n     * The name of the output file (without the path)\n     */\n    fileName: string\n\n    /**\n     * Other mochi template names to be included in the execution\n     */\n    include?: string[]\n\n    /**\n     * The output directory of the mochi run\n     */\n    destination?: string\n}\n```\n\nAn example Mochi configuration may look like this:\n\n````\n```mochi\n{\n    # The name of the template\n    \"templateName\": \"react-component/ts\",\n\n    # The file output name (note: COMPONENT_NAME is included in the tokens array, so it will be replaced as well!)\n    \"fileName\": \"COMPONENT_NAME.tsx\".\n\n    # The folder to place the output file(s) within\n    \"destination\": \"./src\",\n\n    # If I also have a template named react-component/typeDefs saved, it will be included in this mochi run\n    \"include\": [\"react-component/typeDefs\"],\n\n    # The tokens that mochi will prompt you for\n    \"tokens\": [\"COMPONENT_NAME\"]\n}\n```\n````\n\n### Mochi template bodies\n\nA Mochi template body can be, well... _anything_. The Mochi template definition will be parsed off at runtime, so anything that isn't within the `mochi` block of the `.mochi.mdx` file will be included in your output files.\n\nExample:\n\nTake this Mochi template definition:\n\n````\n# react-component.mochi.mdx\nimport React from 'react';\n\nconst COMPONENT_NAME = () => {\n    return (\n        <>\n            Hello world, I am COMPONENT_NAME!\n        <>\n    )\n}\n\nexport default COMPONENT_NAME\n\n```mochi\n{\n    \"templateName\": \"react-component/ts\",\n    \"tokens\": [\"COMPONENT_NAME\"],\n    \"fileName\": \"COMPONENT_NAME.tsx\"\n}\n```\n````\n\nAnd you provided the value \"Calendar\" (we'll circle back to how you give Mochi values in a second), your output would be everything in the template file (`react-component.mochi.mdx`) _minus_ the mochi definition, like so:\n\n```\n# Calendar.tsx\nimport React from 'react';\n\nconst Calendar = () => {\n    return (\n        <>\n            Hello world, I am Calendar!\n        <>\n    )\n}\n\nexport default Calendar\n```\n\n# Commands\n\n## Summary\n\n```\nmochi-cli [command]\n\nCommands:\n  mochi-cli create [template]  Create a file from the given template\n  mochi-cli save [template]    Saves the specified mochi configuration in a tmp\n                               directory\n\nOptions:\n      --version  Show version number                                   [boolean]\n  -h, --help     Show help                                             [boolean]\n```\n\n## Create\n\nExecutes Mochi from a given template. A mochi execution is broken down into three steps:\n\n-   Template aggregation\n-   Prompting the user for tokens\n-   File I/O\n\n**Template aggregation**: Mochi will recursively crawl the provided template looking for other templates (specified by the `include` array) to include in the execution.\n\n**Prompting the user for tokens**: Mochi will ask the user to provide values for the tokens found within the aggregated mochi configuration.\n\nExample:\n\n```\n~/workshop/mochi/cli$ mochi-cli create \"react-component\" --destination ./tmp\n\nMochi will now prompt you to provide values for the following tokens found in your .mochi.mdx file(s): COMPONENT_NAME\n\nCOMPONENT_NAME => Calendar\n\n🥳 Success! Thank you for using mochi-cli 😍\n╔═══════════════════════╤═══════════════════════════╤═══════════════════════╗\n║ Template              │ Destination               │ Dependencies          ║\n╟───────────────────────┼───────────────────────────┼───────────────────────╢\n║ react-component       │ tmp/Calendar.tsx          │ react-component-types ║\n╟───────────────────────┼───────────────────────────┼───────────────────────╢\n║ react-component-types │ tmp/Calendar.types.ts     │ react-component       ║\n╚═══════════════════════╧═══════════════════════════╧═══════════════════════╝\n```\n\n```\nmochi-cli create [template]\n\nCreate a file from the given template\n\nOptions:\n      --version      Show version number                               [boolean]\n  -t, --template                                             [string] [required]\n  -d, --destination                                                     [string]\n  -h, --help         Show help                                         [boolean]\n```\n\n### Examples\n\nMinimum:\n\n```\nmochi-cli create prettierrc\n```\n\nWith destination:\n\n```\nmochi-cli create prettierrc --destination=\"./src\"\n```\n\nWith file path (instead of template name):\n\n```\nmochi-cli create /home/users/chancehl/workspace/templates/prettierrc.mochi.mdx\n```\n\n## Save\n\nSaves the mochi template to the `os.tmpdir` directory (this is where mochi will look for templates by default).\n\nUse this when you want to cache the templates on disk, rather than in your project directly or in the mochi remote repository (coming soon).\n\n```\nmochi-cli save [template]\n\nSaves the specified mochi configuration in a tmp directory\n\nOptions:\n      --version   Show version number                                  [boolean]\n  -t, --template                                             [string] [required]\n  -h, --help      Show help                                            [boolean]\n```\n\n### Examples\n\nMinimal:\n\n```\nmochi save /home/users/chancehl/workspace/templates/prettierrc.mochi.mdx\n```\n\n## [Experimental] Push\n\nComing soon!\n\n## [Experimental] Pull\n\nComing soon!\n\n## [Experimental] Login\n\nComing soon!\n","readmeFilename":"README.md"}