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

@siriussoftware/cactus

v1.0.0

Published

A code, component, module and project generator!

Downloads

7

Readme

Cactus 🌵

by Sirius Software SAS

This package is in progress! More useful info will be shown here.

Introduction

Cactus is mostly a generator, grounded in a convention we thought to be best practices.

Try it!

  • npm install
  • npm link
  • cactus

IMPORTANT: Run cactus standing in the directory where you want the project be generated).
IMPORTANT: For names make sure to use kebab case format (e.g. my-project)

The idea

Fast development, with some learning of the conventions and capabilities of the tool, the developer should be able to use cactus CLI to generate code, files and folders faster.

The CLI should be runnable globally, and whenever project you are located you can run the cactus command to generate a whole project, modules, files and configurations. Everything will have a generalized application as well as customization that you can specify in a single json file, and then run accordingly to the project type.

If cactus can be compared to: Right click -> create file -> name file -> snippet set; then we are good.

Summary

  1. Generators and code structure
  2. Styling
  3. Testing
  4. Best practices
  5. Plugins and other utilities
  6. Workflow examples
  7. Tecnologies
  8. Bibliography

1. Generators and code structure

1.1 whole project

Notes:

  • We use Redux with a custom structure specification

React

  • public/ ignore
    • favicon.ico
    • index.html
    • manifest.json
  • src/
    • actions/ -> redux
    • assets/ -> project
    • components/ -> project
    • i18n/ -> OPT project
    • reducers/ -> redux
    • styles/ -> project
    • utils/ -> project
    • module-1/ -> module
    • module-2/
    • ...
    • module-n/
    • index.js -> project
    • routes.js ->
    • settings-dev.json -> project
    • settings-prod.json -> project
    • settings.ts -> project
    • store.js -> redux setup
  • .gitignore
  • README.md
  • package.json

React Native

  • test
  • android/
    • ...
  • ios/
    • ...
  • src/
    • actions/ redux
      • index.js
    • assets/ icons, files
    • config/ aws, google, oauth
    • i18n
    • styles/ sass
    • utils/
    • navigation/ react-navigation
    • session/ if has login system
    • common/ components used througout the different app sections
    • app section i/ many as sections in the project
      • components/ main components renders
      • containers/ redux containers
      • appSection.actions.js redux
      • appSection.reducer.js redux
      • appSection.middleware.js redux
      • appSection.services.js redux
  • .gitignore automatically generated
  • App.js** follows the entry point
  • README .md introduction to the project
  • app.json
  • babel.config.js TODO
  • index.js entry point
  • metro.config.js TODO
  • package-lock.json TODO
  • package.json list of dependencies and other configurations
  • settings.json project configurations
  • store.js redux
  • yarn.lock same as package-lock.json

1.2 React Component

There are 3 types available: class, dumb class and functional.

1.2a Class Component

Has an internal state, in some cases are best practice to have them instead of passing them to a redux reducer. Mostly to avoid redux development hassle.

1.2b React Hooks

Gets props, which gets from redux AND parent.

  • Parent prop should be documented.
  • Redux prop is visible in mapState and mapDispatch (refer to: Cambio 1)

1.3 Redux Structure

  • Actions -> constants and type/payload setup.
  • Reducer -> initialState and action reducer management.
  • Middleware -> request calls and action delivery.
  • Services -> back request calling.

2. Styling

Formatters for a consistent conventional code writing.

2.1 PropTypes

In lack of Typescript, at least PropTypes should be used for type inference

2.2 ESLint with Google JSDoc convention

Linter that analyzes the code to flag patterns in Javascript. Uses Google official style convention.

Google JSDoc

3. Testing

jest unit

jest docs

jest components

jest snapshot docs

detox e2e

npm i -g detox-cli
npm i --save-dev detox
npm i --save-dev jest jest-circus
detox init -r jest

detox general configuration

iOS

detox configuration

Android

detox configuration

Ajustes generales

eslint excepcion detox / eslint-plugin-detox


4. Best practices

4.1 Why use TODOs annotation?

Used for marking things to be fixed that are not important but should be fixed in the future sometime. Examples can be need to change the logic to be more readable, like an auxiliary function.

5. Softwares configurations, plugins and tips

5.1 Plugins:

  • Intellij IDEA
  • Visual Studio Code
    • i18n Ally very recommended i18n manager that helps you in the internationalization part of the proyect. If correctly configured it lets you visualize whether something is traduced or is neeeded, and has a tab to navigate through the translation tree, as well as a coverage for every language.
    • ESLint
    • Path Intellisense autocompletition
    • Brack Pair Colorizer visually see matching brackets
    • Auto Close Tag write 1 tag and forget of the closing tag part 1
    • Auto Rename Tag write 1 tag and forget of the closing tag part 2
    • Todo Tree marks TODO and you can see all of the TODOs. Why having TODOS?
    • Project Manager simple launcher of all projects, very very useful to navigate through projects
    • Material Icon Theme visually see files and folders in the explorer tree, there are other themes as well.
    • Hungry Delete use 1 backspace instead of 2+
    • Git Graph visually see git commits
    • ES7 React/Redux/GraphQL/React-Native snippets code generator inside files, components, hooks, etc. cactus should replace this?

configuration enviroments

Learning keybindings and software capabilities is one more step to a faster development.

Visual Studio Code

Intellij IDEA

6. Workflow examples

//TODO

7. Tecnologies

8. Bibliography