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

dept

v0.1.12

Published

Dependencies templates management CLI to install your fixed NPM or Yarn dependencies and cofing files to your project.

Downloads

12

Readme

dept

NPM version npm module downloads Build Status Dependency Status License: MIT Greenkeeper badge

Dependencies templates management CLI to install your fixed NPM or Yarn dependencies and cofing files to your project.

Usage

$ dept -h
Usage: dept <command> [options]

Commands:
  dept list                    Show all templates                  [aliases: ls]
  dept show [templateName]     Show a template in details           [aliases: s]
  dept default [templateName]  Use a template by default           [aliases: df]
  dept install [templateName]  Install dependencies and config files from a
                               template                             [aliases: i]
  dept add [templateName]      Add a template with '--data' or '--file'
                               options                              [aliases: a]
  dept remove [templateName]   Remove a template                    [aliases: r]
  dept rename [templateName]   Rename a template name
  [newTemplateName]                                                [aliases: mv]
  dept view [templateName]     View a filed in a template
  [viewStatement]                                                   [aliases: v]
  dept update [templateName]   Update a field in a template
  [updateStatement]                                                 [aliases: u]
  dept export [templateName]   Export a JSON template file          [aliases: e]
  dept listenv                 Show all package managers          [aliases: env]
  dept useenv [environment]    Use a package manager              [aliases: use]
  dept json2yaml               Convert a JSON format to a YAML
                               format with '--data' or '--file'
                               options                             [aliases: jy]
  dept yaml2json               Convert a YAML format to a JSON
                               format with '--data' or '--file'
                               options                             [aliases: yj]

Options:
  --version, -v  Show version                                          [boolean]
  --data, -d     Specify a JSON or YAML data string with 'add',
                 'json2yaml' or 'yaml2json'                             [string]
  --file, -f     Specify a JSON or YAML file with 'add', 'json2yaml'
                 or 'yaml2json'                                         [string]
  --filename, -n  Specify a filename of a JSON or YAML file with 'export',
                  'json2yaml' or 'yaml2json'                            [string]
  --out-dir, -o   Specify an output directory path to export a JSON or YAML
                  file with 'export', 'json2yaml' or 'yaml2json'        [string]
  --help, -h     Show help                                             [boolean]

Template JSON/YAML format

You can define the following properties.

  • dependencies: NPM package dependencies
  • devDependencies: NPM package devDependencies
  • files: Config files like .eslintrc, .travis.yml and so on. If file extension is 'yaml' or 'yml', it is exported as a YAML file.

JSON example:

{
  "dependencies": {
    "module-name-A": "1.0.0"
  },
  "devDependencies": {
    "module-name-B": "*",
    "module-name-C": "^2.1.1"
  },
  "files": {
    "file-name-A.json": {
      "any-prop-1": [
        "any-element-1",
        "any-element-2",
        "any-element-3"
      ],
      "any-prop-2": {
        "any-value-1": 123,
        "any-value-2": true,
        "any-value-3": "something"
      },
      "any-prop-3": "anything"
    },
    "file-name-B.txt": "Hello World",
    "file-name-C.yml": {
      "any-value": "any-value",
      "any-list": [
        "any-element-1",
        "any-element-2"
      ]
    }
  }
}

YAML example:

dependencies:
  module-name-A: 1.0.0
devDependencies:
  module-name-B: '*'
  module-name-C: ^2.1.1
files:
  file-name-A.json:
    any-prop-1:
      - any-element-1
      - any-element-2
      - any-element-3
    any-prop-2:
      any-value-1: 123
      any-value-2: true
      any-value-3: something
    any-prop-3: anything
  file-name-B.txt: Hello World
  file-name-C.yml:
    any-value: any-value
    any-list:
      - any-element-1
      - any-element-2

Real world's templates' examples are HERE.

Use cases

Install your fixed template to your existing project

You can add your fixed template with dept add then install the template to your existing project with dept install. And you can set a default template with dept default.

$ dept add react-eslint-prettier -f ./template.json
$ dept default react-eslint-prettier
$ dept list
* react-eslint-prettier
  express-typescript
  vue-nuxt
$ cd your-app # Already NPM installed
$ dept install

Install your fixed template in your new project

It initializes your new project automatically if package.json doesn't exist.

$ dept list
* react-eslint-prettier
  express-typescript
  vue-nuxt
$ mkdir your-new-app
$ cd your-new-app # NOT NPM installed
$ dept install

Install your fixed template in your new project with Yarn

You can also use yarn instead of npm after you change a package manager with env and use.

$ dept env
* npm
  yarn
$ dept use yarn
$ dept env
  npm
* yarn
$ dept list
* react-eslint-prettier
  express-typescript
  vue-nuxt
$ mkdir your-new-app
$ cd your-new-app # NOT Yarn installed
$ dept install

Specify a template from your fixed templates

Of course, you can specify a template you'd like to use in your project after dept install.

$ dept list
* react-eslint-prettier
  express-typescript
  vue-nuxt
$ cd your-app
$ dept install express-typescript

View a field in a template

You can view a field in a template with dept view.

$ dept list
* react-eslint-prettier
  express-typescript
  vue-nuxt
$ dept view express-typescript "dependencies"
{
        "express": "^4.16.0",
        "mongoose": "*"
}
$ dept view express-typescript "dependencies.express"
"^4.16.0"

Update a field in a template

You can update a field in a template with dept update. Either dependencies, devDependencies or files is updatable.

$ dept list
* react-eslint-prettier
  express-typescript
  vue-nuxt
$ dept update express-typescript "dependencies={\"express\":\"^4.16.4\", \"mongoose\":\">=5.3.10\"}"

Export a template file as JSON format

You can export a JSON template file with dept export to share it.

$ dept list
* react-eslint-prettier
  express-typescript
  vue-nuxt
$ dept export react-eslint-prettier --filename fixed-react-eslint-prettier.json --out-dir ./fixed-templates-dir

Helper commands

Convert a JSON file to a YAML file

You can convet a JSON file to a YAML file with dept json2yaml.

$ dept json2yaml --file ./data.json --filename your-data.yml --out-dir ./converted-dir
$ ls ./converted-dir/
your-data.yml
$ dept jy -f ./data.json # Short expression
$ ls ./
data.yml

Convert a YAML file to a JSON file

You can convet a YAML file to a JSON file with dept yaml2json.

$ dept yaml2json --file ./data.yml --filename your-data.json --out-dir ./converted-dir
$ ls ./converted-dir/
your-data.json
$ dept yj -f ./data.yml # Short expression
$ ls ./
data.json