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.

Add generator for utils/helpers directory?

See original GitHub issue

If I ran something like this

$ yarn redwood generate helper convertdate

It creates a new subfolder called ConvertDate in helpers directory. That have the following files,

📦helpers
 ┣ 📂ConvertDate
 ┃ ┗ 📜ConvertDate.js
 ┃ ┗ 📜ConvertDate.test.js
 ┗ 📜.keep

Example files

This is the file that it generate ConvertDate.js

export const Add = (a, b) => {
  return a + b
}

Here is the example test file ConvertDate.test.js

import { Add } from './ConvertDate'

test('ConvertDate works', () => {
  const value = Add(1, 2)

  expect(value).toBe(3)
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
AryanJ-NYCcommented, Mar 19, 2020

I like this idea!

1reaction
peterpcommented, Mar 23, 2020

I’m not sure what the equivalent paradigm would be in the React world.

I think we would just use a component in the React world. It’s components all the way down.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learning to Plop
A little tool that saves you time and helps your team build new files with consistency. Generate code when you want, how you...
Read more >
Helper Methods - Middleman
Template helpers are methods which can be used in your dynamic templates to simplify common HTML tasks. Most of the basic methods should...
Read more >
generator-util | Yarn - Package Manager
Utils for generate generators. base, generate, generator, helper. readme. generator-util NPM version · Build Status ... Use it. $ yarn add generator-util ......
Read more >
linkml.utils package — linkml documentation
Subclasses of this class implement specific generators. Each generator is in one of two styles: schemaloader-based, using a Visitor pattern (older). schemaview- ...
Read more >
How to create custom helper functions in Laravel
First create helpers.php inside App\Http directory. Then add the following code inside the composer.json
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