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

pddev

v1.0.6

Published

Helpful console utilities for developers to use on their local machines

Downloads

24

Readme

pddev

Helpful tools for developers. Currently focused on SQL interaction from the command line.

Getting Started

Globally install pddev from npm...

npm install -g pddev

Globally install the following support packages from npm...

npm install -g postgrator, postgrator-cli, mssql

Create a config.json file wherever your pddev got installed globally -
usually C:\users\<username>\AppData\Roaming\npm\node_modules\pddev

Paste in the below initial content, replacing whatever sql local user your dev team uses...

{
  "host": "127.0.0.1",
  "port": 1433,
  "username": "theNameOfYourLocalSqlUser",
  "password": "thePasswordForYourLocalSqlUser"
}

Commands

Commands:
    help          Display help
    migratedb, m  Migrate database using scripts in local sql folder
    nukedb, n     Nuke database (drop, then create empty)
    rebuilddb, r  Rebuild your database (drop, create, migrate)
    restoredb, s  Restore database from bak file
    test, t       Test cool new console stuffs
    version       Display version

  Options:
    -d, --databaseName  The database you want to act on
    -h, --help          Output usage information
    -v, --version       Output the version number

Examples

****** The following can be executed anywhere ******

NukeDb

Nuke will kill all existing connections on named database, drop the database, recreate the database (empty), then ensure your local sql user has the appropriate rights on the database.

pddev-nukedb -d databaseName

Equivalent to...

pddev n -d databaseName

****** The following require a sql folder relative to where the commands are invoked ******

RestoreDb

Restore will perform a nuke, then it will look for ./sql/restore.bak relative to where the command is invoked. It will restore the restore.bak into the named database. The databaseName provided must match the filenames in the restore.bak file.

pddev-restoredb -d databaseName

Equivalent to...

pddev s -d databaseName

****** The following also require a postgrator.json file where the commands are invoked - our convention is at the root of the repo, in addition to a sql folder ******

Create the following file - postgrator.json. The convention is that each repo has one database it is responsible for. That database is configured for migrations here. We are using postgrator - https://github.com/rickbergfalk/postgrator and postgrator-cli - https://github.com/MattiLehtinen/postgrator-cli for migrations.

{
    "migrationDirectory": "sql",
    "driver": "mssql",
    "host": "127.0.0.1",
    "port": 1433,
    "database": "databaseNameForMigrations",
    "username": "theNameOfYourLocalSqlUser",
    "password": "thePasswordForYourLocalSqlUser",
    "schemaTable": "DbMigrationVersion"
}

Postgrator also requires the sql folder to hold the sequential list of sql scripts needed to migrate the database. See https://github.com/rickbergfalk/postgrator for details.

MigrateDb

Migrate will execute whatever sql scripts in the sql folder have not been executed already against the provided database.

No database name is needed because the configuration info in postgrator.json is used to migrate the database.

pddev-migratedb

Equivalent to...

pddev m

RebuildDb

Rebuild will execute a full Nuke, then a Migrate

pddev-rebuilddb -d databaseName

Equivalent to...

pddev r -d databaseName