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

rnerator

v0.7.2

Published

Component generator for React Native, with a Sandbox environment

Downloads

7

Readme

RNERATOR

Generator of component for React Native. also provides a sandbox environment for the component dev.

⚠️ The project is really new so the API could have breaking change in a near future

oclif Version Downloads/week License

Set Up

Installation

First you need to install the package.

You can install the CLI on your RN project or globally.

⚠️ for an easier management of the CLI version used. I would suggest to prefer the local installation

npm

# local installation
npm install --save-dev rnerator
# global installation
npm install rnerator -g

yarn

# local installation
yarn add -D rnerator
# global installation
yarn global add rnerator

Initialization

Then you have to init the cli in your project. This will (if it doesn't exist) create template, sandbox, components folders and set up their content.

# local npm installation
npm exec rnerator init
# local yarn installation
yarn run rnerator init
# global installation
rnerator init

⚠️ To avoid useless conflict you should add sandboxFiles.ts to your .gitignore

Component Generation

Know you can generate your component thanks to the generate command

# local npm installation
npm exec rnerator generate Button -l components/core
# local yarn installation
yarn run rnerator generate Button -l components/core
# global installation
rnerator generate Button -l components/core

Commands

rnerator generate NAME

Generate a new element

USAGE
  $ rnerator generate [NAME] [-t <value>] [-l <value>] [-s] [-i]

ARGUMENTS
  NAME  component Name

FLAGS
  -i, --indexDisabled     disabled the creation of an index file
  -l, --location=<value>  location of the component generated
  -s, --sandboxDisabled   disabled the creation of a sandbox file
  -t, --template=<value>  [default: component] template used for the component generated

DESCRIPTION
  Generate a new element

EXAMPLES
  $ rnerator generate <name> --template=<template>

  $ rnerator generate Test
  CREATED src/components/Test/Test.tsx
  CREATED src/components/Test/index.ts
  CREATED src/components/Test/Test.sandbox.tsx
  UPDATED src/sandbox/sandboxFiles.ts

See code: dist/commands/generate/index.ts

rnerator help [COMMAND]

Display help for rnerator.

USAGE
  $ rnerator help [COMMAND] [-n]

ARGUMENTS
  COMMAND  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for rnerator.

See code: @oclif/plugin-help

rnerator init

Initialize a new project

USAGE
  $ rnerator init [-j]

FLAGS
  -j, --js  is a javascript project

DESCRIPTION
  Initialize a new project

EXAMPLES
  $ rnerator init

See code: dist/commands/init/index.ts

rnerator sandbox

Generate the sandboxFiles.ts file

USAGE
  $ rnerator sandbox

DESCRIPTION
  Generate the sandboxFiles.ts file

EXAMPLES
  $ rnerator sandbox

See code: dist/commands/sandbox/index.ts

Templates

When you execute the command init a folder is created with a unique template component.ts You can edit this one and add your own templates

Template Format

All the templates must have the same format.

{
  "template": "import React from 'react'; import Box from '~core/Box'; import Text from '~core/Text'; type {{name}}Props = {}; const {{name}} = (props: {{name}}Props) => { return (<Box><Text>{{name}}</Text></Box>);};export default {{name}};",
  "location": "components",
  "sandboxDisabled": false
}

Sandbox

The main interest of this component generator is the Sandbox environment automatically generated.

It provide a sandbox view for all your component. In which you can develop your component. This is an alternative to Storybook for React Native

Folder structure

When you initialize the project thanks to rnerator init a folder with this structure is created:

|-sandbox
|-- App.tsx
|-- Navigator.tsx
|-- Home.tsx
|-- sandboxFiles.ts
|-- Wrapper.ts

sandboxFiles

Each time you generate a component with a sandbox file, sandboxFiles.ts is re-generated. (you can also re-regenerate this file thanks to rnerator sandbox)

Thanks to sandboxFiles.ts, a navigator is created with all the Sandbox Files and the Home screen display a link for each screen.

To develop your component in this sandBox environment you now just have to change the App in index.js by src/sandbox/App.tsx

Wrapper

Thanks to this file you can Wrap your Sandbox Navigator with provider like ThemeProvider.