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

fabrik

v1.0.0-rc2

Published

Fabrik is a cli to scaffold anything

Downloads

10

Readme

fabrik Node.js CI Node.js Package

Fabrik is a cli to scaffold anything

Install

$ npm install --global fabrik

Usage

Remember to setup your fabrik.config.js and /fabrik-templates before you get going

$ fabrik --help
// or
$ fa --help

  Usage
    $ fabrik [name] -t service -d app/services

  Options
    --type, -t  service
    --dir, -d  app/services/

Setup

Config

Start by adding fabrik.config.js to the root of your project, this is the bare minimum to define

module.exports = {
  // Project root (Required)
  basePath: __dirname,

  // Directory where your module templates are defined
  templatesFolder: "/fabrik-templates",

  // Array of module configurations to scaffold
  modules: [
    {
      // Name of the module
      type: "service",

      // Shorthand/alias
      alias: "s",

      // Default directory to output to
      output: "app/services",

      // File endings to output from your template folder
      fileTypes: ["js", "spec.js"]
    }
  ]
};

Templates

By default inside your /fabrik-templates folder you need to add folders for the modules you wanna create in this case we're creating a service with a default spec file

Inside: /fabrik-templates/service we create .js and .spec.js

Here is the variables accessable:

  • FABRIK_NAME
  • FABRIK_NAME_FIRST_LETTER_CAPITALIZED
  • FABRIK_NAME_LOWER
  • FABRIK_NAME_SLUGIFIED
Example ts
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root',
})
export class FABRIK_NAME_FIRST_LETTER_CAPITALIZED {
  constructor() {}
}
Example spec.ts
import { TestBed } from '@angular/core/testing';

import { FABRIK_NAME_FIRST_LETTER_CAPITALIZED } from './FABRIK_NAME_SLUGIFIED';

describe('FABRIK_NAME_FIRST_LETTER_CAPITALIZED', () => {
  let service: FABRIK_NAME_FIRST_LETTER_CAPITALIZED;

  beforeEach(() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(FABRIK_NAME_FIRST_LETTER_CAPITALIZED);
  });

  it('should be created', () => {
    expect(service).toBeTruthy();
  });
});

Example command and output

Given the above configuration, and we run the following command fabrik productState --type service the output would look as following:

Example output product-state.ts
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root',
})
export class ProductState {
  constructor() {}
}
Example output product-state.spec.ts
import { TestBed } from '@angular/core/testing';

import { ProductState } from './product-state';

describe('ProductState', () => {
  let service: ProductState;

  beforeEach(() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(ProductState);
  });

  it('should be created', () => {
    expect(service).toBeTruthy();
  });
});