Giter Club home page Giter Club logo

hygen-cook's People

Contributors

bbeesley avatar caioquirino avatar dependabot[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jonshilton

hygen-cook's Issues

Add support for aliases

After namespace support is added (#102), alias support for ingredients can be added, while also allowing array of strings on the ingredients (without alias):

ingredients:
  - alias: sdh
    repo: https://github.com/hygen-generators/scaffolder-demo-hygen
  - alias: gag
    name: github-actions-generators
instructions:
  - ingredient: sdh
    generator: monorepo
    action: new
    args:
      - option: name
        value: simple-service
  - ingredient: gag
    generator: github-actions
    action: build-test-publish
    args:
      - option: admin-github-token
        value: SUPER_SECRET_TOKEN
      - option: main-branch
        value: main
      - option: node-version
        value: '14.11'
      - option: use-commit-lint
      - option: use-lerna

Namespace ingredients by package name

The current recipe schema does not contain enough detail. Currently ingredients are defined by a package property and a generator property. This is reasonable, but the implementation treats the package property as the generator name (ie what hygen docs refer to as the generator name), and the generator property as the action name (what the hygen docs refer to as the action name).

This works, but gives us the limitation that if two packages contain generators with the same name, there will be a collision and only one will work.

To resolve this, we'll need a new property on the ingredient object (probably action) and we'll need to change the way they're used, so that package refers to the npm package (or git repo) that the generator comes from, generator refers to what the hygen docs refer to as the generator, and the new action property refers to what the hygen docs refer to as the action.

Eg: if running the generator via hygen looks like hygen component new --name myComponent, the action would be new, the generator would be component and the package property would define with npm package or git repo this generator is contained within.

As well as the changes to the ingredients schema, and the way args are passed to hygen, this will also involve changes to the way templates are fetched and stored (see the add.ts file), so that its possible to determine which package a generator came from, and select the right one with the call to hygen.

Add a full set of unit tests

This issue should require little explanation, we need unit tests in place to make sure we haven't broken anything as we make changes, add features, and update packages.

Add support for using `.hygen.js` config files included in generators at cook-time

Background
The current implementation of "fetching ingredients" is adapted from hygen-add and only copies across the contents of the _templates directory. Because .hygen.js files are located by searching up the tree from process.cwd() at runtime, any .hygen.js file included in the package will not be used automatically.

Improvement
Extend the instructions processing workflow to override the location from which .hygen.js is sourced to ensure that if that file is included in the sourced generator, it's used while running the generator from within hygen-cook.

Create a Hygen generator to help users create recipe files

hygen-cook is all based around recipes. The recipes can be shared, but until there are shared recipes to use (and even then when you need to write your own recipe) it would be useful to have a generator available to help people create a valid recipe file.

Documentation and Demo

There is a minimal level of documentation included in this project. In order to make it easy for people without prior knowledge to pick up and use this tool, we need to add thorough documentation as well as a working demo.

The demo should use existing publicly available hygen templates, composed into a recipe, for people to scaffold something out.

More feedback needed while cooking

When cooking a big recipe, the module sits without displaying any updates for long periods while installing ingredients. This often makes you think that it has stopped responding. Adding more feedback to show exactly what the module is currently doing would help to remove this problem.

Add support for a target path on an ingredient

Currently all generators are executed from the current working directory. This means its not possible to, for instance, scaffold a Lerna repo with multiple packages using a basic node module template.

To resolve this, we should add support for specifying the directory that an ingredient template should be executed from.

Validate recipe yaml files

  • Add validation schema and validate recipe before processing
  • Consider additional validation for example:
    • Ensure each generator and action is used once
    • Ensure the required args are passed in (optional, as this might be too cumbersome and we get this on hygen execution time for free)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.