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

@metrists/webpack

v0.0.3

Published

metrists - Simple Localization as a Service

Downloads

2

Readme


Downloads Per Month Top Language License: MIT <metrists>

Description

The Metrists webpack is a WebPack plugin that helps you include your localization files in your webpack build.

Metrists webpack is intended to be used with a Metrists CLI, and a internationalization library. We highly recommend that you use i18next with Metrists.

Table of Contents

Installation

npm install @metrists/webpack

or using yarn

yarn add @metrists/webpack

Creating a .metristsrc file

The best way to configure Metrists on your repository is to create a .metristsrc file in the root directory of your project. This way this package, and Metrists CLI will reference a single source of truth about your localization.

an example .metristsrc:

{
  "resolvePath": "src/locals",
  "fetcher": "github",
  "envPath": ".env",
  "fetcherParams": {
    "repo": "env.LOCALS_REPO",
    "org": "env.LOCALS_ORG"
  }
}

Differentiating Build Path from Development

By default, Metrists will copy paste the contents of your resolvePath argument in your build folder. If you wish to configure a different route inside the build, you can use the resolvePathBuild parameter, to differentiate your build path:

{
  "resolvePath": "src/locals",
  "resolvePathBuild": "locals",
  "fetcher": "github",
  "envPath": ".env",
  "fetcherParams": {
    "repo": "env.LOCALS_REPO",
    "org": "env.LOCALS_ORG"
  }
}

Webpack Configuration

Once installed, you need use CopyMetristsFiles inside your webpack configuration, as a plugin:

Webpack config file:

const CopyMetristsFiles = require('@metrists/webpack');
// Webpack config object
return {
  plugins: [CopyMetristsFiles()],
};

If you have created and configured your .metristsrc, the plugin will read your configuration and move the file to the correct spot inside the build. If you are not using .metristsrc, you can pass your resolvePath directly to the plugin.

No .metristsrc File

If you wish to not create a .metristsrc configuration file, you can pass a resolvePath and optionally a resolvePathBuild to the plugin directly:

The output of all fetchers should look like this:

const CopyMetristsFiles = require('@metrists/webpack');
// Webpack config object
return {
  plugins: [
    // plugins here...
    CopyMetristsFiles(
      resolvePath: 'src/locals',
      resolvePathBuild : 'locals'
    )
  ],
};

🌕 If you do not pass in a resolvePathBuild to the plugin, the plugin will use resolvePath as the build path too.

Contributing

This package is a beginner-friendly package. If you don't know where to start, visit Make a Pull Request to learn how to make pull requests.

Please visit Contributing for more info.

Code of Conduct

Please visit Code of Conduct.


License

MIT