question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Templates and other ideas (implemented in fork)

See original GitHub issue

I had some requirements in a project recently that needed some finer control over the creation of the different components. I’ve got the working code in a fork https://github.com/Daveawb/create-react-component-folder.

I wondered if this would be of any use to you, it does add a dependency on handlebars to manage templates but abstracts a lot of logic away from the main index and creation scripts.

  • Added a configuration namedexports to remove default exports and export named variables only.

  • Added Typescript propTypes (removed {{name}}.propTypes) and added a TS type instead when typescript is in the configuration.

  • Added Typescript types to functional components

  • All options have default values that are passed in from cosmiconfig

  • Run time configuration values are merged with the defaults to provide a consistent config array throughout the script.

  • A minor configuration helper added to get items from a config store

  • Templates are rendered using handlebars rather than JS. This could potentially allow for the templates to be published into a project allowing for finer control over how components etc. are rendered.

  • Removed all the generation functions in favour of one createReactComponent function.

  • Fixed ESLint and TSLint problems with current template layouts.

Let me know if this is of any use to you and I’ll clean it up and put in a PR.

Additional

  • Refactored config to use a global store with a frozen API that is available as a require in any script that needs it without passing it around in arguments.
    • Config is an object with two keys, flags and values, these are not directly accessible.
    • Config exposes a simple API to check, get and merge values.
  • Added --output <directory> | -o <directory> to options to allow configuring default output location
  • Cleaned up templates and fixed a few bugs with prop types

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
snaerthcommented, May 22, 2019

This looks great. I will have a better look at it soon and let you know what I think, and then you could probably make a PR 👍

0reactions
Daveawbcommented, May 11, 2020

Ok, added the PR for you to review. #38

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fork a repo - GitHub Docs
A fork is a new repository that shares code and visibility settings with the original “upstream” repository. Forks are often used to iterate...
Read more >
Project forking workflow - GitLab Documentation
A fork is a personal copy of the repository and all its branches, which you create in a namespace of your choice. This...
Read more >
Fork-like DNA templates support bypass replication of lesions ...
Fork -like template replication was modeled by annealing an additional oligonucleotide to the substrate used for single-strand replication (Figs. 1B and 2B).
Read more >
Wikipedia:Content forking/Internal
A large number of inappropriate template and output forks are attempts to impose a personal "design vision" on something, to add features that...
Read more >
AnyEvent::Fork - everything you wanted to use ... - MetaCPAN
This module allows you to create new processes, without actually forking them from your current process (avoiding the problems of forking), but preserving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found