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

ddm-js

v0.0.1

Published

Reusable node packages for everyone.

Downloads

1

Readme

ddm-js

Intended for reusable node packages (react and regular old js things) that we have traditionally just copied and pasted across projects. Stop it now!

Developing locally

To install modules in this repo from this repo run lerna add module --scope=moduleToInstallTo from the root directory.

To install from this repo locally run npm install /path/to/local/package and npm should install it.

About

This repo relies on the lerna package to manage all of the node packages in the packages folder.

Linting

This project is taking a no nonsense approach to code standards. We are using standardjs to do all of the linting and to make the code consistent. If you don't like it you can petition to use something different and the collective "we" will discuss changing it, but I was here first so this is what we are doing. There is a precommit hook that will run the linter and fix any issues that it can, but you may have to fix some yourself. If you can't, then you don't get to commit. It's as easy as that.

Testing

This is a big question mark. I feel like the code here should be tested, but nothing is currently set up for that. If you have ideas please try them out and we can standardize them and ensure better code quality with our shared code.

Example Project

Please use the example project to test your code to ensure that it is independent from anything else. Your packages should not rely on the code in your project to run and be displayed properly. If there is an npm dependency that is included in your project, such as react or react-dom use the peerDependencies in the package.json file to declare that they are needed.

NOTE:

If a package needs to be scoped this needs to be added to the package.json file, because we don't have a private npm registry.

"publishConfig": {
  "access": "public"
}

React component notes:

  • Include a .npmignore file
  • Make sure react and react-dom are peer dependencies in package.json and webpack.config.js, not dependencies
  • Include a pre-publish script that builds your component (run before publishing)
  • File examples:
package.json (partial file): 
  "main": "dist/component-name.js",
  "scripts": {
    "prepublish": "rm -rf ./dist && npm run build",
    "build": "webpack"
  },
  "peerDependencies": {
    "react": "15.x",
    "react-dom": "15.x"
  },
  "devDependencies": {
    "babel": "^6.23.0",
    "babel-loader": "^7.1.5",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "prop-types": "^15.6.2",
    "react": "^16.4.1",
    "react-dom": "^16.4.1",
    "webpack": "^4.16.3",
    "webpack-cli": "^3.1.0"
  }
  
-----------------------------------
webpack.config.js (full file)

const path = require("path");

module.exports = env => {
  return {
    entry: "./index.js",
    output: {
      path: path.join(__dirname, './dist'),
        filename: 'component-name.js',
        libraryTarget: 'umd',
        publicPath: '/dist/',
        umdNamedDefine: true
    },
    module: {
      rules: [
        {
          test: /\.(js|jsx)?$/,
          loader: "babel-loader",
          exclude: /node_modules/,
          query: {
            presets: ["react", "stage-2", "env"]
          }
        }
      ]
    },
    resolve: {
      alias: {
        'react': path.resolve(__dirname, './node_modules/react'),
        'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
      }
    },
    externals: {
      // Don't bundle react or react-dom
      react: {
        commonjs: "react",
        commonjs2: "react",
        amd: "React",
        root: "React"
      },
      "react-dom": {
        commonjs: "react-dom",
        commonjs2: "react-dom",
        amd: "ReactDOM",
        root: "ReactDOM"
      }
    }
  };
};