1.0.3 • Published 11 months ago

moris v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

NPM version

Moris is a configurable npm package featuring a user-friendly CLI for effortless React component creation. It streamlines the process with templates, scaffolding options, and code consistency, boosting productivity in React development.

npm

$ npm i moris
or
$ npm i -g moris

yarn

$ yarn add moris
or
$ yarn global add moris
  • If you installed package locally use it with npx before each command: npx moris c component Example

  • If the package is installed globally then use it without npx: moris create c Example

If you run command moris c c Example -s xl such folder structure and file contents will be created

src
└─ components
    └─ Example
      ├── index.tsx
      ├── styles.ts
      ├── useExample.ts
      ├── types.ts
      └── constants.ts
// index.tsx 

import { useExample } from './useExample';
import { ExampleProps } from './types';
import { ExampleWrapper } from './styles';

const Example = ({}: ExampleProps) => {
  useExample();

  return <ExampleWrapper></ExampleWrapper>;
};

export default Example;
// styles.ts

import styled from 'styled-components';

export const ExampleWrapper = styled.div``;
// useExample.ts

import { useState, useEffect } from 'react';

export const useExample = () => {};
// types.ts

export type ExampleProps = {};

To change Moris default settings create a file moris.json at the root of your project

moris.json

{
    "useAbsolutePath": "-",
    "indexContent": "import React from 'react'\nimport ${name}Wrapper from '${path}${name}'\n",
    "stylesContent": "import styled from 'styled'\n export const ${name}Wrapper = styled.div``\n"
}