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

plugin-preloader

v1.0.0

Published

This library dynamically preloads and installs Babel and ESLint plugins and presets based on your configuration, streamlining the build process without the need to include them as dependencies in your project.

Downloads

11

Readme

plugin-preloader

This library offers a method for preloading Babel and ESLint packages according to their configurations, ensuring that all necessary packages are installed before initiating any build process. This plugin is designed to dynamically install plugins without the need to include them in your project's dependencies, thus streamlining the setup process.

Features

  • Automatically install Babel and ESLint packages based on their configuration files.
  • Supports both latest and specific package versions.

Installation

To install the library, run the following command:

npm install --save-dev plugin-preloader

Usage

The preload function can operate effectively with standard Babel and ESLint configurations, ensuring that each plugin, preset, parser, or extend is processed and installed at the most recent version.

To designate a specific version rather than the latest for Babel plugins and presets, you can use the fourth element in the plugin/preset definition array item, bypassing the second and third elements - ["@babel/preset-react", undefined, undefined, "7.0.0"].

To designate the required version for ESLint plugins, extends, and parsers, use an array instead of a string and place the desired version as the second element in the array - ["plugin:@typescript-eslint/recommended", "3.0.0"].

const sampleBabelConfig: BabelConfig = {
  presets: [["@babel/preset-react", undefined, undefined, "7.0.0"]],
  plugins: [
    "@babel/plugin-transform-runtime",
    ["@babel/plugin-proposal-decorators", {}],
    ["@babel/plugin-proposal-private-methods", undefined, undefined, "8.0.0"],
  ],
  env: {
    test: {
      presets: [["@babel/preset-env", "7.0.0"]],
    },
  },
};

const sampleEslintConfig: ESLintConfig = {
  extends: [
    "eslint:recommended",
    ["plugin:react/recommended", "6.0.0"],
    "plugin:@typescript-eslint/recommended",
  ],
  plugins: ["abcsize", ["react-hooks", "2.4.0"]],
  parser: ["@typescript-eslint/parser", "3.4.5"],
};

Preload

const preload = require("plugin-preloader");

preload({ babel: sampleBabelConfig, eslint: sampleEslintConfig });

In addition, we have provided a sample project in the example folder.

API

syncPreload({ babel, eslint })

  • Parameters:
  • Returns: void
  • Description: Installs the required packages synchronously based on the Babel and ESLint configurations.

Known Issues

  • Incompatibility with pnpm package manager: This project may not function correctly with the pnpm package manager. It is recommended to use npm or yarn for better compatibility and a smoother experience

  • Possible disruption of existing dependencies: Due to the complex nature of the installation process, this project could potentially break already installed dependencies. As a result, your project might not build as expected and may require reinstalling the node modules

  • Restoring the initial node modules structure: If you encounter issues with your node modules, you can execute the npm prune or yarn install commands to restore the initial node modules structure and resolve any discrepancies. This will help ensure your project builds correctly after using the library

  • Babel plugins/presets definition methods: This project supports only string as the first item in the Babel plugin/preset definition array. If you use a different method, the library will not be able to install the required packages

  • Lack of support for plugins/presets: This project has limited support for Babel/ESLint plugins and presets. If you use a plugin/preset not supported by the library, it will not be installed. The supported Babel plugins and presets can be found and added here. The supported ESLint plugins, extends, and parsers can be found and added here

Development

In order to start contributing to plugin-preloader, you can follow these steps: CONTRIBUTING.md

CHANGELOG

If you want to see what changed between versions: CHANGELOG.md