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

fsdx

v1.1.1

Published

A CLI tool for easily FSD development

Downloads

7

Readme

fsdx

A command-line tool for generating folder structures using the Feature-Sliced Design methodology.

Table of Contents

FSD Methodology

Feature-Sliced Design (FSD) is an architectural methodology for building frontend applications. It is a collection of rules and conventions for organizing code, with the main goal of making the project more understandable and structured in the face of constantly changing business requirements . FSD can be implemented in projects and teams of any size, but there are a few things to keep in mind.

For more information about the Feature-Sliced Design methodology and its principles, refer to the FSD Methodology Guide.

Installation

You can install the fsdx both globally and locally. Here's how:

Global Installation

Install the FSD CLI globally using the following command:

npm install -g fsdx

After global installation, you can use the fsdx command directly from the terminal.

Local Installation

To install the FSD CLI locally in your project, use the following command:

npm install fsdx

You can then use the FSD CLI using npx fsdx from the terminal within your project directory.

Commands

The fsdx provides the following commands with their aliases and descriptions:

| Command | Alias | Description | Options | | ---------- | ----- | ------------------------------------------- | ---------------- | | init | i | Initialize the initial FSD configuration. | -y, --yes | | generate | g | Generate the FSD structure. | -t, --template | | examples | e | Show usage examples for available commands. | |


Command: init|i

The init command enables you to create an initial configuration file for use with the Feature Sliced Design (FSD). This configuration file customizes the generated folder structure to align with your project's specific requirements.

Options for init:

  • -y, --yes: Skip prompts and proceed with default options.

When you execute the init command, you'll encounter a series of prompts that guide you through the configuration process. These prompts help tailor the FSD structure to your project's unique needs. The prompts include:

  1. CSS Method: Choose your preferred method of working with CSS.

  2. CSS Preprocessor: Specify a CSS preprocessor if applicable (optional).

  3. CSS-in-JS Solution: Select a CSS-in-JS solution if you've chosen CSS-in-JS.

  4. TypeScript or JavaScript: Indicate whether you're working with TypeScript or JavaScript.

  5. Framework: Specify the framework you're using.

  6. Tests: Define the test file postfix.

  7. Documentation Formats: Choose desired documentation formats.

  8. State Management Solution: Select your preferred state management solution.

These prompts allow you to create an initial configuration tailored to your project's needs, which will later be used for generating the FSD structure.


Command: generate|g

When you use the generate command, you will be prompted to choose the type of FSD structure you want to generate.

Options for generate:

  • -t, --template: Auto-generate files with templates for the FSD Structure.

Prompts during the generate command:

  1. Choose an FSD Layer: Select the FSD layer you want to generate. Options include layer, slice, and segments.

    • Layer: Creates the basic FSD structure with layers such as app, pages, features, widgets, entities, and shared.

    • Slice: Allows you to specify a slice name. Afterward, you will be prompted with questions related to segments.

    • Segments: Customize segments for the selected slice. Choose from options like ui, model, api, lib, and public API.

  2. Choose Segments (default: ui, model, api, lib, and public API): If you selected slice or segments earlier, you can choose full segments for the slice. The default options are ui, model, api, lib, and public API.

Examples

Here are a few examples of how to use the FSD CLI:

  1. Initialize the initial FSD configuration:

    fsdx init

    This will guide you through setting up your FSD configuration.

  2. Generate the FSD structure:

    fsdx generate

    This will generate the folder structure based on your FSD configuration.

  3. Generate the FSD structure with example content:

    fsdx examples

    This will generate the folder structure with example content to help you get started.

License

This project is licensed under the MIT License.