npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-react-native-component-node-module-templates

v1.0.8

Published

NPM package to easily create modules and components using your templates(several pre-loaded) for any js project. Also, give you the option to edit the template according to your project quickly.

Downloads

4

Readme

React Component Templates, React Native Component Templates, Express Templates, Node Module Templates and Starters

NPM package to easily create modules and components using your templates(several pre-loaded) for any js project. Also, give you the option to edit the template according to your project quickly.

Imagine working on a project with more than 100s of react components. How good if we can create components using an npm task inside the project. This way, it will save time and helps to maintain consistency throughout the project. And of course, you can approach this in various ways. Such as

  • Create and template file type on the code editor.
  • Use a plugin that gives snippets for the code editor.

The way I see it is when you work with multiple different teams on different projects, it is always useful to have isolated project standards that can be easily adjustable for the whole team.

Example:

let's say on a react project whenever we create a functional component we do following steps.

  1. create a folder with component name - Login
  2. create three files inside this folder - Login.tsx, Login.module.css, Login.test.ts
  3. create basic code structures on each of those files with relevant class names and module names.

What this tool does is automate this whole process. You and your team can create a template you like, and this tool will create files with the name you input and replace the content in your template files whenever you create a new module.

demo

Install

npm i react-react-native-component-node-module-templates --save-dev

Setup on first time

run node node_modules/react-react-native-component-node-module-templates/init.js

You will notice this will create an entry called gen in your package.json and copy a folder to your project root called developer-templates. Fell free to edit them as you see needed.

To run the generator

npm run gen

See NPM script to automate tasks in React and other JS Projects post for more information.

To add a new Template

  1. Create a folder inside developer-templates folder with the repo type ex:react
  2. Create child folder with the template files type ex: component,module
  3. Create user-input-map.json file indicating what are the values user should input and how they should get replaced.

[ { "label":"UserInput1", "replacements":[ { "replacingText" : "ModuleName", "replacingCaseTypes": 1 , "replacingLocations": [1,2,3] } ] }, { "label":"UserInput2", "replacements":[ { "replacingText" : "ModuleName", "replacingCaseTypes": 1 , "replacingLocations": [1,3] } ] } ]

Supported replacingCaseTypes

  1. camelCase
  2. snake_case
  3. kebab-case
  4. PascalCase
  5. UPPER_CASE_SNAKE_CASE

Supported replacingLocations

  1. file names
  2. folder names
  3. inside files

Also, feel free contribute to save time. :innocent: Happy Coding :heart: :muscle: