1.1.4 • Published 10 months ago

alloy-cli-frontend v1.1.4

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

Alloy CLI Frontend

Alloy CLI Frontend is a command-line tool designed to generate frontend components following an atomic design methodology. It streamlines the creation of structured and reusable components (Atoms, Molecules, and Organisms) by automating the generation of scripts, styles, states, types, and other related files.

Table of Contents

Installation

Ensure you have Node.js installed. Install Alloy CLI Frontend globally via npm:

npm install -g alloy-cli-frontend

or

yarn install -g alloy-cli-frontend

or

npx alloy-cli-frontend

Usage

Before running any commands, navigate to the src folder of your frontend project directory.

cd src

Run Alloy CLI Frontend using the following syntax:

alloy-cli-frontend <command> [options]

Example:

alloy-cli-frontend organism

Commands

Organism

Generates an Organism component, optionally creating a page view, template, data file, script, style, and type definition.

alloy-cli-frontend organism [options]

Options

Each command accepts a set of options to configure component generation:

OptionDescriptionDefault
-cd, --component-directorySelect component directoryorganisms
-pd, --page-directorySelect page directorypages
-tpd, --template-directorySelect template directorytemplates
-dd, --data-directorySelect data directory_data
-td, --type-directorySelect type directory_types
-sd, --script-directorySelect script directoryassets/scripts

Molecule

Generates a Molecule component with options for script, style, and type definition.

alloy-cli-frontend molecule [options]

Options

Each command accepts a set of options to configure component generation:

OptionDescriptionDefault
-cd, --component-directorySelect component directorymolecules
-td, --type-directorySelect type directory_types
-sd, --script-directorySelect script directoryassets/scripts

Atom

Generates an Atom component with options for script, style, and type definition.

alloy-cli-frontend atom [options]

Options

Each command accepts a set of options to configure component generation:

OptionDescriptionDefault
-cd, --component-directorySelect component directoryatoms
-td, --type-directorySelect type directory_types
-sd, --script-directorySelect script directoryassets/scripts

Page

Generates a Page with options to add a story template and a new template component.

alloy page [options]

Follow the prompts to:

  1. Enter the page name in PascalCase format (e.g., Home).
  2. Decide whether to include a story template for the page.
  3. Choose whether to add a new template component or reuse an existing one.

Options

Each command accepts a set of options to configure component generation:

OptionDescriptionDefault
-pd, --page-directorySelect page directorypages
-tpd, --template-directorySelect template directorytemplates

Edit Generated Files

Allows you to modify files that will be generated by the CLI using an editor of your choice. You can select from various file types (Page, Component, Style, etc.) and editors (VSCode, IntelliJ IDEA, etc.).

alloy-cli-frontend edit-generated-file

This command allows you to:

  1. Select the file type to modify, such as Page, Component, Style, etc.
  2. Choose an editor like VSCode, Sublime, or Notepad++.
  3. Open the file in the selected editor for easy editing.

Note: For users who want to edit generated files, it is recommended to install this package locally. This ensures that each project can manage its specific generated files independently, avoiding conflicts when working on multiple projects.

Examples

Generate an Organism

alloy-cli-frontend organism

Follow the interactive prompts to:

  • Add state
  • Create a page view
  • Use a story template
  • Generate a new data file

Project Structure

The Alloy CLI Frontend generates files like:

src/
  components/
    atoms/
      Button/
        Button.tsx
        Button.scss
        Button.states.json
    molecules/
      Card/
        Card.tsx
        Card.scss
        Card.states.json
    organisms/
      Header/
        Header.tsx
        Header.scss
        Header.states.json
  pages/
    HeaderPage.tsx
  templates/
    HeaderTemplate.tsx
  _data/
    Header.tsx
  _types/
    organisms.d.ts
    molecules.d.ts
    atoms.d.ts
  assets/
    scripts/
      header.entry.ts

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

1.1.1

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago