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

sequelize-cli-helpers

v0.1.1

Published

Better Sequelize CLI tools.

Downloads

7

Readme

sequelize-cli-helpers

A power-up for Sequelize at the command line.

Intro

Sequelize is a powerful ORM, and while sequelize-cli is helpful, in our workflow we have found several gaps. sequelize-cli-helpers is our power-up for improving our Sequelize workflow, especially for generating migrations and models.

This is not a full replacement for sequelize-cli. For performing and managing migrations, you will still need that tool.

Usage

  • $ sequelize-cli-helpers <command>

Commands

Commands:
  gen:migration:table  generates a Sequelize migration to create a table
  touch                generates a file name and touches the empty file

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

Configuration

You can configure sequelize-cli-helpers for your project with a .sequelizeclihelpersrc file in the root of your project.

The .sequelizeclihelpersrc can overwrite any part of the configuration.

Here is an example of what you can do:

module.exports ={
  dateFormat: 'YYYYMMDDHHmmss',   // format of date string to be used in file naming
  fileExtension: 'js',
  fileNameFormat: 'N.D',          // format of file name to be generated, see below
  forceConfirmation: true,        // forces prompt for confirmation of some values
  matchNumberOn: 'N',             // if using a 'N' format in your string, this determines how to calculate the next number
  numberPaddedLength: 4,          
  separator: '-',                 // separator to use between each part of the name, e.g. `20190311133906-create_table_hufflepuffs.js`
  paths: {
    templates: path.resolve('./db/templates/'),  // path to your custom templates, see below
  }
};

File Name Formats

One of the uses of sequelize-cli-helpers is to control the naming of your sequelize-cli migration, seeders, and model files. Not all teams want to use the default sequelize-cli behavior, and this tool provides complete control of that naming, and makes part of it automatic.

The file name format is configured in the .sequelizeclihelpersrc file, and is a string such as 'Tz.D'.

The following format parts can be utilized:

  • Tz a date string configured per the dateFormat
  • N a number string left padded with zeroes to numberPaddedLength
  • D a description
  • G git branch info pulled from your repo, the branch name is parsed and the text of the branch name after the first / will be used.
  • R a random string

You can order the file name format in any order excepting that a date Tz or a number N must come first.

The number will be auto-generated based on other files with numbers in their names and filted by the date format to match on, the matchNumberOn. If matchNumberOn === 'N', then it will consider all files of the same format with a number; if matchNumberOn === 'G', the existing files will be filtered on by git info; and so on. From these filtered lists, the number of the last file name in the list will be used to generate the next number.

Custom Templates

sequelize-cli-helpers has a default template to create a Sequelize table migration, see migration_create_table.hbs. You can provide your own for your project so long as you provide a path.templates in your .sequelizeclihelpersrc file, and have a template of the same name (migration_create_table.hbs) in that path, and the template must handle the same provided context keys (see our migration file, must handle tableName, attributes).

Version

This is currently a pre-1.0 project.

If you want to see where we think we are headed, please see SPEC.md.

Branches

| Branch | Status | Coverage | | | ------ | ------ | -------- | - | | develop | | | Work in progress | | master | | | 0.1.1 |

Contributing

See CONTRIBUTING.md.