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

@wudev/tools-build-dist

v1.0.3

Published

Tools to build and dist components or libraries

Downloads

5

Readme

Tools to build and dist components or libraries

Version Author

This is a set of tools for building or distribuiting components or libraries.

Installation

To install use npm:

npm install @wudev/tools-build-dist -D

Commands

npx vite-ctl

Convert a project of Vite in a library.

It was inspired in the doc Create a Component Library Fast🚀(using Vite's library mode) of Andreas Riedmüller

npx wudev-replace

Replace strings in files.

Config file wudev.replace.config.js

Example:

const config = [
	{
		paths: ['dist'],
		types: ['php'],
		replace: [
			{
				patterns: '//--start-only-debug--+(\\s|\\S)+//--end-only-debug--',
				replacement: '',
				patternsIsRegex: true,
			},
			{
				patterns: '--last-version--',
				replacement: new Date().getTime(),
			},
		],
	},
];

export default config;

Where:

config is an array of objects that defines rules for replacing strings in files.

Each object in the config array represents a set of replacement rules for a specific set of files.

  • paths: An array of directory paths where the files to be replaced are located. In this case, files in the 'dist' directory will be targeted.

  • types: An array of file types that the replacements will be performed on. In this case, '.php' files will be targeted.

  • replace: An array of objects that define the replacement rules. Each object has three properties:

    • patterns: The string or regular expression to be searched for in the files. If patternsIsRegex is true, patterns will be treated as a regular expression.
    • replacement: The string that will replace the matches found for patterns in the files.
    • patternsIsRegex: A boolean that indicates whether patterns should be treated as a regular expression. If true, patterns will be treated as a regular expression.

npx wudev-cpreadme

Copy the readme into a html, jsx or/and tsx file.

How to use

Add the file examples/index.html and the file src/Readme.tsx in your project. In examples/index.html add the element <div id="readme"></div> where the content of the README.md will be placed. If the element is not added, the README.md wil be added at the beginning of the body. For src/Readme.tsx, the entire content of all file will be replaced by the content of README.md.

Params
--write-in-html true|false
--write-in-jsx true|false
  • --write-in-html: Enable or disable the copy in examples/index.html.
  • --write-in-jsx: Enable or disable the copy in src/Readme.tsx.
Config file wudev.cpreadme.config.json

It is possible use the following configuration to change the files where README.md will be copied and also the path of README.md.

Example:

{
	"readmeFile": "./README.md",
	"writeInHtml": true,
	"htmlFile": "./examples/index.html",
	"writeInJsx": true,
	"jsxFile": "./src/Readme.tsx"
}
  • readmeFile: The path of the README.md.
  • writeInHtml: Enable or disable the copy in the html file.
  • htmlFile: The path of the html where the README.md will be copied.
  • writeInJsx: Enable or disable the copy in the jsx file.
  • jsxFile: The path of the jsx or tsx where the README.md will be copied.

Note

If the package is installed globally, the commands will be able to used without npx

Author

sgb004

License

MIT