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

versioner-tool

v2.0.0

Published

CLI tool and library to make it easier to change versions in project configuration files. Suitable for projects where version is stored in multiple locations.

Downloads

15

Readme

Jazyk: EN, CZ

Versioner

CLI nástroj a knihovna pro usnadnění práce při měnění verze v konfiguračních souborech v projektech. Vhodné pro projekty, kde je verze uložena na více místech.


Instalace

  • NPM
    • Globální
      • npm install --global versioner-tool
    • Lokální
      • npm install --save-dev versioner-tool
      • npm install -D versioner-tool
  • YARN
    • Globální
      • yarn global add versioner-tool
    • Lokální
      • yarn add --dev versioner-tool
      • yarn add -D versioner-tool

Použití CLI

versioner <file.json ...> [-s | --set <version>] [-t | --tag <path.to.version>] [-f | --file-format <format>] 
versioner <file.json ...> [-n | --next <level>] [--preid <preid>] [-t | --tag <path.to.version>] [-f | --file-format <format>]
versioner [-v | --version]
versioner [-h | --help [<lang>]]

Přepínače

  • -s, --set
    • Nastaveni konkrétní verze v daném souboru/souborech.
    • Verze musí být ve formátu Major.Minor.Patch
  • -n, --next
    • Zvýší verzi v souboru dle zadané úrovně.
    • Možné úrovně: major, minor, patch, prerelease, premajor, preminor, prepatch.
      • -n path: 1.2.3 => 1.2.4
      • -n minor: 1.2.3 => 1.3.0
      • -n major: 1.2.3 => 2.0.0
  • -t, --tag
    • Změní cestu k nalezení verze v souboru.
    • Pokud není použito, tak výchozí cesta je version.
      • : { "version": "1.2.3", ... }
    • Kroky v cestě jsou doděleny tečkami.
      • -t ver: { "ver": "1.2.3", ... }
      • -t conf.env.version: { "conf": { "env": { "version": "1.2.3", ... }, ... }, ... }
  • --preid
    • Identifikátor, který se použije k předponě v předběžné verzi.
      • např. prerelease, prepatch, preminor, premajor
  • -f, --file-format
    • Určení typu/formátu souboru.
    • Podporované hodnoty: json
  • -v, --version
    • Vytiskne verzi tohoto nástroje.
  • -h, --help
    • Vypíše nápovědu.
    • -h cz | -h cs: Nápověda v českém jazyku.
    • -h | -h en: Nápověda v anglickém jazyku.

Použití knihovny

  • Typescript
import { readVersion, writeVersion, nextVersion, ReleaseType } from 'versioner-tool'
// nebo
import * as versioner from 'versioner-tool'
  • Javascript
const readVersion = require('versioner-tool').readVersion
const writeVersion = require('versioner-tool').writeVersion
const nextVersion = require('versioner-tool').nextVersion
// nebo
const { readVersion, writeVersion, nextVersion } = require('versioner-tool')
// nebo
const versioner = require('versioner-tool')

Dokumentace

readVersion(config: {
	pathToFile: string, 
	pathToVersionInFile?: string, 
	fileType?: FileType, 
}): Promise<{
  oldVersion: string | undefined,
  newVersion: string | undefined,
}>
  • Funkce načte verzi uloženou v souboru a vráti ji v oldVersion.
  • pathToFile: Cesta k souboru.
  • pathToVersionInFIle: Cesta k nalezení verze v souboru.
    • Výchozí hodnota je version.
    • např. ver, info.version, path.to.version
  • fileType: Typ souboru.
    • Podporované typy: json (V budoucnu i yaml.)
    • Výchozí hodnota je json.
writeVersion(config: {
  newVersion: string,
  pathToFile: string,
  pathToVersionInFile?: string,
  fileType?: FileType,
}): Promise<{
  oldVersion: string | undefined,
  newVersion: string | undefined,
}>
  • Funkce zapíše zadanou verzi do souboru a vráti starou hodnotu v oldVersion a novou hodnotu v newVersion.
  • newVersion: Verze, která bude zapsána do souboru.
  • pathToFile: Cesta k souboru.
  • pathToVersionInFIle: Cesta k nalezení verze v souboru.
    • Výchozí hodnota je version.
    • např. ver, info.version, path.to.version
  • fileType: Typ souboru.
    • Podporované typy: json (V budoucnu i yaml.)
    • Výchozí hodnota je json.
nextVersion(config: {
  releaseType: ReleaseType,
  pathToFile: string,
  pathToVersionInFile?: string,
  fileType?: FileType,
  identifier?: string,
}): Promise<{
  oldVersion: string | undefined,
  newVersion: string | undefined,
}>
  • Funkce přečte verzi ze souboru a z ní vygeneruje novou verzi, kterou poté zapíse do souboru. Funkce vraci starou verzi v oldVersion a novou verzi v newVersion.
  • releaseType: Typ vydání, který určuje, jak se verze změní.
    • Podporované hodnoty: major, minor, path, prerelease, premajor, preminor, prepath.
  • pathToFile: Cesta k souboru.
  • pathToVersionInFIle: Cesta k nalezení verze v souboru.
    • Výchozí hodnota je version.
    • např. ver, info.version, path.to.version
  • fileType: Typ souboru.
    • Podporované typy: json (V budoucnu i yaml.)
    • Výchozí hodnota je json.
  • identifier: Identifikátor, který se použije k předponě v předběžné verzi.
    • Platí pro releaseType s hodnotami prerelease, premajor, preminor, prepath.