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

making-cli

v1.0.3

Published

A cli maker for init front-end project

Downloads

14

Readme

making-cli(中文)

一个快速制作前端项目脚手架的工具。

使用说明

首先我们需要从 NPM 上下载making-cli

npm install -g making-cli

之后,我们可以直接在命令行中使用它:

making-cli --name xxxxx --output /aaa/bbb --config /ccc/ddd.js

making-cli的配置项如下:

| option | description | | ----------------- | ------------------ | | --name [name] | 脚手架名称 | | --config [config] | 脚手架配置文件 | | --output [output] | 输出脚手架文件目录 |

配置文件说明

making-cli需要根据开发者自定义的脚手架配置文件来生成项目的脚手架。 making-cli的工作流程很简单: 1、用户输入相关参数。 2、根据用户输入的参数判断对应的模板文件的 git 仓库地址。 3、clone git 仓库到对应位置并执行 npm install。

所以我们需要用一个配置文件来实现“处理用户输入的参数,并判断 git 仓库的地址”

编写配置文件

我们的配置文件需要导出一个名为 configProject()的函数,该函数的参数有: | param | description | | ----------------- | ------------------ | | program | commander 包实例化出来的 commander 对象,详见commander 说明文档 |

该函数必须返回一个对象,该对象必须有如下三个属性: | param | description | | ----------------- | ------------------ | | prompts| inquirer 包中接收的 prompts 对象,用于接收用户输入,详见inquirer 说明文档 | | setProjectName| 根据用户输入的结果,设置项目名 | | setProjectGitRepo| 根据用户输入的结果,设置 Git 仓库的地址 |

配置文件样例

const fse = require('fs-extra')

/**
 * @param {*} program commander对象
 */
const configProject = (program) => {
  /**
   * inquirer 包中接收的 prompts 对象
   */
  const prompts = [
    {
      type: 'input',
      name: 'projectName',
      message: '请输入项目目录名:'
    },
    {
      type: 'list',
      name: 'type',
      message: '请选择使用的后台框架',
      choices: [
        { title: 'exress', value: 'express' },
        { title: 'koa', value: 'koa' }
      ]
    }
  ]

  /**
   * 根据用户输入的结果,设置项目名
   */
  const setProjectName = (answer) => {
    return 'name'
  }

  /**
   * 根据用户输入的结果,设置Git仓库地址
   */
  const setProjectGitRepo = (answer) => {
    return 'direct:https://github.com/xxx/xxx-koa.git'
  }

  return {
    prompts,
    setProjectName,
    setProjectGitRepo
  }
}

module.exports = configProject

making-cli(English)

A cli generator for making front-end project cli easily.

usage

First, you need to install making-cli from NPM. npm install -g making-cli

Next, you need to use making-cli in this way:

making-cli --name xxxxx --output /aaa/bbb --config /ccc/ddd.js

the option of making-cli is:

| option | description | | ----------------- | ------------------------------------ | | --name [name] | name of cli | | --config [config] | config file of cli | | --output [output] | output path of generated cli project |

configuration file

making-cli needs to generate the cli by customizing cli configuration file. The workflow of making-cli is simple:

  1. The user enters relevant parameters.
  2. Determine the git repo path of the project template according to the parameters entered by the user.
  3. Clone git repo and execute npm install.

So we need to use a configuration file to "process the parameters entered by users and determine the address of git repo"

coding configuration file

Our configuration file needs configProject() function: | param | description | | ----------------- | ------------------ | | program | commander Object, check here for detail: commander document |

configProject() function must return an Object contains following property: | param | description | | ----------------- | ------------------ | | prompts| inquirer Object, check here for detail: inquirer document | | setProjectName| set project name by user input | | setProjectGitRepo| set git repo by user input |

配置文件样例

const fse = require('fs-extra')

/**
 * @param {*} program commander object
 */
const configProject = (program) => {
  /**
   * inquirer object
   */
  const prompts = [
    {
      type: 'input',
      name: 'projectName',
      message: '请输入项目目录名:'
    },
    {
      type: 'list',
      name: 'type',
      message: '请选择使用的后台框架',
      choices: [
        { title: 'exress', value: 'express' },
        { title: 'koa', value: 'koa' }
      ]
    }
  ]

  /**
   * set project name by user input
   */
  const setProjectName = (answer) => {
    return 'name'
  }

  /**
   * set git repo by user input
   */
  const setProjectGitRepo = (answer) => {
    return 'direct:https://github.com/xxx/xxx-koa.git'
  }

  return {
    prompts,
    setProjectName,
    setProjectGitRepo
  }
}

module.exports = configProject