├── .eslintrc.js ├── .github └── workflows │ ├── cd.yml │ ├── ci.yml │ └── docs.yml ├── .gitignore ├── .npmignore ├── .prettierrc ├── .tool-versions-e ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── dist ├── bin.d.ts ├── bin.d.ts.map ├── bin.js ├── bin.js.map ├── bin.timed.d.ts ├── bin.timed.d.ts.map ├── bin.timed.js ├── bin.timed.js.map ├── config-resolver.d.ts ├── config-resolver.d.ts.map ├── config-resolver.js ├── config-resolver.js.map ├── config.d.ts ├── config.d.ts.map ├── config.js ├── config.js.map ├── context.d.ts ├── context.d.ts.map ├── context.js ├── context.js.map ├── engine.d.ts ├── engine.d.ts.map ├── engine.js ├── engine.js.map ├── execute.d.ts ├── execute.d.ts.map ├── execute.js ├── execute.js.map ├── help.d.ts ├── help.d.ts.map ├── help.js ├── help.js.map ├── helpers.d.ts ├── helpers.d.ts.map ├── helpers.js ├── helpers.js.map ├── index.d.ts ├── index.d.ts.map ├── index.js ├── index.js.map ├── logger.d.ts ├── logger.d.ts.map ├── logger.js ├── logger.js.map ├── newline.d.ts ├── newline.d.ts.map ├── newline.js ├── newline.js.map ├── ops │ ├── add.d.ts │ ├── add.d.ts.map │ ├── add.js │ ├── add.js.map │ ├── echo.d.ts │ ├── echo.d.ts.map │ ├── echo.js │ ├── index.d.ts │ ├── index.d.ts.map │ ├── index.js │ ├── index.js.map │ ├── inject.d.ts │ ├── inject.d.ts.map │ ├── inject.js │ ├── inject.js.map │ ├── injector.d.ts │ ├── injector.d.ts.map │ ├── injector.js │ ├── injector.js.map │ ├── result.d.ts │ ├── result.d.ts.map │ ├── result.js │ ├── result.js.map │ ├── setup.d.ts │ ├── setup.d.ts.map │ ├── setup.js │ ├── shell.d.ts │ ├── shell.d.ts.map │ ├── shell.js │ └── shell.js.map ├── params.d.ts ├── params.d.ts.map ├── params.js ├── params.js.map ├── prompt.d.ts ├── prompt.d.ts.map ├── prompt.js ├── prompt.js.map ├── render.d.ts ├── render.d.ts.map ├── render.js ├── render.js.map ├── types.d.ts ├── types.d.ts.map ├── types.js └── types.js.map ├── hygen.io ├── .gitignore ├── README.md ├── docs │ ├── create.md │ ├── express.md │ ├── extensibility.md │ ├── faq.md │ ├── generators.md │ ├── packages.md │ ├── quick-start.md │ ├── react-native.md │ ├── redux.md │ ├── standalone.md │ └── templates.md ├── docusaurus.config.js ├── package.json ├── sidebar.js ├── src │ ├── components │ │ ├── cta-button.js │ │ ├── doc-search.js │ │ ├── navigation.js │ │ └── shell.js │ ├── css │ │ ├── custom.css │ │ ├── docsearch.custom.css │ │ ├── docsearch.min.css │ │ ├── github.js │ │ ├── main.js │ │ └── prism.css │ └── pages │ │ ├── index.js │ │ └── styles.module.css ├── static │ ├── CNAME │ └── img │ │ ├── fast.svg │ │ ├── favicon.ico │ │ ├── hygen.svg │ │ ├── logo.png │ │ ├── node.svg │ │ ├── react.svg │ │ ├── redux.svg │ │ ├── scalable.svg │ │ ├── search.svg │ │ ├── simple.svg │ │ ├── undraw_docusaurus_mountain.svg │ │ ├── undraw_docusaurus_react.svg │ │ └── undraw_docusaurus_tree.svg └── yarn.lock ├── lib ├── bin.js ├── bin.timed.js ├── config-resolver.js ├── config.js ├── context.js ├── engine.js ├── execute.js ├── help.js ├── index.js ├── inject.js ├── logger.js ├── ops │ ├── add.js │ ├── index.js │ ├── inject.js │ ├── injector.js │ ├── result.js │ └── shell.js ├── params.js ├── prompt.js ├── render.js ├── templates-resolver.js ├── templates │ ├── example-prompt │ │ └── new │ │ │ ├── mailer.ejs.t │ │ │ ├── prompt.js │ │ │ ├── templates_html.ejs.t │ │ │ ├── templates_subject.ejs.t │ │ │ ├── templates_text.ejs.t │ │ │ └── z_inject.ejs.t │ ├── example │ │ └── new │ │ │ ├── shell.ejs.t │ │ │ └── worker.ejs.t │ ├── init │ │ └── self │ │ │ ├── new-generator-help.ejs.t │ │ │ ├── new-generator-with-prompt.ejs.t │ │ │ ├── new-generator-with-prompt.prompt.ejs.t │ │ │ └── new-generator.ejs.t │ └── mailer │ │ └── new │ │ └── prompt.js └── types.js ├── media ├── favicon.ico ├── hygen.gif └── hygen.png ├── package.json ├── scripts └── standalone.js ├── src ├── __tests__ │ ├── __snapshots__ │ │ ├── add.spec.ts.snap │ │ ├── context.spec.ts.snap │ │ ├── injector.spec.ts.snap │ │ ├── metaverse-conditional.spec.ts.snap │ │ └── metaverse.spec.ts.snap │ ├── add.spec.ts │ ├── config-resolver.spec.ts │ ├── config.spec.ts │ ├── context.spec.ts │ ├── fixtures │ │ ├── app │ │ │ ├── action-capitalized-defaults │ │ │ │ └── capitalized.ejs.t │ │ │ ├── action-capitalized │ │ │ │ └── capitalized.ejs.t │ │ │ ├── action-change-case │ │ │ │ └── snake.t │ │ │ ├── action-empty │ │ │ │ └── empty.ejs.t │ │ │ ├── action-full │ │ │ │ └── full.ejs.t │ │ │ ├── action-inject │ │ │ │ └── inject.ejs.t │ │ │ ├── action-multifiles-nest │ │ │ │ ├── arbitrarySubfolder │ │ │ │ │ └── capitalized.ejs.t │ │ │ │ └── full.ejs.t │ │ │ └── action-multifiles │ │ │ │ ├── capitalized.ejs.t │ │ │ │ └── full.ejs.t │ │ ├── capitalized.ejs.t │ │ ├── empty.ejs.t │ │ ├── full.ejs.t │ │ ├── inject.ejs.t │ │ ├── params │ │ │ ├── template-folder-in-templates │ │ │ │ └── _templates │ │ │ │ │ └── some.file │ │ │ └── templates-override │ │ │ │ ├── _templates │ │ │ │ └── some.file │ │ │ │ └── tmpls │ │ │ │ └── some.otherfile │ │ ├── shell.ejs.t │ │ └── templates │ │ │ ├── app-custom │ │ │ └── other-templates │ │ │ │ └── foo.js │ │ │ └── app │ │ │ └── _templates │ │ │ └── foo.js │ ├── injector.spec.ts │ ├── metaverse-conditional.spec.ts │ ├── metaverse-utils.ts │ ├── metaverse.spec.ts │ ├── metaverse │ │ ├── hygen-defaults │ │ │ ├── _templates │ │ │ │ └── use-defaults │ │ │ │ │ ├── _default │ │ │ │ │ └── default.md.t │ │ │ │ │ └── new │ │ │ │ │ └── index.ejs.t │ │ │ └── expected │ │ │ │ └── hygen-defaults │ │ │ │ └── default.md │ │ ├── hygen-extension │ │ │ ├── .hygen.js │ │ │ ├── _templates │ │ │ │ └── hygen-js │ │ │ │ │ └── new │ │ │ │ │ └── index.ejs.t │ │ │ └── expected │ │ │ │ └── hygen-js │ │ │ │ └── new.md │ │ ├── hygen-templates-unix │ │ │ ├── _templates │ │ │ │ └── shell │ │ │ │ │ └── new │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ ├── shell.ejs.t │ │ │ │ │ └── side-effect.ejs.t │ │ │ └── expected │ │ │ │ └── shell │ │ │ │ ├── foo.hello │ │ │ │ ├── hello.piped │ │ │ │ ├── hmm.txt │ │ │ │ └── side-effect.hello │ │ └── hygen-templates │ │ │ ├── _templates │ │ │ ├── add-unless-exists │ │ │ │ └── new │ │ │ │ │ ├── always.ejs.t │ │ │ │ │ ├── y_overwrite.ejs.t │ │ │ │ │ └── z_dont-overwrite.ejs.t │ │ │ ├── attrs-in-body │ │ │ │ └── new │ │ │ │ │ └── hello.ejs.t │ │ │ ├── cli-prefill-prompt-vars │ │ │ │ ├── falsy-values-are-ok │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── prompt.js │ │ │ │ ├── name-is-special │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── prompt.js │ │ │ │ └── new │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── prompt.js │ │ │ ├── conditional-rendering │ │ │ │ └── new │ │ │ │ │ ├── always.ejs.t │ │ │ │ │ └── conditional.ejs.t │ │ │ ├── existing-params │ │ │ │ ├── new-params-alias │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── prompt.js │ │ │ │ └── new │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── prompt.js │ │ │ ├── index-js-existing-params │ │ │ │ ├── new-params-alias │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── index.js │ │ │ │ └── new │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── index.js │ │ │ ├── inflection-in-params │ │ │ │ └── new │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── index.js │ │ │ ├── inflection-in-prompt │ │ │ │ └── new │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── prompt.js │ │ │ ├── inflection │ │ │ │ └── new │ │ │ │ │ └── index.ejs.t │ │ │ ├── init │ │ │ │ └── self │ │ │ │ │ └── hello.ejs.t │ │ │ ├── mailer │ │ │ │ ├── init │ │ │ │ │ └── nodemailer.ejs.t │ │ │ │ └── new │ │ │ │ │ ├── mailer.ejs.t │ │ │ │ │ ├── prompt.js │ │ │ │ │ ├── templates_html.ejs.t │ │ │ │ │ ├── templates_subject.ejs.t │ │ │ │ │ ├── templates_text.ejs.t │ │ │ │ │ └── z_inject.ejs.t │ │ │ ├── overwrite-no │ │ │ │ ├── base │ │ │ │ │ └── new.md.t │ │ │ │ └── over │ │ │ │ │ └── new.md.t │ │ │ ├── overwrite-yes │ │ │ │ ├── base │ │ │ │ │ └── new.md.t │ │ │ │ └── over │ │ │ │ │ └── new.md.t │ │ │ ├── positional-name │ │ │ │ └── new │ │ │ │ │ └── always.ejs.t │ │ │ ├── recursive-prompt │ │ │ │ └── new │ │ │ │ │ ├── index.ejs.t │ │ │ │ │ └── prompt.js │ │ │ ├── sample │ │ │ │ └── new │ │ │ │ │ └── hello.ejs.t │ │ │ ├── setup-new-project │ │ │ │ └── new │ │ │ │ │ ├── defaults.ejs.t │ │ │ │ │ └── hello.ejs.t │ │ │ └── worker │ │ │ │ ├── init │ │ │ │ └── hyperwork.ejs.t │ │ │ │ └── new │ │ │ │ └── worker.ejs.t │ │ │ └── expected │ │ │ ├── _templates │ │ │ └── sample │ │ │ │ └── new │ │ │ │ └── hello.ejs.t │ │ │ ├── add-unless-exists │ │ │ └── foo │ │ │ │ └── always.txt │ │ │ ├── app │ │ │ ├── mailers │ │ │ │ ├── foo │ │ │ │ │ ├── html.ejs │ │ │ │ │ ├── subject.ejs │ │ │ │ │ └── text.ejs │ │ │ │ └── message.js │ │ │ └── workers │ │ │ │ └── foo.js │ │ │ ├── attrs-in-body │ │ │ └── hello.txt │ │ │ ├── cli-prefill-prompt-vars │ │ │ ├── falsy.md │ │ │ ├── name-is-special.md │ │ │ └── new.md │ │ │ ├── conditional │ │ │ └── always.txt │ │ │ ├── existing-params │ │ │ ├── new-params-alias.md │ │ │ └── new.md │ │ │ ├── index-js-existing-params │ │ │ ├── new-params-alias.md │ │ │ └── new.md │ │ │ ├── inflection-in-params │ │ │ └── new.md │ │ │ ├── inflection-in-prompt │ │ │ └── new.md │ │ │ ├── my_app │ │ │ └── people.md │ │ │ ├── overwrite-no │ │ │ └── new.md │ │ │ ├── overwrite-yes │ │ │ └── new.md │ │ │ ├── positional-name │ │ │ └── acmecorp │ │ │ │ └── always.txt │ │ │ ├── recursive-prompt │ │ │ └── new.md │ │ │ └── setup-new-project │ │ │ └── test1.txt │ ├── params.spec.ts │ └── render.spec.ts ├── bin.timed.ts ├── bin.ts ├── config-resolver.ts ├── config.ts ├── context.ts ├── engine.ts ├── execute.ts ├── help.ts ├── helpers.ts ├── index.ts ├── logger.ts ├── newline.ts ├── ops │ ├── add.ts │ ├── echo.ts │ ├── index.ts │ ├── inject.ts │ ├── injector.ts │ ├── result.ts │ ├── setup.ts │ └── shell.ts ├── params.ts ├── prompt.ts ├── render.ts ├── templates │ └── init │ │ ├── repo │ │ └── new-repo.ejs.t │ │ └── self │ │ ├── new-generator-help.ejs.t │ │ ├── new-generator-with-prompt.ejs.t │ │ ├── new-generator-with-prompt.prompt.ejs.t │ │ ├── new-generator.ejs.t │ │ └── new-repo.ejs.t └── types.ts ├── tsconfig.json └── yarn.lock /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require('stylomatic/eslint-preset') 2 | -------------------------------------------------------------------------------- /.github/workflows/cd.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | # secrets setup: 4 | # - NODE_AUTH_TOKEN: ${{secrets.npm_token}} 5 | # - GITHUB_TOKEN (inherent in the CI and no need to set up, used by standalone.js + gh releaser) 6 | 7 | on: 8 | push: 9 | tags: 10 | - 'v[0-9]+.[0-9]+.[0-9]+' 11 | 12 | jobs: 13 | build-before-publish: 14 | uses: ./.github/workflows/ci.yml 15 | publish: 16 | needs: build-before-publish 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v2 20 | - name: Use Node.js 21 | uses: actions/setup-node@v2 22 | with: 23 | node-version: 17.x 24 | cache: 'yarn' 25 | registry-url: 'https://registry.npmjs.org' 26 | - run: yarn install 27 | - run: yarn build 28 | - run: yarn hygen:build -- init self # smoke test the built bundle 29 | - run: npm publish # add the package to npm 30 | env: 31 | NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} 32 | - run: yarn standalone # creates binaries 33 | - name: Github Release # adds the binaries to github release 34 | uses: softprops/action-gh-release@v1 35 | with: 36 | files: "standalone/*" 37 | - name: Extract version 38 | id: extract-version 39 | run: | 40 | printf "::set-output name=%s::%s\n" tag-name "${GITHUB_REF#refs/tags/}" 41 | - uses: mislav/bump-homebrew-formula-action@v1 42 | with: 43 | formula-path: hygen.rb 44 | homebrew-tap: jondot/homebrew-tap 45 | download-url: "https://github.com/jondot/hygen/releases/download/${{ steps.extract-version.outputs.tag-name }}/hygen.macos.${{ steps.extract-version.outputs.tag-name }}.tar.gz" 46 | commit-message: updating formula for Hygen 47 | env: 48 | COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} 49 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | tags-ignore: 8 | - 'v[0-9]+.[0-9]+.[0-9]+' # these will trigger this w/ workflow_call 9 | - 'docs-[0-9]+' 10 | pull_request: 11 | schedule: 12 | - cron: '0 14 3 * *' # Monthly at 2pm on the 3rd 13 | 14 | workflow_call: 15 | 16 | jobs: 17 | build: 18 | runs-on: ${{matrix.os}} 19 | strategy: 20 | matrix: 21 | node-version: [14.x, 17.x] 22 | os: [ubuntu-latest, windows-latest] 23 | steps: 24 | - name: Set git to use LF 25 | run: | 26 | git config --global core.autocrlf false 27 | git config --global core.eol lf 28 | if: matrix.os == 'windows-latest' 29 | 30 | - uses: actions/checkout@v2 31 | - name: Use Node.js ${{ matrix.node-version }} 32 | uses: actions/setup-node@v2 33 | with: 34 | node-version: ${{ matrix.node-version }} 35 | cache: 'yarn' 36 | - run: yarn install 37 | - run: yarn build 38 | - run: yarn hygen:build -- init self 39 | 40 | - run: yarn test 41 | if: matrix.os == 'ubuntu-latest' 42 | - run: yarn test:win32 43 | if: matrix.os == 'windows-latest' 44 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Docs 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'docs-[0-9]+' 7 | 8 | jobs: 9 | publish-docs: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Use Node.js 14 | uses: actions/setup-node@v2 15 | with: 16 | node-version: 16.x 17 | cache: 'yarn' 18 | - run: yarn install 19 | - run: yarn docs:prepare && yarn docs:build 20 | - name: deploy docs 21 | uses: JamesIves/github-pages-deploy-action@v4.2.5 22 | with: 23 | branch: gh-pages 24 | folder: hygen.io/build 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | npm-debug.log 4 | /app/ 5 | .tool-versions 6 | .vscode/ 7 | .idea/ 8 | flow-typed/ 9 | src/__tests__/metaverse/**/given/ 10 | _book 11 | yarn-error.log 12 | standalone/ 13 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | examples/ 3 | .babelrc 4 | .eslintrc 5 | _book/ 6 | media/ 7 | app/ 8 | docs/ 9 | __tests__/ 10 | .tool-versions 11 | hygen.io/ 12 | src/__tests__/ 13 | content/ 14 | .github/ 15 | lib/ 16 | _templates/ 17 | scripts/ 18 | standalone/ 19 | yarn-error.log 20 | .tool-versions-e 21 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "trailingComma": "all" 5 | } 6 | -------------------------------------------------------------------------------- /.tool-versions-e: -------------------------------------------------------------------------------- 1 | nodejs 7.7.2 2 | ruby 2.5.0 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [6.2.11](https://github.com/jondot/hygen/compare/v6.2.10...v6.2.11) (2022-09-07) 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-present, Dotan Nahum. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /dist/bin.d.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | export {}; 3 | //# sourceMappingURL=bin.d.ts.map -------------------------------------------------------------------------------- /dist/bin.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | "use strict"; 3 | var __importDefault = (this && this.__importDefault) || function (mod) { 4 | return (mod && mod.__esModule) ? mod : { "default": mod }; 5 | }; 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | const path_1 = __importDefault(require("path")); 8 | const logger_1 = __importDefault(require("./logger")); 9 | const index_1 = require("./index"); 10 | const defaultTemplates = path_1.default.join(__dirname, '../src/templates'); 11 | (0, index_1.runner)(process.argv.slice(2), { 12 | templates: defaultTemplates, 13 | cwd: process.cwd(), 14 | logger: new logger_1.default(console.log.bind(console)), 15 | debug: !!process.env.DEBUG, 16 | exec: (action, body) => { 17 | const opts = body && body.length > 0 ? { input: body } : {}; 18 | return require('execa').command(action, Object.assign(Object.assign({}, opts), { shell: true })); // eslint-disable-line @typescript-eslint/no-var-requires 19 | }, 20 | createPrompter: () => require('enquirer'), 21 | }).then(({ success }) => process.exit(success ? 0 : 1)); 22 | -------------------------------------------------------------------------------- /dist/bin.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;;;;AAEA,gDAAuB;AACvB,sDAA6B;AAC7B,mCAAgC;AAEhC,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAA;AACjE,IAAA,cAAM,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC5B,SAAS,EAAE,gBAAgB;IAC3B,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,MAAM,EAAE,IAAI,gBAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK;IAC1B,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAC3D,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,kCAAO,IAAI,KAAE,KAAK,EAAE,IAAI,IAAG,CAAA;IACnE,CAAC;IACD,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;CAC1C,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /dist/bin.timed.d.ts: -------------------------------------------------------------------------------- 1 | //# sourceMappingURL=bin.timed.d.ts.map -------------------------------------------------------------------------------- /dist/bin.timed.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"bin.timed.d.ts","sourceRoot":"","sources":["../src/bin.timed.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /dist/bin.timed.js: -------------------------------------------------------------------------------- 1 | // this require is used in dev only anyways 2 | require('time-require'); 3 | require('./bin'); 4 | -------------------------------------------------------------------------------- /dist/bin.timed.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"bin.timed.js","sourceRoot":"","sources":["../src/bin.timed.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,2BAA2B;AAC3B,OAAO,CAAC,cAAc,CAAC,CAAA;AAEvB,OAAO,CAAC,OAAO,CAAC,CAAA"} -------------------------------------------------------------------------------- /dist/config-resolver.d.ts: -------------------------------------------------------------------------------- 1 | import type { RunnerConfig } from './types'; 2 | declare const _default: (config: RunnerConfig) => Promise; 3 | export default _default; 4 | //# sourceMappingURL=config-resolver.d.ts.map -------------------------------------------------------------------------------- /dist/config-resolver.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"config-resolver.d.ts","sourceRoot":"","sources":["../src/config-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;iCAsBb,YAAY,KAAG,QAAQ,YAAY,CAAC;AAAlE,wBAUC"} -------------------------------------------------------------------------------- /dist/config-resolver.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"config-resolver.js","sourceRoot":"","sources":["../src/config-resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gDAAuB;AACvB,wDAAyB;AAEzB,qCAAyC;AAEzC,MAAM,cAAc,GAAG,IAAI,uBAAc,CAAC,WAAW,EAAE;IACrD,MAAM,EAAE,kBAAE,CAAC,MAAM;IACjB,aAAa;IACb,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;CAChB,CAAC,CAAA;AAEF,kBAAe,CAAO,MAAoB,EAAyB,EAAE;IACnE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,CAAA;IAEjC,MAAM,iBAAiB,GACrB,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAC1D,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,kBAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAC3B,IAAI,SAAS,CAAA;IAEhB,qDACK,MAAM,KACT,SAAS,EAAE,iBAAiB,KACzB,CAAC,MAAM,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EACvC;AACH,CAAC,CAAA,CAAA"} -------------------------------------------------------------------------------- /dist/config.d.ts: -------------------------------------------------------------------------------- 1 | import type { ResolverIO } from './types'; 2 | declare const reversePathsToWalk: ({ folder, path }: { 3 | folder: any; 4 | path: any; 5 | }) => any; 6 | declare const configLookup: (file: string, folder: string, path?: any) => any; 7 | declare class ConfigResolver { 8 | configFile: string; 9 | io: ResolverIO; 10 | constructor(configFile: string, io: ResolverIO); 11 | resolve(from: string): Promise>; 12 | } 13 | export { configLookup, ConfigResolver, reversePathsToWalk }; 14 | //# sourceMappingURL=config.d.ts.map -------------------------------------------------------------------------------- /dist/config.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIzC,QAAA,MAAM,kBAAkB;;;SAQvB,CAAA;AAED,QAAA,MAAM,YAAY,SAAU,MAAM,UAAU,MAAM,SAAQ,GAAG,QACc,CAAA;AAE3E,cAAM,cAAc;IAClB,UAAU,EAAE,MAAM,CAAA;IAElB,EAAE,EAAE,UAAU,CAAA;gBAEF,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU;IAKxC,OAAO,CAAC,IAAI,EAAE,MAAM;CAU3B;AAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAA"} -------------------------------------------------------------------------------- /dist/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | exports.reversePathsToWalk = exports.ConfigResolver = exports.configLookup = void 0; 16 | const path_1 = __importDefault(require("path")); 17 | // inline fp methods due to perf 18 | const uniq = (arr) => arr.filter((elem, pos, a) => a.indexOf(elem) === pos); 19 | const reversePathsToWalk = ({ folder, path }) => { 20 | const resolved = path.resolve(folder); 21 | const parts = resolved.split(path.sep); 22 | const results = parts.map((_, idx, arr) => arr.slice(0, idx + 1).join(path.sep)); 23 | results[0] = results[0] || '/'; 24 | return results.reverse(); 25 | }; 26 | exports.reversePathsToWalk = reversePathsToWalk; 27 | const configLookup = (file, folder, path = path_1.default) => uniq(reversePathsToWalk({ folder, path }).map((p) => path.join(p, file))); 28 | exports.configLookup = configLookup; 29 | class ConfigResolver { 30 | constructor(configFile, io) { 31 | this.configFile = configFile; 32 | this.io = io; 33 | } 34 | resolve(from) { 35 | return __awaiter(this, void 0, void 0, function* () { 36 | const configCandidates = configLookup(this.configFile, from); 37 | const { exists, load, none } = this.io; 38 | for (const candidate of configCandidates) { 39 | if (yield exists(candidate)) { 40 | return load(candidate); 41 | } 42 | } 43 | return none(from); 44 | }); 45 | } 46 | } 47 | exports.ConfigResolver = ConfigResolver; 48 | -------------------------------------------------------------------------------- /dist/config.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA+B;AAG/B,gCAAgC;AAChC,MAAM,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,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AA;YACtC,KAAK,MAAM,SAAS,IAAI,gBAAgB,EAAE;gBACxC,IAAI,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE;oBAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAA;iBACvB;aACF;YACD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAA;QACnB,CAAC;KAAA;CACF;AAEsB,wCAAc"} -------------------------------------------------------------------------------- /dist/context.d.ts: -------------------------------------------------------------------------------- 1 | import type { RunnerConfig } from './types'; 2 | declare const context: (locals: any, config?: RunnerConfig) => any; 3 | export default context; 4 | //# sourceMappingURL=context.d.ts.map -------------------------------------------------------------------------------- /dist/context.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA6B3C,QAAA,MAAM,OAAO,WAAY,GAAG,WAAU,YAAY,QAmBjD,CAAA;AAED,eAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/context.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | const helpers_1 = __importDefault(require("./helpers")); 7 | const localsToCapitalize = ['name']; 8 | const localsToPluralize = ['name']; 9 | const localsDefaults = { 10 | name: 'unnamed', 11 | }; 12 | const processLocals = (hsh, [key, value]) => { 13 | hsh[key] = value; 14 | if (localsToCapitalize.includes(key)) { 15 | hsh[helpers_1.default.capitalize(key)] = helpers_1.default.capitalize(value); 16 | } 17 | if (localsToPluralize.includes(key)) { 18 | hsh[helpers_1.default.inflection.pluralize(key)] = helpers_1.default.inflection.pluralize(value); 19 | hsh[helpers_1.default.capitalize(helpers_1.default.inflection.pluralize(key))] = helpers_1.default.capitalize(helpers_1.default.inflection.pluralize(value)); 20 | } 21 | return hsh; 22 | }; 23 | const processedLocals = (locals) => Object.entries(locals).reduce(processLocals, {}); 24 | const context = (locals, config = {}) => { 25 | const localsWithDefaults = Object.assign(Object.assign(Object.assign({}, localsDefaults), config.localsDefaults), locals); 26 | const configHelpers = (config && 27 | (typeof config.helpers === 'function' 28 | ? config.helpers(locals, config) 29 | : config.helpers)) || 30 | {}; 31 | return Object.assign(localsWithDefaults, processedLocals(localsWithDefaults), { 32 | h: Object.assign(Object.assign({}, helpers_1.default), configHelpers), 33 | }); 34 | }; 35 | exports.default = context; 36 | -------------------------------------------------------------------------------- /dist/context.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;AACA,wDAA+B;AAE/B,MAAM,kBAAkB,GAAG,CAAC,MAAM,CAAC,CAAA;AACnC,MAAM,cAAc,GAAG;IACrB,IAAI,EAAE,SAAS;CAChB,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IAC7C,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IAEhB,IAAI,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC;QAClC,GAAG,CAAC,iBAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,iBAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAE1D,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,CAAC,MAAW,EAAE,EAAE,CACxC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;AAErD,MAAM,OAAO,GAAG,CAAC,MAAW,EAAE,SAAuB,EAAE,EAAE,EAAE;IACzD,MAAM,kBAAkB,iDACnB,cAAc,GACd,MAAM,CAAC,cAAc,GACrB,MAAM,CACV,CAAA;IACD,MAAM,aAAa,GACjB,CAAC,MAAM;QACL,CAAC,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU;YACnC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC;YAChC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtB,EAAE,CAAA;IACJ,OAAO,MAAM,CAAC,MAAM,CAClB,kBAAkB,EAClB,iBAAiB,CAAC,kBAAkB,CAAC,EACrC;QACE,CAAC,kCAAO,iBAAO,GAAK,aAAa,CAAE;KACpC,CACF,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/engine.d.ts: -------------------------------------------------------------------------------- 1 | import type { ActionResult, RunnerConfig } from './types'; 2 | declare class ShowHelpError extends Error { 3 | constructor(message: string); 4 | } 5 | declare const engine: (argv: string[], config: RunnerConfig) => Promise; 6 | export { ShowHelpError }; 7 | export default engine; 8 | //# sourceMappingURL=engine.d.ts.map -------------------------------------------------------------------------------- /dist/engine.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD,cAAM,aAAc,SAAQ,KAAK;gBACnB,OAAO,EAAE,MAAM;CAI5B;AAED,QAAA,MAAM,MAAM,SACJ,MAAM,EAAE,UACN,YAAY,KACnB,QAAQ,YAAY,EAAE,CA0CxB,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA;AACxB,eAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/engine.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAyB;AAEzB,sDAA6B;AAE7B,MAAM,aAAc,SAAQ,KAAK;IAC/B,YAAY,OAAe;QACzB,KAAK,CAA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AS;;;OAGzC,CAAC,CAAA;KACL;IAED,2DAA2D;IAC3D,6DAA6D;IAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAA;IAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAA;IAC1C,OAAO,OAAO,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAC1D,CAAC,CAAA,CAAA;AAGD,kBAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/execute.d.ts: -------------------------------------------------------------------------------- 1 | import type { ActionResult, RenderedAction, RunnerConfig } from './types'; 2 | declare const execute: (renderedActions: RenderedAction[], args: any, config: RunnerConfig) => Promise; 3 | export default execute; 4 | //# sourceMappingURL=execute.d.ts.map -------------------------------------------------------------------------------- /dist/execute.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzE,QAAA,MAAM,OAAO,oBACM,cAAc,EAAE,QAC3B,GAAG,UACD,YAAY,KACnB,QAAQ,YAAY,EAAE,CAsBxB,CAAA;AAED,eAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/execute.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const debug_1 = __importDefault(require("debug")); 16 | const ops_1 = __importDefault(require("./ops")); 17 | const debug = (0, debug_1.default)('hygen:execute'); 18 | const execute = (renderedActions, args, config) => __awaiter(void 0, void 0, void 0, function* () { 19 | const { logger } = config; 20 | const messages = []; 21 | const results = []; 22 | for (const action of renderedActions) { 23 | const { message } = action.attributes; 24 | if (message) { 25 | messages.push(message); 26 | } 27 | const ops = yield (0, ops_1.default)(action.attributes); 28 | debug('executing %o ops', ops.length); 29 | for (const op of ops) { 30 | debug('executing: %o', op); 31 | results.push(yield op(action, args, config)); 32 | } 33 | debug('executing ops: done'); 34 | } 35 | if (messages.length > 0) { 36 | logger.colorful(`${args.action}:\n${messages.join('\n')}`); 37 | } 38 | return results; 39 | }); 40 | exports.default = execute; 41 | -------------------------------------------------------------------------------- /dist/execute.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"execute.js","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gDAA2B;AAG3B,MAAM,OAAO,GAAG,CACd,eAAiC,EACjC,IAAS,EACT,MAAoB,EACK,EAAE;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IACzB,MAAM,QAAQ,GAAG,EAAE,CAAA;IACnB,MAAM,OAAO,GAAG,EAAE,CAAA;IAClB,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;QACpC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAA;QACrC,IAAI,OAAO,EAAE;YACX,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SACvB;QACD,MAAM,GAAG,GAAG,IAAA,aAAO,EAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QACtC,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE;YACpB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;SAC7C;KACF;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;KAC3D;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA,CAAA;AAED,kBAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/help.d.ts: -------------------------------------------------------------------------------- 1 | import type { Logger } from './types'; 2 | declare const VERSION: any; 3 | declare const availableActions: (templates: string) => {}; 4 | declare const printHelp: (templates: string, logger: Logger) => void; 5 | export { availableActions, printHelp, VERSION }; 6 | //# sourceMappingURL=help.d.ts.map -------------------------------------------------------------------------------- /dist/help.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIrC,QAAA,MAAM,OAAO,KAAc,CAAA;AAE3B,QAAA,MAAM,gBAAgB,cAAe,MAAM,OAS1C,CAAA;AAED,QAAA,MAAM,SAAS,cAAe,MAAM,UAAU,MAAM,SAmCnD,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA"} -------------------------------------------------------------------------------- /dist/help.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | exports.VERSION = exports.printHelp = exports.availableActions = void 0; 7 | const fs_1 = __importDefault(require("fs")); 8 | const path_1 = __importDefault(require("path")); 9 | const chalk_1 = __importDefault(require("chalk")); 10 | const params_1 = require("./params"); 11 | const pkg = require('../package.json'); // eslint-disable-line @typescript-eslint/no-var-requires 12 | const VERSION = pkg.version; 13 | exports.VERSION = VERSION; 14 | const availableActions = (templates) => { 15 | const generators = fs_1.default 16 | .readdirSync(templates) 17 | .filter((_) => fs_1.default.lstatSync(path_1.default.join(templates, _)).isDirectory()); 18 | return generators.reduce((acc, generator) => { 19 | const actions = fs_1.default.readdirSync(path_1.default.join(templates, generator)); 20 | acc[generator] = actions; 21 | return acc; 22 | }, {}); 23 | }; 24 | exports.availableActions = availableActions; 25 | const printHelp = (templates, logger) => { 26 | logger.log(`Hygen v${VERSION}`); 27 | logger.log('\nAvailable actions:'); 28 | if (!templates) { 29 | logger.log(`No generators or actions found. 30 | 31 | This means I didn't find a _templates folder right here, 32 | or anywhere up the folder tree starting here. 33 | 34 | Here's how to start using Hygen: 35 | 36 | $ hygen init self 37 | $ hygen with-prompt new --name my-generator 38 | 39 | (edit your generator in _templates/my-generator) 40 | 41 | $ hygen my-generator 42 | 43 | See https://hygen.io for more. 44 | 45 | `); 46 | return; 47 | } 48 | Object.entries(availableActions(templates)).forEach(([k, v]) => { 49 | logger.log(`${chalk_1.default.bold(k)}: ${v.find((a) => a === params_1.DEFAULT_ACTION) 50 | ? `${k}${v.length > 1 ? ',' : ''} ` 51 | : ''}${v 52 | .filter((a) => a !== params_1.DEFAULT_ACTION) 53 | .map((a) => `${k} ${a}`) 54 | .join(', ')}`); 55 | }); 56 | }; 57 | exports.printHelp = printHelp; 58 | -------------------------------------------------------------------------------- /dist/help.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";;;;;;AACA,4CAAmB;AACnB,gDAAuB;AACvB,kDAAyB;AACzB,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAEtC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAA;AA0CW,0BAAO;AA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ers.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import path from 'path'; 3 | import changeCase from 'change-case'; 4 | declare const helpers: { 5 | capitalize(str: any): string; 6 | inflection: any; 7 | changeCase: typeof changeCase; 8 | path: path.PlatformPath; 9 | }; 10 | export default helpers; 11 | //# sourceMappingURL=helpers.d.ts.map -------------------------------------------------------------------------------- /dist/helpers.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,UAAU,MAAM,aAAa,CAAA;AASpC,QAAA,MAAM,OAAO;;;;;CAQZ,CAAA;AAED,eAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/helpers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | const path_1 = __importDefault(require("path")); 7 | const inflection_1 = __importDefault(require("inflection")); 8 | const change_case_1 = __importDefault(require("change-case")); 9 | // supports kebab-case to KebabCase 10 | inflection_1.default.undasherize = (str) => str 11 | .split(/[-_]/) 12 | .map((w) => w[0].toUpperCase() + w.slice(1).toLowerCase()) 13 | .join(''); 14 | const helpers = { 15 | capitalize(str) { 16 | const toBeCapitalized = String(str); 17 | return toBeCapitalized.charAt(0).toUpperCase() + toBeCapitalized.slice(1); 18 | }, 19 | inflection: inflection_1.default, 20 | changeCase: change_case_1.default, 21 | path: path_1.default, 22 | }; 23 | exports.default = helpers; 24 | -------------------------------------------------------------------------------- /dist/helpers.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;AAAA,4DAAmC;AACnC,8DAAoC;AACpC,gDAAuB;AAEvB,mCAAmC;AACnC,oBAAU,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,EAAE,CAC/B,GAAG;KACA,KAAK,CAAC,MAAM,CAAC;KACb,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;KACzD,IAAI,CAAC,EAAE,CAAC,CAAA;AAEb,MAAM,OAAO,GAAG;IACd,UAAU,CAAC,GAAG;QACZ,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACnC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC3E,CAAC;IACD,UAAU,EAAV,oBAAU;IACV,UAAU,EAAV,qBAAU;IACV,IAAI,EAAJ,cAAI;CACL,CAAA;AAED,kBAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import type { RunnerConfig, RunnerResult } from './types'; 2 | import resolve from './config-resolver'; 3 | import Logger from './logger'; 4 | import engine from './engine'; 5 | import { VERSION, availableActions, printHelp } from './help'; 6 | declare const runner: (argv: string[], config: RunnerConfig) => Promise; 7 | export { runner, engine, resolve, printHelp, availableActions, Logger, VERSION }; 8 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /dist/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,OAAO,MAAM,mBAAmB,CAAA;AACvC,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,MAAyB,MAAM,UAAU,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE7D,QAAA,MAAM,MAAM,SACJ,MAAM,EAAE,UACN,YAAY,KACnB,QAAQ,YAAY,CAkBtB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA"} -------------------------------------------------------------------------------- /dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wEAAuC;AA6Bd,kBA7BlB,yBAAO,CA6BkB;AA5BhC,sDAA6B;AA4BkC,iBA5BxD,gBAAM,CA4BwD;AA3BrE,mDAAgD;AA2B/B,iBA3BV,gBAAM,CA2BU;AAzBvB,iCAA6D;AAyB3B,0FAzBzB,gBAAS,OAyByB;AAAE,iGAzBzB,uBAAgB,OAyByB;AAAU,wFAzBjC,cAAO,OAyBiC;AAvB9E,MAAM,MAAM,GAAG,CACb,IAAc,EACd,MAAoB,EACG,EAAE;IACzB,MAAM,cAAc,GAAG,MAAM,IAAA,yBAAO,EAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,cAAc,CAAA;IAC5C,IAAI;QACF,MAAM,OAAO,GAAG,MAAM,IAAA,gBAAM,EAAC,IAAI,EAAE,cAAc,CAAC,CAAA;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;KAC3C;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC1B,IAAI,cAAc,CAAC,KAAK,EAAE;YACxB,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;YACjC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YACrB,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;SAClC;QACD,IAAI,GAAG,YAAY,sBAAa,EAAE;YAChC,IAAA,gBAAS,EAAC,SAAS,EAAE,MAAM,CAAC,CAAA;SAC7B;QACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;KAChD;AACH,CAAC,CAAA,CAAA;AAEQ,wBAAM"} -------------------------------------------------------------------------------- /dist/logger.d.ts: -------------------------------------------------------------------------------- 1 | declare class Logger { 2 | log: (message?: any, ...optionalParams: any[]) => void; 3 | constructor(log: any); 4 | colorful(msg: any): void; 5 | notice(msg: any): void; 6 | warn(msg: any): void; 7 | err(msg: any): void; 8 | ok(msg: any): void; 9 | } 10 | export default Logger; 11 | //# sourceMappingURL=logger.d.ts.map -------------------------------------------------------------------------------- /dist/logger.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAKA,cAAM,MAAM;IACV,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;gBAE1C,GAAG,KAAA;IAIf,QAAQ,CAAC,GAAG,KAAA;IAIZ,MAAM,CAAC,GAAG,KAAA;IAIV,IAAI,CAAC,GAAG,KAAA;IAIR,GAAG,CAAC,GAAG,KAAA;IAIP,EAAE,CAAC,GAAG,KAAA;CAGP;AACD,eAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/logger.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | const chalk_1 = __importDefault(require("chalk")); 7 | // chalk 4.1.2 doesn't type template property 8 | const { yellow, red, green, magenta, template } = chalk_1.default; 9 | class Logger { 10 | constructor(log) { 11 | this.log = log; 12 | } 13 | colorful(msg) { 14 | this.log(template(chalk_1.default, msg)); 15 | } 16 | notice(msg) { 17 | this.log(magenta(msg)); 18 | } 19 | warn(msg) { 20 | this.log(yellow(msg)); 21 | } 22 | err(msg) { 23 | this.log(red(msg)); 24 | } 25 | ok(msg) { 26 | this.log(green(msg)); 27 | } 28 | } 29 | exports.default = Logger; 30 | -------------------------------------------------------------------------------- /dist/logger.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAE9B,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;AAEvD,MAAM,MAAM;IAGV,YAAY,GAAG;QACb,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,QAAQ,CAAC,GAAG;QACV,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;IAChC,CAAC;IAED,MAAM,CAAC,GAAG;QACR,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IACxB,CAAC;IAED,IAAI,CAAC,GAAG;QACN,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,GAAG,CAAC,GAAG;QACL,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACpB,CAAC;IAED,EAAE,CAAC,GAAG;QACJ,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IACtB,CAAC;CACF;AACD,kBAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/newline.d.ts: -------------------------------------------------------------------------------- 1 | declare const newline: (string: any) => string; 2 | export default newline; 3 | //# sourceMappingURL=newline.d.ts.map -------------------------------------------------------------------------------- /dist/newline.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"newline.d.ts","sourceRoot":"","sources":["../src/newline.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,OAAO,yBAWZ,CAAA;AAED,eAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/newline.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const os_1 = require("os"); 4 | const newline = (string) => { 5 | const newlines = string.match(/(?:\r?\n)/g) || []; 6 | if (newlines.length === 0) { 7 | return os_1.EOL; 8 | } 9 | const crlf = newlines.filter((newline) => newline === '\r\n').length; 10 | const lf = newlines.length - crlf; 11 | return crlf > lf ? '\r\n' : '\n'; 12 | }; 13 | exports.default = newline; 14 | -------------------------------------------------------------------------------- /dist/newline.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"newline.js","sourceRoot":"","sources":["../src/newline.ts"],"names":[],"mappings":";;AAAA,2BAAwB;AACxB,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE;IACxB,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAElD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,OAAO,QAAG,CAAA;KACV;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IACnE,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IAElC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAClC,CAAC,CAAC;AAGF,kBAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/ops/add.d.ts: -------------------------------------------------------------------------------- 1 | import type { ActionResult, RenderedAction, RunnerConfig } from '../types'; 2 | declare const add: (action: RenderedAction, args: any, { logger, cwd, createPrompter }: RunnerConfig) => Promise; 3 | export default add; 4 | //# sourceMappingURL=add.d.ts.map -------------------------------------------------------------------------------- /dist/ops/add.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/ops/add.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAG1E,QAAA,MAAM,GAAG,WACC,cAAc,QAChB,GAAG,mCACwB,YAAY,KAC5C,QAAQ,YAAY,CAsDtB,CAAA;AAED,eAAe,GAAG,CAAA"} -------------------------------------------------------------------------------- /dist/ops/add.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/ops/add.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,sDAAmC;AAEnC,gDAAuB;AACvB,wDAAyB;AACzB,iCAA2B;AAE3B,MAAM,GAAG,GAAG,CACV,MAAsB,EACtB,IAAS,EACT,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAgB,EACtB,EAAE;IACzB,MAAM,EACJ,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAChE,GAAG,MAAM,CAAA;IACV,MAAM,MAAM,GAAG,IAAA,gBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACtC,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAA;IACjC,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE;QACjB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAA;KACzB;IACD,MAAM,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACnC,MAAM,kBAAkB,GAAG,CAAC,KAAK;Q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C,KAAK,CAAC,CAAC,CAAA;QACvC,MAAM,kBAAE,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;KACvC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAChE,MAAM,CAAC,EAAE,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC,CAAA;IAE/D,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;AACxB,CAAC,CAAA,CAAA;AAED,kBAAe,GAAG,CAAA"} -------------------------------------------------------------------------------- /dist/ops/echo.d.ts: -------------------------------------------------------------------------------- 1 | import { ActionResult } from '../types'; 2 | declare const echo: ({ attributes: { echo } }: { 3 | attributes: { 4 | echo: any; 5 | }; 6 | }, _args: any, { logger }: { 7 | logger: any; 8 | }) => Promise; 9 | export default echo; 10 | //# sourceMappingURL=echo.d.ts.map -------------------------------------------------------------------------------- /dist/ops/echo.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../src/ops/echo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAIvC,QAAA,MAAM,IAAI;;;;UAEF,GAAG;;MAER,QAAQ,YAAY,CAOtB,CAAA;AAED,eAAe,IAAI,CAAA"} -------------------------------------------------------------------------------- /dist/ops/echo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const result_1 = __importDefault(require("./result")); 16 | const notEmpty = x => x && x.length > 0; 17 | const echo = ({ attributes: { echo } }, _args, { logger }) => __awaiter(void 0, void 0, void 0, function* () { 18 | const result = (0, result_1.default)('shell', echo); 19 | if (notEmpty(echo)) { 20 | logger.colorful(echo); 21 | return result('executed'); 22 | } 23 | return result('ignored'); 24 | }); 25 | exports.default = echo; 26 | -------------------------------------------------------------------------------- /dist/ops/index.d.ts: -------------------------------------------------------------------------------- 1 | declare const resolve: (attributes: any) => Promise; 2 | export default resolve; 3 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /dist/ops/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ops/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,qCAuBZ,CAAA;AACD,eAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/ops/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ops/index.ts"],"names":[],"mappings":";;AAAA,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE;IAC3B,MAAM,GAAG,GAAG,EAAE,CAAA;IACd,IAAI,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;QACvC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAA;QACpC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACd;IACD,IAAI,UAAU,CAAC,EAAE,IAAI,UAAU,CAAC,MAAM,EAAE;QACtC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAA;QAC1C,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;KACjB;IACD,IAAI,UAAU,CAAC,EAAE,EAAE;QACjB,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAA;QACxC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;KAChB;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AACD,kBAAe,OAAO,CAAA"} -------------------------------------------------------------------------------- /dist/ops/inject.d.ts: -------------------------------------------------------------------------------- 1 | import type { ActionResult, RenderedAction, RunnerConfig } from '../types'; 2 | declare const injectOp: (action: RenderedAction, args: any, { logger, cwd }: RunnerConfig) => Promise; 3 | export default injectOp; 4 | //# sourceMappingURL=inject.d.ts.map -------------------------------------------------------------------------------- /dist/ops/inject.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../../src/ops/inject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAI1E,QAAA,MAAM,QAAQ,WACJ,cAAc,QAChB,GAAG,mBACQ,YAAY,KAC5B,QAAQ,YAAY,CA8BtB,CAAA;AAED,eAAe,QAAQ,CAAA"} -------------------------------------------------------------------------------- /dist/ops/inject.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const path_1 = __importDefault(require("path")); 16 | const fs_extra_1 = __importDefault(require("fs-extra")); 17 | const result_1 = __importDefault(require("./result")); 18 | const injector_1 = __importDefault(require("./injector")); 19 | const injectOp = (action, args, { logger, cwd }) => __awaiter(void 0, void 0, void 0, function* () { 20 | const { attributes: { to, inject }, } = action; 21 | const result = (0, result_1.default)('inject', to); 22 | if (!(inject && to)) { 23 | return result('ignored'); 24 | } 25 | const absTo = path_1.default.resolve(cwd, to); 26 | if (!(yield fs_extra_1.default.exists(absTo))) { 27 | logger.err(`Cannot inject to ${to}: doesn't exist.`); 28 | return result('error', { 29 | error: `Cannot inject to ${to}: doesn't exist.`, 30 | }); 31 | } 32 | const content = (yield fs_extra_1.default.readFile(absTo)).toString(); 33 | const injectResult = (0, injector_1.default)(action, content); 34 | if (!args.dry) { 35 | yield fs_extra_1.default.writeFile(absTo, injectResult); 36 | } 37 | const pathToLog = process.env.HYGEN_OUTPUT_ABS_PATH ? absTo : to; 38 | logger.notice(` inject: ${pathToLog}`); 39 | return result('inject'); 40 | }); 41 | exports.default = injectOp; 42 | -------------------------------------------------------------------------------- /dist/ops/inject.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/ops/inject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wDAAyB;AACzB,gDAAuB;AAEvB,sDAAmC;AACnC,0DAAiC;AAEjC,MAAM,QAAQ,GAAG,CACf,MAAsB,EACtB,IAAS,EACT,EAAE,MAAM,EAAE,GAAG,EAAgB,EACN,EAAE;IACzB,MAAM,EACJ,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,GAC3B,GAAG,MAAM,CAAA;IAEV,MAAM,MAAM,GAAG,IAAA,gBAAY,EAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IAEzC,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE;QACnB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAA;KACzB;IAED,MAAM,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAEnC,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;QAC7B,MAAM,CAAC,GAAG,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAA;QACpD,OAAO,MAAM,CAAC,OAAO,EAAE;YACrB,KAAK,EAAE,oBAAoB,EAAE,kBAAkB;SAChD,CAAC,CAAA;KACH;IAED,MAAM,OAAO,GAAG,CAAC,MAAM,kBAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IACrD,MAAM,YAAY,GAAG,IAAA,kBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE9C,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;QACb,MAAM,kBAAE,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;KACxC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAChE,MAAM,CAAC,MAAM,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAAA;IAE3C,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAA;AACzB,CAAC,CAAA,CAAA;AAED,kBAAe,QAAQ,CAAA"} -------------------------------------------------------------------------------- /dist/ops/injector.d.ts: -------------------------------------------------------------------------------- 1 | import type { RenderedAction } from '../types'; 2 | declare const injector: (action: RenderedAction, content: string) => string; 3 | export default injector; 4 | //# sourceMappingURL=injector.d.ts.map -------------------------------------------------------------------------------- /dist/ops/injector.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"injector.d.ts","sourceRoot":"","sources":["../../src/ops/injector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AA2C9C,QAAA,MAAM,QAAQ,WAAY,cAAc,WAAW,MAAM,KAAG,MAmC3D,CAAA;AAED,eAAe,QAAQ,CAAA"} -------------------------------------------------------------------------------- /dist/ops/result.d.ts: -------------------------------------------------------------------------------- 1 | declare const _default: (type: any, subject: any, start?: Date) => (status: any, payload?: any, end?: Date) => { 2 | payload: any; 3 | type: any; 4 | subject: any; 5 | status: any; 6 | timing: number; 7 | }; 8 | export default _default; 9 | //# sourceMappingURL=result.d.ts.map -------------------------------------------------------------------------------- /dist/ops/result.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/ops/result.ts"],"names":[],"mappings":";;;;;;;AAAA,wBAUE"} -------------------------------------------------------------------------------- /dist/ops/result.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.default = (type, subject, start = new Date()) => (status, payload = null, end = new Date()) => (Object.assign({ type, 4 | subject, 5 | status, timing: end.getTime() - start.getTime() }, (payload && { payload }))); 6 | -------------------------------------------------------------------------------- /dist/ops/result.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/ops/result.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,GAAG,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CACpD,MAAM,EACN,OAAO,GAAG,IAAI,EACd,GAAG,GAAG,IAAI,IAAI,EAAE,EAChB,EAAE,CAAC,iBACH,IAAI;IACJ,OAAO;IACP,MAAM,EACN,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,IACpC,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC,EAC3B,CAAA"} -------------------------------------------------------------------------------- /dist/ops/setup.d.ts: -------------------------------------------------------------------------------- 1 | import type { ActionResult } from '../types'; 2 | declare const setup: ({ attributes: { setup, mode, verbose, force } }: { 3 | attributes: { 4 | setup: any; 5 | mode: any; 6 | verbose: any; 7 | force: any; 8 | }; 9 | }, args: any, { logger, cwd }: { 10 | logger: any; 11 | cwd: any; 12 | }) => Promise; 13 | export default setup; 14 | //# sourceMappingURL=setup.d.ts.map -------------------------------------------------------------------------------- /dist/ops/setup.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/ops/setup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAkB5C,QAAA,MAAM,KAAK;;;;;;;;;;MAIR,QAAQ,YAAY,CAoCtB,CAAA;AAED,eAAe,KAAK,CAAA"} -------------------------------------------------------------------------------- /dist/ops/shell.d.ts: -------------------------------------------------------------------------------- 1 | import type { ActionResult } from '../types'; 2 | declare const shell: ({ attributes: { sh, spinner, sh_ignore_exit }, body }: { 3 | attributes: { 4 | sh: any; 5 | spinner: any; 6 | sh_ignore_exit: any; 7 | }; 8 | body: any; 9 | }, args: any, { logger, exec }: { 10 | logger: any; 11 | exec: any; 12 | }) => Promise; 13 | export default shell; 14 | //# sourceMappingURL=shell.d.ts.map -------------------------------------------------------------------------------- /dist/ops/shell.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/ops/shell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAK5C,QAAA,MAAM,KAAK;;;;;;;;;;MAIR,QAAQ,YAAY,CAwBtB,CAAA;AAED,eAAe,KAAK,CAAA"} -------------------------------------------------------------------------------- /dist/ops/shell.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const debug_1 = __importDefault(require("debug")); 16 | const ora_1 = __importDefault(require("ora")); 17 | const result_1 = __importDefault(require("./result")); 18 | const debug = (0, debug_1.default)('hygen:ops:shell'); 19 | const notEmpty = (x) => x && x.length > 0; 20 | const shell = ({ attributes: { sh, spinner, sh_ignore_exit }, body }, args, { logger, exec }) => __awaiter(void 0, void 0, void 0, function* () { 21 | const result = (0, result_1.default)('shell', sh); 22 | if (notEmpty(sh)) { 23 | const spin = (0, ora_1.default)(` shell: ${spinner === true ? 'running...' : spinner}`); 24 | if (!args.dry) { 25 | try { 26 | debug('exec %o %o', sh, body); 27 | spinner && spin.start(); 28 | const res = yield exec(sh, body); 29 | debug('result %o', res); 30 | } 31 | catch (error) { 32 | if (sh_ignore_exit !== true) { 33 | logger.err(error.stderr); 34 | process.exit(1); 35 | } 36 | } 37 | finally { 38 | spinner && spin.succeed(); 39 | } 40 | } 41 | logger.ok(` shell: ${sh}`); 42 | return result('executed'); 43 | } 44 | return result('ignored'); 45 | }); 46 | exports.default = shell; 47 | -------------------------------------------------------------------------------- /dist/ops/shell.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/ops/shell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,sDAAmC;AAEnC,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AACvC,MAAM,KAAK,GAAG,CACZ,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAC5B,IAAI,EACJ,EAAE,MAAM,EAAE,IAAI,EAAE,EACO,EAAE;IACzB,MAAM,MAAM,GAAG,IAAA,gBAAY,EAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACxC,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACb,IAAI;gBACF,MAAM,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;aACrB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;gBACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;aAChB;SACF;QACD,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;QAEhC,OAAO,MAAM,CAAC,UAAU,CAAC,CAAA;KAC1B;IACD,OAAO,MAAM,CAAC,SAAS,CAAC,CAAA;AAC1B,CAAC,CAAA,CAAA;AAED,kBAAe,KAAK,CAAA"} -------------------------------------------------------------------------------- /dist/params.d.ts: -------------------------------------------------------------------------------- 1 | import type { ParamsResult, RunnerConfig } from './types'; 2 | export declare const DEFAULT_ACTION = "_default"; 3 | declare const params: ({ templates, createPrompter }: RunnerConfig, externalArgv: string[]) => Promise; 4 | export default params; 5 | //# sourceMappingURL=params.d.ts.map -------------------------------------------------------------------------------- /dist/params.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../src/params.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD,eAAO,MAAM,cAAc,aAAa,CAAA;AAwCxC,QAAA,MAAM,MAAM,kCACqB,YAAY,gBAC7B,MAAM,EAAE,KACrB,QAAQ,YAAY,CAqCtB,CAAA;AAED,eAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/params.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"params.js","sourceRoot":"","sources":["../src/params.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAuB;AACvB,gEAAgC;AAEhC,sDAA6B;AAE7B,MAAM,MAAM,GAAG,CACb,EAAE,SAAS,EAAE,cAAc,EAAgB,EAC3C,YAAsB,EACC,EAAE;IACzB,MAAM,IAAI,GAAG,IAAA,sBAAK,EAAC,YAAY,CAAC,CAAA;IAEhC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE;QACzB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;KACxC;IACD,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAEjD,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;IAEhE,MAAM,EAAE,CAAC,KAAmB,IAAI,EAAlB,SAAS,UAAK,IAAI,EAA1B,KAAmB,CAAO,CAAA;IAChC,MAAM,UAAU,GAAG,MAAM,IAAA,gBAAM,EAAC,cAAc,EAAE,YAAY,kCAGvD,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACtB,SAAS,EACZ,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CACxB;QACE,SAAS;QACT,YAAY;QACZ,SAAS;QACT,MAAM;QACN,SAAS;KACV,EACD,SAAS,EACT,IAAI,IAAI,EAAE,IAAI,EAAE,EAChB,UAAU,CACX,CAAA;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA,CAAA;AAED,kBAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/prompt.d.ts: -------------------------------------------------------------------------------- 1 | import type { Prompter } from './types'; 2 | declare const prompt: (createPrompter: () => Prompter, actionfolder: string, args: Record) => Promise; 3 | export default prompt; 4 | //# sourceMappingURL=prompt.d.ts.map -------------------------------------------------------------------------------- /dist/prompt.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAUvC,QAAA,MAAM,MAAM,6DAEI,MAAM,QACd,OAAO,MAAM,EAAE,GAAG,CAAC,wBA8C1B,CAAA;AAED,eAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/prompt.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,4CAAmB;AAEnB,wDAA+B;AAE/B,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AACtE,MAAM,MAAM,GAAG,CACb,cAAoC,EACpC,YAAoB,EACpB,IAAyB,EACJ,EAAE;IACvB,MAAM,SAAS,GAAG,UAAU;SACzB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;SACpD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAEhC,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;KAC3B;IACD,MAAM,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAEhD,+BAA+B;IAC/B,IAAI,gBAAgB,EAAE;QACpB,OAAO,CAAC,iCAAiC,CAAC,CAAC;KAC5C;IACD,gCAAgC;IAChC,aAAa;IACb,IAAI,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;IACpC,IAAI,gBAAgB,IAAI,WAAW,CAAC,OAAO,EAAE;QAC3C,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC;KACnC;IAED,IAAI,WAAW,CAAC,MAAM,EAAE;QACtB,OAAO,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,iBAAO,EAAE,CAAC,CAAA;KAChD;IAED,sBAAsB;IACtB,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAA;IACjC,IAAI,WAAW,CAAC,MAAM,EAAE;QACtB,OAAO,WAAW,CAAC,MAAM,CAAC;YACxB,QAAQ;YACR,QAAQ,EAAE,QAAQ;YAClB,IAAI;YACJ,CAAC,EAAE,iBAAO;SACX,CAAC,CAAA;KACH;IAED,OAAO,QAAQ,CAAC,MAAM;IACpB,qDAAqD;IACrD,WAAW,CAAC,MAAM,CAChB,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,SAAS;QAC1B,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI;QACrB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAC5B,CACF,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/render.d.ts: -------------------------------------------------------------------------------- 1 | import type { RenderedAction, RunnerConfig } from './types'; 2 | declare const render: (args: any, config: RunnerConfig) => Promise; 3 | export default render; 4 | //# sourceMappingURL=render.d.ts.map -------------------------------------------------------------------------------- /dist/render.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA+B3D,QAAA,MAAM,MAAM,SACJ,GAAG,UACD,YAAY,KACnB,QAAQ,cAAc,EAAE,CA8CtB,CAAA;AAEL,eAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/render.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,wDAAyB;AACzB,8CAAqB;AACrB,gEAA6B;AAC7B,gDAAuB;AACvB,8DAA8B;AAC9B,wDAA+B;AAG/B,gDAAgD;AAChD,mDAAmD;AACnD,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAClC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAExC,MAAM,OAAO,GAAG;IACd,WAAW;IACX,UAAU;IACV,WAAW;IACX,UAAU;IACV,cAAc;IACd,WAAW;IACX,iBAAiB;IACjB,UAAU;IACV,aAAa;IACb,WAAW;CACZ,CAAA;AACD,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAC9C,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAA,iBAAO,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAE7E,SAAe,QAAQ,CAAC,GAAG;;QACzB,MAAM,KAAK,GAAG,qBAAI;aACf,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,cAAc,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,EAAE;QACnB,IAAG,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAA;QAC5D,uBAAS,IAAI,IAAK,IAAA,sBAAE,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,EAAE;IACvD,CAAC,CAAC,CACH;SACA,IAAI,CACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;QACjC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CACrD,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACpB,uCACK,GAAG,KACN,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAC3C;QACH,CAAC,EACD,EAAE,CACH,CAAA;QACD,IAAG,MAAM,CAAC,KAAK;YAAE,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAA;QACvD,OAAO;YACL,IAAI;YACJ,UAAU,EAAE,aAAa;YACzB,IAAI,EAAE,cAAc,CAClB,IAAI,kCACC,IAAI,KAAE,UAAU,EAAE,aAAa,KACpC,MAAM,CACP;SACF,CAAA;IACH,CAAC,CAAC,CACH,CAAA;EAAA,CAAA;AAEL,kBAAe,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/types.d.ts: -------------------------------------------------------------------------------- 1 | export interface Logger { 2 | ok: (msg: string) => void; 3 | notice: (msg: string) => void; 4 | warn: (msg: string) => void; 5 | err: (msg: string) => void; 6 | log: (msg: string) => void; 7 | colorful: (msg: string) => void; 8 | } 9 | export interface Prompter { 10 | prompt: (arg0: Q) => Promise; 11 | } 12 | export interface RenderedAction { 13 | file?: string; 14 | attributes: any; 15 | body: string; 16 | } 17 | export interface RunnerConfig { 18 | exec?: (sh: string, body: string) => void; 19 | templates?: string; 20 | templatesOverride?: string; 21 | cwd?: string; 22 | logger?: Logger; 23 | debug?: boolean; 24 | helpers?: any; 25 | localsDefaults?: any; 26 | createPrompter?: () => Prompter; 27 | } 28 | export interface ResolverIO { 29 | exists: (arg0: string) => Promise; 30 | load: (arg0: string) => Promise>; 31 | none: (arg0: string) => Record; 32 | } 33 | export declare type ActionResult = any; 34 | export interface RunnerResult { 35 | success: boolean; 36 | time: number; 37 | actions: ActionResult[]; 38 | failure?: { 39 | message: string; 40 | availableActions: string[]; 41 | }; 42 | } 43 | export declare type ParamsResult = { 44 | templates: string; 45 | generator: string; 46 | action: string; 47 | subaction?: string; 48 | actionfolder?: string; 49 | name?: string; 50 | dry?: boolean; 51 | } & object; 52 | //# sourceMappingURL=types.d.ts.map -------------------------------------------------------------------------------- /dist/types.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IACzB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAChC;AACD,MAAM,WAAW,QAAQ,CAAC,CAAC,EAAE,CAAC;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CAChC;AACD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IACf,IAAI,EAAE,MAAM,CAAA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CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,OAAO,CAAA;CACd,GAAG,MAAM,CAAA"} -------------------------------------------------------------------------------- /dist/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /dist/types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /hygen.io/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /hygen.io/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. 4 | 5 | ### Installation 6 | 7 | ``` 8 | $ yarn 9 | ``` 10 | 11 | ### Local Development 12 | 13 | ``` 14 | $ yarn start 15 | ``` 16 | 17 | This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. 18 | 19 | ### Build 20 | 21 | ``` 22 | $ yarn build 23 | ``` 24 | 25 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 26 | 27 | ### Deployment 28 | 29 | ``` 30 | $ GIT_USER= USE_SSH=true yarn deploy 31 | ``` 32 | 33 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. 34 | -------------------------------------------------------------------------------- /hygen.io/docs/create.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Create 3 | id: create 4 | --- 5 | 6 | Maintaining code generators over time can be a challenge in some cases. If you have a bug in the generator, you need to modify your templates, run the modified generator, and then manually import your changes back into the templates while remembering to replace keywords with ejs placeholders. 7 | 8 | [`hygen-create`](https://github.com/ronp001/hygen-create) offers an approach to creating new generators: take an existing piece of code and automatically transform it into a generator. 9 | 10 | To create a generator using [`hygen-create`](https://github.com/ronp001/hygen-create): 11 | * Start a [`hygen-create`](https://github.com/ronp001/hygen-create) session 12 | * Select files to include in the generator 13 | * Specify a string to automatically turn into ejs snippets in the resulting templates 14 | * Run [`$ hygen-create generate`](https://github.com/ronp001/hygen-create) 15 | 16 | That's it! Your new `hygen` generator is ready, and you can use it to create new "instances" of the code you generalized. If something's not right, you can fix the problem directly in the generated code, then run [`hygen-create`](https://github.com/ronp001/hygen-create) on the modified code to update the generator with your fix. It even remembers which files were originally included in the generator, so you don't have to select files all over again. 17 | 18 | For more details see [`https://github.com/ronp001/hygen-create`](https://github.com/ronp001/hygen-create) 19 | 20 | 21 | ## Installation 22 | 23 | ```bash 24 | $ yarn global add hygen-create 25 | ``` 26 | or 27 | ```bash 28 | $ npm install --global hygen-create 29 | ``` 30 | 31 | 32 | ## Key Features 33 | 34 | * String variations (UPPERCASED, CamelCased, etc.) are automatically recognized. For example: 35 | ```json 36 | // if the following 'package.json' is used as a generator source 37 | // with 'MyPackage' as the templatization string: 38 | { 39 | "name": "MyPackage", 40 | "index": "my-package/bin/my_package.js" 41 | } 42 | ``` 43 | ```json 44 | // the resulting generator with '--name NewUnit' will create: 45 | { 46 | "name": "NewUnit", 47 | "index": "new-unit/bin/new_unit.js" 48 | } 49 | ``` 50 | * Directory hierarchy is maintained 51 | * Gradually add files to the generator in a git-like fashion 52 | * Review auto-inserted ejs placeholders with a built-in colorized diff 53 | * Iteratively author generators by running [`hygen-create`](https://github.com/ronp001/hygen-create) again on the code created by the generator. 54 | 55 | 56 | ## GitHub Project 57 | 58 | [`https://github.com/ronp001/hygen-create`](https://github.com/ronp001/hygen-create) 59 | -------------------------------------------------------------------------------- /hygen.io/docs/express.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Express 3 | id: express 4 | --- 5 | 6 | [Express.js](https://expressjs.com/) is arguably the most popular web framework for Node.js 7 | 8 | A typical app structure for express celebrates the notion of `routes` and `handlers`, while views and data are left for interpretation (probably because the rise of microservices and client-side apps). 9 | 10 | So an app structure may look like this: 11 | 12 | ``` 13 | app/ 14 | routes.js 15 | handlers/ 16 | health.js 17 | shazam.js 18 | ``` 19 | 20 | While `routes.js` glues everything together: 21 | 22 | ```javascript 23 | // ... some code ... 24 | const health = require('./handlers/health') 25 | const shazam = require('./handlers/shazam') 26 | app.get('/health', health) 27 | app.post('/shazam', shazam) 28 | 29 | module.exports = app 30 | ``` 31 | 32 | Unlike React Native, you could dynamically load modules here. However, there's still a need for judgement when constructing the routes (`app.get/post` part). 33 | 34 | Using `hygen` let's see how we could build something like this: 35 | 36 | ``` 37 | $ hygen route new --method post --name auth 38 | ``` 39 | 40 | Since we've been through a few templates as with [previous](/docs/redux) [use cases](/docs/react-native), let's jump straight to the interesting part, the inject part. 41 | 42 | So let's say our generator is structured like this: 43 | 44 | ``` 45 | _templates/ 46 | route/ 47 | new/ 48 | handler.ejs.t 49 | inject_handler.ejs.t 50 | ``` 51 | 52 | Then `inject_handler` looks like this: 53 | 54 | ```yaml 55 | --- 56 | inject: true 57 | to: app/routes.js 58 | skip_if: <%= name %> 59 | before: "module.exports = app" 60 | --- 61 | app.<%= method %>('/<%= name %>', <%= name %>) 62 | ``` 63 | 64 | Note how we're anchoring this inject to `before: "module.exports = app"`. If in previous occasions we appended content to a given line, we're now prepending it. 65 | -------------------------------------------------------------------------------- /hygen.io/docs/extensibility.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Extensibility 3 | id: extensibility 4 | --- 5 | 6 | You can extend these properties of Hygen, using a special `.hygen.js` file: 7 | 8 | * Helper functions in templates. 9 | * Customizing logger, template location and shell executor. 10 | * (_WIP_) Custom generator operations in addition to the built-in `add`, `inject`, `shell` 11 | 12 | # .hygen.js 13 | 14 | Hygen supports a bubbling-up mechanism for searching a `.hygen.js` file and loading it. Where ever you run `hygen` from, it will start searching for this file upwards, and stop at the first one it finds. 15 | 16 | This means: 17 | 18 | * You can set up a _single file_ per project. 19 | * For some special sub-projects, set a different file for a different behavior. 20 | * You can also set up one global file to use if you drop it in your user folder. 21 | 22 | _Note:_ The current strategy when there are two or more `.hygen.js` files in the path upwards is to _take the first one_ and ignore the rest. 23 | 24 | # Helpers 25 | 26 | Here's a template that uses a function that doesn't exist in the helper accessor `h`. This function is plainly called `extended`, for lack of a better name. 27 | 28 | ```yaml{5} 29 | --- 30 | to: given/hygen-js/new.md 31 | --- 32 | this demonstrates hygen loaded up .hygen.js and extended helpers. 33 | <%= h.extended('hello') %> 34 | ``` 35 | 36 | In order to add the function `extended` to the standard `hygen` helpers collection, we'll create a `.hygen.js` file at the root of our project: 37 | 38 | ``` 39 | src/ 40 | package.json 41 | .hygen.js 42 | ``` 43 | 44 | This `.hygen.js` file will be the home of all of our extension points. For this example, we'll use the following content: 45 | 46 | ```javascript{3} 47 | module.exports = { 48 | helpers: { 49 | extended: s => s.toUpperCase() 50 | } 51 | } 52 | ``` 53 | 54 | Note that beyond inlining a utility function like in this example, you can require and use any piece of code in your project here and export it for Hygen to use. 55 | -------------------------------------------------------------------------------- /hygen.io/docs/packages.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Packages 3 | id: packages 4 | --- 5 | 6 | Sharing generators cross-projects and cross-teams can be done simply by copying or any custom tooling your teams come up with that perfectly fits your workflow. 7 | 8 | The `hygen-add` tool offers a streamlined way to do this by introducing _Packages_. Packages are a compiled set of generators which are published as a node module that you can install and share with others. 9 | 10 | ## Popular Packages 11 | 12 | * [hygen-cra (create-react-app)](https://github.com/jondot/hygen-CRA) - generate a full set of component, storybook and test for your [Create React App](https://github.com/facebook/create-react-app) project. 13 | 14 | ## Installing a Package 15 | 16 | First, you need to install the `hygen-add` tool, it's one of the tools in the `hygen` toolbelt. 17 | 18 | ```bash 19 | $ yarn global add hygen-add 20 | ``` 21 | 22 | Now pick [a published module](https://www.npmjs.com/search?q=hygen-) on `npm` and install it. For a module called `hygen-acme-generators`, run this, without the prefix `hygen-`: 23 | 24 | ```bash 25 | $ hygen-add acme-generators 26 | ``` 27 | 28 | This installs the `acme-generators` package with the embedded `yarn` so it's versioned and locked, and adds the generators to your current project. Technically, it will _copy_ the generators to your local `_templates` directory, because copying is more resilient and robust rather than referencing something that can change unexpectedly. 29 | 30 | Once that's done, you can remove `acme-generators` using `yarn`, or leave it if you'd like to sync your templates once in a while. 31 | 32 | ## Installing from Github 33 | 34 | `hygen-add` supports installing from Github, in the same way `yarn` supports it because it uses `yarn` under the hood. It will try to infer the package name from the Github repo URL. 35 | 36 | Running this: 37 | 38 | ```bash 39 | $ hygen-add https://github.com/acme/acme-generators 40 | ``` 41 | 42 | Will install the package `acme-generators`. The package name `acme-generators` was parsed out of the Github URL. 43 | 44 | If for some reason your Github URL doesn't reveal anything about the package name, you can manually specify the package name (remember: the package name is the `name` property in the package project's `package.json` file). 45 | 46 | ```bash 47 | $ hygen-add https://github.com/acme/archive --name acme-generators 48 | ``` 49 | 50 | ## Name Clashes 51 | 52 | If you want to install a `react` package from both `acme` and `awesome`, you can prefix one of those, or both, to avoid name clashes: 53 | 54 | ```bash 55 | $ hygen-add acme-react 56 | $ hygen-add awesome-react --prefix awsm 57 | ``` 58 | -------------------------------------------------------------------------------- /hygen.io/docs/react-native.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: React Native 3 | id: react-native 4 | --- 5 | 6 | While the [Redux use case](/docs/redux) is more than suitable to use for React Native, we have one unique (and arguably limiting) property of the React Native packager which is: you can't require anything dynamically. 7 | 8 | So all of the fancy glob-and-require code that's supposed to glue up many files can't be done. This means more manual work and bookkeeping. 9 | 10 | ```javascript 11 | // this can't be done 12 | each(m => require(m), glob('modules/**/state')) 13 | ``` 14 | 15 | ## Injecting with `hygen` 16 | 17 | Using `hygen` we can help ourselves maintain these dependencies. 18 | 19 | Having that every module, component or file that you add is generated with `hygen`, we could do something like this: 20 | 21 | ```bash{5} 22 | _templates/ 23 | component/ 24 | new/ 25 | component.ejs.t 26 | inject_component.ejs.t <---- let's look at this 27 | ``` 28 | 29 | And here's how `inject_component` looks like: 30 | 31 | ```javascript 32 | --- 33 | inject: true 34 | to: app/globs/all-components.js 35 | skip_if: <%= name %> 36 | after: "const components = [" 37 | --- 38 | <%= Name %>: require('../components/<%= name %>').default, 39 | ``` 40 | 41 | This assumes we have a central file in `globs/all-components.js` that we use to glue all components to one re-exportable module: 42 | 43 | ```javascript 44 | const components = { 45 | Avatar: require('../components/avatar').default, 46 | Icon: require('../components/icon').default 47 | } 48 | export default components 49 | ``` 50 | 51 | Running this: 52 | 53 | ``` 54 | $ hygen component new --name intro 55 | ``` 56 | 57 | Will build this: 58 | 59 | ```javascript{4} 60 | const components = { 61 | Avatar: require('../components/avatar').default, 62 | Icon: require('../components/icon').default, 63 | Intro: require('../components/intro').default 64 | } 65 | export default components 66 | ``` 67 | 68 | Now we could do something fun like this: 69 | 70 | ```javascript 71 | import { Intro } from 'app/globs/all-components' 72 | ``` 73 | -------------------------------------------------------------------------------- /hygen.io/docs/standalone.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Standalone 3 | id: standalone 4 | --- 5 | 6 | If you don't have Node.js installed you can install the `hygen` binary in standalone mode. Depending on your operating system, you have a few options. 7 | 8 | ## MacOS 9 | 10 | You can install via Homebrew: 11 | 12 | ``` 13 | $ brew tap jondot/tap 14 | $ brew install hygen 15 | ``` 16 | 17 | ## Linux, Windows, MacOS (Non-homebrew) 18 | 19 | You can download a binary for your operating system [on the Github releases page](https://github.com/jondot/hygen/releases). Binaries are updated and pushed automatically with every new version. 20 | 21 | After downloading the tarball, place it in your preferred operating system `bin` path. 22 | 23 | ## Why Standalone? 24 | 25 | There are a few reasons to want to run `hygen` as standalone: 26 | 27 | * You're not familiar with Node.js or don't want to have it installed. 28 | * You prefer a global binary to avoid installing the same binary over and over. 29 | * You're packing `hygen` into your own software, Docker image, or re-distributing it. 30 | * You're building tooling _over_ `hygen` and need a maleable binary to execute. 31 | * The standalone package is a little bit faster (because it snapshots code). You want that extra speed. 32 | -------------------------------------------------------------------------------- /hygen.io/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-website", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "docusaurus start", 7 | "build": "docusaurus build", 8 | "swizzle": "docusaurus swizzle", 9 | "deploy": "docusaurus deploy" 10 | }, 11 | "dependencies": { 12 | "@docusaurus/core": "2.0.0-alpha.58", 13 | "@docusaurus/preset-classic": "2.0.0-alpha.58", 14 | "classnames": "^2.2.6", 15 | "react": "^16.8.4", 16 | "react-dom": "^16.8.4", 17 | "react-typist": "^2.0.5", 18 | "styled-components": "^5.0.0" 19 | }, 20 | "browserslist": { 21 | "production": [ 22 | ">0.2%", 23 | "not dead", 24 | "not op_mini all" 25 | ], 26 | "development": [ 27 | "last 1 chrome version", 28 | "last 1 firefox version", 29 | "last 1 safari version" 30 | ] 31 | } 32 | } -------------------------------------------------------------------------------- /hygen.io/sidebar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | module.exports = { 9 | sidebar: { 10 | Introduction: [ 11 | 'quick-start', 12 | 'templates', 13 | 'generators', 14 | 'extensibility', 15 | 'faq', 16 | ], 17 | Ecosystem: ['packages', 'create', 'standalone'], 18 | 'Use Cases': ['redux', 'react-native', 'express'], 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /hygen.io/src/components/cta-button.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from '@docusaurus/Link' 3 | import styled from 'styled-components' 4 | 5 | const CtaButton = ({ children, to }) => ( 6 | 7 | {children} 8 | 9 | ) 10 | 11 | export default CtaButton 12 | 13 | const ButtonContainer = styled.div` 14 | box-shadow: rgba(100, 0, 100, 0.12) 0px 5px 10px 0px; 15 | border: 1px solid var(--ifm-color-primary); 16 | border-radius: 5px; 17 | padding: 15px 30px; 18 | margin: 1rem 0; 19 | font-size: 1.1em; 20 | background-color: var(--ifm-color-primary); 21 | color: white; 22 | display: inline-block; 23 | transition: all 0.3s ease; 24 | 25 | &:hover { 26 | box-shadow: rgba(100, 0, 100, 0.12) 0px 8px 30px 0px; 27 | } 28 | ` 29 | -------------------------------------------------------------------------------- /hygen.io/src/components/doc-search.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import styled from 'styled-components' 3 | import siteConfig from '../../docusaurus.config' 4 | import searchIcon from '../../static/img/search.svg' 5 | 6 | class DocSearch extends Component { 7 | state = { 8 | enabled: true, 9 | } 10 | 11 | componentDidMount() { 12 | // Initialize Algolia search. 13 | // TODO Is this expensive? Should it be deferred until a user is about to search? 14 | // eslint-disable-next-line no-undef 15 | if (window.docsearch) { 16 | window.docsearch(siteConfig.docSearch) 17 | } else { 18 | console.warn('Search has failed to load and now is being disabled') 19 | this.setState({ enabled: false }) 20 | } 21 | } 22 | 23 | render() { 24 | const { enabled } = this.state 25 | 26 | return enabled ? ( 27 |
37 | 44 | 45 | ) : null 46 | } 47 | } 48 | 49 | const SearchInput = styled.input` 50 | margin: 0 1.6rem; 51 | appearance: none; 52 | background: #f0f0f0; 53 | border: 0; 54 | color: ${({ theme: { ink } }) => ink}; 55 | font-size: 1.6rem; 56 | font-family: inherit; 57 | position: relative; 58 | padding: 5px 5px 5px 29px; 59 | background-image: url(${searchIcon}); 60 | background-size: 16px 16px; 61 | background-repeat: no-repeat; 62 | background-position-y: center; 63 | background-position-x: 5px; 64 | border-radius: 0.8rem; 65 | width: 14rem; 66 | 67 | &:focus { 68 | outline: 0; 69 | backgroundcolor: #f0f0f0; 70 | border-radius: 0.8rem; 71 | } 72 | ` 73 | export default DocSearch 74 | -------------------------------------------------------------------------------- /hygen.io/src/components/navigation.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from 'gatsby-link' 3 | import styled from 'styled-components' 4 | import DocSearch from '../../../hygen.io/src/components/doc-search' 5 | 6 | class Navigation extends React.Component { 7 | render() { 8 | return ( 9 | 10 |
11 | 12 | {' '} 13 | Home{' '} 14 | 15 | 16 | {' '} 17 | Docs{' '} 18 | 19 | 20 | Github 21 | 22 | {this.props.withSearch && } 23 |
24 |
25 | ) 26 | } 27 | } 28 | 29 | const NavContainer = styled.div` 30 | display: flex; 31 | width: 100%; 32 | 33 | justify-content: flex-end; 34 | .nav-link { 35 | font-size: 1.6rem; 36 | margin-right: 10px; 37 | color: ${props => props.theme.ink}; 38 | } 39 | section { 40 | right: 5rem; 41 | display: flex; 42 | } 43 | 44 | @media screen and (max-width: 600px) { 45 | display: flex; 46 | flex-direction: column; 47 | align-items: center; 48 | 49 | section { 50 | position: relative; 51 | right: 0; 52 | margin: 0 auto; 53 | } 54 | } 55 | ` 56 | 57 | export default Navigation 58 | -------------------------------------------------------------------------------- /hygen.io/src/components/shell.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | import Typist from 'react-typist' 4 | 5 | const Button = styled.div` 6 | border-radius: 5px; 7 | width: 10px; 8 | height: 10px; 9 | background-color: ${({ color }) => color}; 10 | margin: 0 3px; 11 | ` 12 | const Bar = styled.div` 13 | margin-top: -8px; 14 | margin-bottom: 15px; 15 | margin-left: -12px; 16 | margin-right: 15px; 17 | display: flex; 18 | ` 19 | const Cmd = styled.div` 20 | margin-bottom: 1rem; 21 | ` 22 | const Add = styled.div` 23 | color: #34f749; 24 | ` 25 | const Inject = styled.div` 26 | color: #ff33ff; 27 | ` 28 | const FauxChrome = () => ( 29 | 30 |