0.2.1 • Published 2 years ago

new-structure v0.2.1

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

new-structure

CLI for creating new react file structure (component or hook).

Installation

only use in your workspace:

# npm
npm i new-structure -g
# yarn
yarn global add new-structure
# pnpm
pnpm add new-structure -g

tested in node 14+.

Usage

in your project's directory, try creating a new component.

new-structure NewComponent

or hook

new-structure useMyHook -t hook

The default language is TypeScript. If your project is a JavaScript project, please try adding the -l or --lang option.

new-structure NewComponent -l js

if you want to add a configuration file to the current project directory, please use:

new-structure init

configuration file like this:

const config = {
  // Which language to use ('ts' or 'js')
  lang: 'ts',
  // structure type ('comp' or 'hook')
  type: 'comp',
  // components directory path
  componentDir: './src/components',
  // hooks directory path
  hookDir: './src/hooks'
}

module.exports = config

Using a shorter alias​

new-structure might be hard to type, so you may use a shorter alias like ns instead.

Adding a permanent alias on POSIX systems​

Just put the following line to your .bashrc, .zshrc, or config.fish:

alias ns=new-structure

Adding a permanent alias in Powershell (Windows):​

In a Powershell window with admin rights, execute:

notepad $profile.AllUsersAllHosts

In the profile.ps1 file that opens, put:

set-alias -name ns -value new-structure
0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago