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

flatdep

v1.1.10

Published

flat dependencies files

Downloads

98

Readme

flatdep

A tool to generate flat dependencies files

Install

npm i flatdep

Usage

package.json:

{
    "name": "flatdep-test",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "dependencies": {
        "@babel/polyfill": "^7.12.1",
        "axios": "^0.27.2",
        "backbone": "^1.4.1",
        "bootstrap": "^5.2.0",
        "d3": "^7.6.1",
        "gauge": "^4.0.4",
        "jquery": "^3.6.0",
        "react": "^18.2.0",
        "vue": "^3.2.37"
    },
    "devDependencies": {}
}

config:

const flatdep = require('flatdep');
const d = flatdep({
    //stop log message
    silent: false,
    //no browser
    noBrowser: false,
    //project entry path (package.json folder)
    entry: './flatdep-test',
    //target runtime path to files
    target: './flatdep-test/demo',
    //node_modules path to detect dependencies
    nodeModules: '',
    //exclude/include modules
    exclude: ['jquery'],
    include: [],
    //override module config
    overrides: {
        '@babel/polyfill': {
            main: 'dist/polyfill.min.js',
            dependencies: null
        },
        axios: {
            main: 'dist/axios.min.js',
            browser: null,
            dependencies: null
        },
        bootstrap: {
            main: ['dist/css/bootstrap.min.css', 'dist/js/bootstrap.min.js']
        },
        d3: {
            main: 'dist/d3.min.js',
            dependencies: null
        },
        gauge: {
            dependencies: null
        },
        jquery: {
            main: 'dist/jquery.min.js'
        },
        vue: {
            dependencies: {},
            main: 'dist/vue.runtime.global.prod.js'
        },
        react: {
            dependencies: {},
            main: 'umd/react.production.min.js'
        }
    }
});
if (d.error) {
    console.log(d.error);
}
console.log(d.modules);
//console.log(d.files);
flatdep.print(d);

see test test/test.js

print results:

[flatdep-test] Module Tree:
┌───────────────────┬─────────┬─────────┐
│ Module Name       │ Version │ Status  │
├───────────────────┼─────────┼─────────┤
│ ├ @babel/polyfill │ 7.12.1  │         │
│ ├ axios           │ 0.27.2  │         │
│ ├ backbone        │ 1.4.1   │         │
│ │ └ underscore    │ 1.13.4  │         │
│ ├ bootstrap       │ 5.2.0   │         │
│ ├ d3              │ 7.6.1   │         │
│ ├ gauge           │ 4.0.4   │         │
│ ├ jquery          │ 3.6.0   │ ignored │
│ ├ react           │ 18.2.0  │         │
│ └ vue             │ 3.2.37  │         │
└───────────────────┴─────────┴─────────┘
[flatdep-test] Module Files:
┌─────┬──────────────────────────────────────┬───────────┐
│ NO. │ Files (../node_modules)              │      Size │
├─────┼──────────────────────────────────────┼───────────┤
│   1 │ @babel/polyfill/dist/polyfill.min.js │  96.95 KB │
│   2 │ axios/dist/axios.min.js              │  20.28 KB │
│   3 │ underscore/underscore-umd.js         │  66.81 KB │
│   4 │ backbone/backbone.js                 │  76.35 KB │
│   5 │ bootstrap/dist/css/bootstrap.min.css │ 190.14 KB │
│   6 │ bootstrap/dist/js/bootstrap.min.js   │   58.7 KB │
│   7 │ d3/dist/d3.min.js                    │ 272.05 KB │
│   8 │ gauge/lib/index.js                   │   7.12 KB │
│   9 │ react/umd/react.production.min.js    │  10.49 KB │
│  10 │ vue/dist/vue.runtime.global.prod.js  │  82.45 KB │
└─────┴──────────────────────────────────────┴───────────┘

CHANGELOG

  • v1.1.10

    • update deps
  • v1.1.9

    • fixed main is dir, should support dir/index.js
  • v1.1.7

    • added checking for mismatched version
  • v1.1.6

    • refactor for browser property
  • v1.1.5

    • added log for module config not found
  • v1.1.4

    • fixed option when call getModuleFiles API
    • output initOption API
  • v1.1.2

    • fixed browser override and path
  • v1.1.1

    • fixed link module
  • v1.1.0

    • added exclude/include