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

neaten-transfer-webpack-plugin

v1.0.5

Published

Put together to folder and Transfer to new document location

Downloads

9

Readme

NPM version GitHub license

neaten-transfer-webpack-plugin

用于将多个不在同级目录中文件或多个不在同级目录中文件夹复制到另一个文件中的webpack plugin,会在webpack打包编译结束之后执行。

使用方法

首先,你需要安装这个插件,如下:


npm install neaten-transfer-webpack-plugin --save-dev

配置 webpack plugins 参数


const NeatenTransferWebpackPlugin = require('neaten-transfer-webpack-plugin')

module.exports = {
    //...
    plugins: [new NeatenTransferWebpackPlugin({
        from: [{
            path: path.resolve(__dirname, './'),
            name: 'dist'
        }, {
            path: path.resolve(__dirname, './'),
            name: 'package.json'
        }],
        to: {
            path: path.resolve(__dirname, './'),
            name: 'new',
            cover: true
        }
    })]
    //...
};

插件参数描述

| Name | Type | Description | | :---: | :----: | :----------------------- | | from | Array | 需要被复制的文件或文件夹 | | to | Object | 被复制到的位置 |

下面是每个参数的详细描述

from

需要被复制的文件或文件夹,数组类型,支持多个 | Name | type | required | Description | | :----: | :-----: | :------: | :--------------- | | path | require | yes | 文件所在位置 | | name | String | yes | 文件名 | | rename | String | no | 重命名后的新名字 |


[
    {
        path: path.resolve(__dirname, './'),    // 文件所在位置
        name: 'dist',  // 文件名
        rename:'dist2' // 重命名后的新名字,不传则不重命名
    }
]

to

被复制到的位置,对象类型 | Name | type | required | Description | | :---: | :-----: | :------: | :-------------------------------------------- | | path | String | yes | 文件夹所在位置 | | name | String | yes | 文件夹名 | | cover | Boolean | no | 是否覆盖该文件夹下所有的文件 ,不覆盖性能更高 |


{
    path: path.resolve(__dirname, './'),    // 文件所在位置
    name: 'dist',  // 文件名
    cover: true    // true:相同的文件覆盖,不同的文件删除;false:相同的文件覆盖,不同的文件保留;默认为true
}

DOME

# 原文件位置如下,可复制为dist 和 config.js 到 new 文件夹下
- root
    - dist
        - a.js
        - b.js
    - config.js

# 复制后的文件位置:
- root
    - dist
        - a.js
        - b.js
    - config.js
    - new
        - dist
            - a.js
            - b.js
        - config.js

# 插件配置如下:
plugins: [new NeatenTransferWebpackPlugin({
    from: [{
        path: path.resolve(__dirname, './'),
        name: 'dist'
    }, {
        path: path.resolve(__dirname, './'),
        name: 'package.json'
    }],
    to: {
        path: path.resolve(__dirname, './'),
        name: 'new',
        cover: true
    }
})];