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 🙏

© 2026 – Pkg Stats / Ryan Hefner

plugin-package-init

v1.1.12

Published

a plugin for initialize package

Readme

plugin-package-init

是一个初始化开发文件夹的工具

作用

例如,下面是一个项目的开发目录

//目录结构
|-src//开发目录
    |-pages
        |-page1
            |-index.ejs
            |-index.js
            |-index.less
        ...
    |-widgets
        |-widget1
            |-index.ejs
            |-index.js
            |-index.less
        ...
|-plugin-package
    |-samplePackage//自定义的文件夹例子,放在这个目录
        |-page
            |-index.ejs
            |-index.js
            |-index.less
        |-widget
            |-index.ejs
            |-index.js
            |-index.less
        ...
package-init.config.js

输入

node package-init.config.js

之后,回答下面的问答题

命令行问答

就会将samplePackage/page/文件夹复制到src/pages/目录中,并重命名为‘testPackage’。 同时src/pages/testPackage/index.ejs的html title重命名为‘testPackage title’,并且index.ejs中只引用了index.js这份js 此处输入图片的描述

怎么用

1.在项目根目录

npm intall plugin-package

2.将node_modules/plugin-package-init/目录里的,plugin-package/目录和package-init.config.js文件复制到项目根目录中。参考作用里开发目录里的plugin-package和package-init.config.js文件的位置

3.在plugin-package/samplePackage/目录中新建你的文件夹例子

此处输入图片的描述

这里的samplePackage/index.ejs内容是这样,红框框住的是可被重写 此处输入图片的描述

4.修改package-init.config.js文件中的

let pluginConfig = {
    page: {//samplePackage里你要复制的文件夹名字,这里指的是要复制samplePackage/page/这个文件夹
        distDir: './src/pages/'//目标目录,复制的文件夹将会到这个目录
    },
    widget: {//samplePackage里你要复制的文件夹名字,这里指的是要复制samplePackage/widget/这个文件夹
        distDir: './src/widgets/'//目标目录,复制的文件夹将会到这个目录
    }
};

5.运行

node package-init.config.js

6.在命令行工具中回答下面问题 命令行问答

①复制samplePackage中的那个page文件夹。

②复制后的文件重命名为testPackage,缺省值为①的回答

③index.ejs中的html title重命名为testPackage title,缺省值为samplePackage中的index.ejs的html title

④询问samplePackage/page/index.ejs中引用的js文件,不需要jquery.js、不需要react.js、需要index.js

需要注意的

1.package-init.config.js中的pluginConfig的属性值要对应samplePackage目录下的文件 例如这里,samplePackage有page、widget两个目录

|-samplePackage
    |-page
    |-widget

那么package-init.config.js中的pluginConfig属性值只能为这两个目录

let pluginConfig = {
    page: {},
    widget: {}
};