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

@feature-sliced/cli

v1.0.0

Published

Utility to quickly generate layers, slices, and segments from Feature-Sliced Design.

Downloads

2,791

Readme

@feature-sliced/cli

npm version Static checks and tests

Utility to quickly generate layers, slices, and segments from Feature-Sliced Design.

Installation

npm add -g @feature-sliced/cli

This will create a global binary fsd. You can install this CLI locally as well, but then you will need to use npx to run it.

Usage

Generate the Entities layer with a client slice that contains an index file and two segments, ui and api:

fsd entities client --segments ui api

Or, for short:

fsd e client -s ui,api

If you have at least one slice in your project already, the CLI will know where to generate. Otherwise, it will generate in the current folder, or you can specify the location yourself with the --root or -r option.

  • Generate the Widgets layer with a bottom-bar slice that has an index file and segments ui and api in the src/ folder:

    fsd w bottom-bar -s ui api -r src
    fsd widget bottom-bar -s ui,api -r src
    fsd widgets bottom-bar --segments ui,api -r src

    Produces:

    • src/widgets/bottom-bar/index.(js|ts) (depending on your project)
    • src/widgets/bottom-bar/ui/
    • src/widgets/bottom-bar/api/
  • Generate the Features layer with a slice employee/employee-record inside a slice group employee:

    fsd f employee/employee-record
    fsd feat employee/employee-record

    In a detected FSD root[^1] or current folder, produces:

    • features/employee/employee-record/index.(js|ts) (depending on your project)
  • Generate the Entities layer with a user slice inside the src/lib folder, creating it if necessary:

    fsd e user -r ./src/lib
    fsd entity user --root ./src/lib

    Produces:

    • src/lib/entities/user/index.(js|ts) (depending on your project)
  • Generate the Pages layer with slices edit-note and note-list, each containing segments ui and api:

    fsd p edit-note note-list -s ui, api
    fsd page edit-note, note-list -s ui api

    In a detected FSD root[^1] or current folder, produces:

    • pages/edit-note/index.(js|ts) (depending on your project)
    • pages/edit-note/ui/
    • pages/edit-note/api/
    • pages/note-list/index.(js|ts)
    • pages/note-list/ui/
    • pages/note-list/api/
  • Generate the Shared layer with segments ui and api and an index file for each segment:

    fsd s ui api
    fsd s -s ui api
    fsd shared ui -s api

    In a detected FSD root[^1] or current folder, produces:

    • shared/ui/index.(js|ts)
    • shared/api/index.(js|ts)

Credits

Big thanks to a community member Agent_RBY_ for implementing most of the generating and detecting logic.

License

The source code of this project is distributed under the terms of the ISC license. It's like MIT, but better. Click here to learn what that means.

[^1]: An FSD root is the folder that contains slices in Feature-Sliced Design. There can be several independent roots in one project.