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

@strwatcher/suipta

v0.1.3

Published

Simple boilerplate-code cli generator for Feature-Sliced Design methodolgy

Downloads

5

Readme

Suipta

Simple boilerplate-code cli generator intended to imporve your experience with Feature-Sliced Design methodology

Based on:

How-to-use

To use suipta you need one of these package managers:

  • npm
  • yarn
  • pnpm
  • volta

Installation

for npm:

npm i --save-dev @strwatcher/suipta

for yarn:

yarn add --dev @strwatcher/suipta

for pnpm:

pnpm add -D @strwatcher/suipta

for volta:

volta install @strwatcher/suipta

Simple Usage

To use suipta with out-of-box templates you need to add it to your scripts in package.json

"scripts": {
    ...
    "suipta": "suipta",
    ...
}

You can also add aliases for slice and segment generators:

"scripts": {
    ...
    "slice": "suipta slice",
    "segment": "suipta segment",
    ...
}

After that simply start suipta from command line:

  • In interactive mode:
pnpm suipta || pnpm slice || pnpm segment
  • Using arguments bypassing:
pnpm suipta slice entities user

Where:

  • slice is generator type (slice | segment)
  • entities is one of 5 preconfigured layers
  • user is custom name of creating slice

Arguments

If you wanna use not default settings of generators you can use arguments. (This feature works only in 'slice' generator at this moment):

--ui : (react | solid) --model : (effector) --language : (js | ts)

Also you can customize path to suipta config using --configPath : string

Configuration

If you need to customize behaviour of suipta you can write your own config.

Default location is root dir of your project

Configs that are resolving by default:

  • suipta.config.js
  • suipta.config.cjs
  • suipta.config.yaml
  • suipta.config.yml
  • suipta.config.json

To provide typings for config you can follow this example:

// suipta.config.js

/**
 * @type {import('suipta').SuiptaConfig}
 * **/
export default {
    layers: ['entities', 'features', 'widgets',  'pages'] // Array<string>
    segmentLayers: ['shared'] // Array<string>
    segment: ['lib', 'ui'] // Array<string>
    templatesDir?: './templates' // string which is relative path (from project root dir) to templates directory
    lang?: 'ts' // option to choose language ('js' | 'ts')
    rootDir: './src' // string whic is relative path (from project root dir) to directory where results of generation will be saved
}

Custom templates

If you need more flexibility, you can write own templates You need to place them in templates dir and set its path to templatesDir option in config.

In templates directory you need to follow next structure:

templates/
....entities/
........files which will be use in generation
....other layer in which slice will be generated/
........files which will be use in generation
....segments/
........shared/
............files which will be use in generation
........other layer in which segment will be generated/
............files which will be use in generation

Templates format

Suipta use handlebars syntax to process dynamic values in templates

Slice generator:

In templates of slice generator 2 vaiables are avaliable:

  • layer
  • slice

In segment generator 3:

  • layer
  • segment
  • component

These values can be modified using helpers:

  • pascalCase
  • camelCase
  • snakeCase
  • etc...

Example of temlate file with dynamic fields:

// templates/pages/ui.tsx

import {PageLayout} from '...'

type Props = {

}

export const {{pascalCase slice}}Page = (props: Props) => {
    return <PageLayout></PageLayout>
}

Imagine, that slice name is auth. The result of generation will be:

// src/pages/auth/ui.tsx

import {PageLayout} from '...'

type Props = {

}

export const AuthPage = (props: Props) => {
    return <PageLayout></PageLayout>
}

Contributing

Requirments:

Install tooling:

volta install node pnpm lefthook commitizen

Install dependencies:

pnpm i

Run tests:

In watch mode

pnpm test

One time

pnpm test:run

Lint code:

pnpm lint

Format code:

pnpm format

Commitizen friendly