Skip to content

Repository files navigation

NPM version NPM downloads Code coverage CI status License

VersaTiles Release Tools

Tools used for:

Installation

npm i -D @versatiles/release-tool

configure scripts

You need to configure the scripts in the package.json:

{
  "scripts": {
    "check": "npm run lint && npm run build && npm run test",
    "prepack": "npm run build && npm run doc",
    "release": "vrt release-npm",
    ...
  },
  ...
}
  • scripts.check is required by the release command. Here you can lint, build and test your code.
  • scripts.prepack is recommended to ensure that all files are up-to-date before releasing. Here you can build code and documentation.
  • scripts.release is recommended to make it easy to release a new version.

Holding back dependencies

By default deps-upgrade upgrades every dependency to its latest version. Dependencies that must not follow can be declared in the vrt.depsUpgrade.ignore field of your package.json:

{
  "vrt": {
    "depsUpgrade": {
      "ignore": ["path-to-regexp@<7.0.0", "typescript"]
    }
  }
}
  • An entry without a range ("typescript") blocks every upgrade of that package.
  • An entry with a semver range ("path-to-regexp@<7.0.0") only blocks versions outside that range, so patches and minor releases keep coming in. Such a package is upgraded within the range that is already declared in your package.json, e.g. "^6.3.0" is upgraded to the latest 6.x.

The same rules can be given as an object, and on the command line:

"ignore": { "path-to-regexp": "<7.0.0", "typescript": true }
vrt deps-upgrade --ignore 'path-to-regexp@<7.0.0' --ignore typescript

Command line entries are merged into the configured ones and win in case of a conflict.

Trimming a noisy dependency graph

For repos with high fan-out, deps-graph accepts repeatable globs to collapse or drop nodes:

# Merge all region scrapers into a single labelled node ("regions/*.ts (24 files)").
vrt deps-graph --collapse-dir 'src/regions/*.ts'

# Drop trivial barrels and stubs from the graph entirely.
vrt deps-graph --exclude '**/_planned.ts' --exclude '**/index.ts'

Command vrt

$ vrt
Usage: vrt [options] [command]

CLI tool for releasing packages and generating documentation for
Node.js/TypeScript projects.

Options:
  -h, --help                                display help for command
  -v, --verbose                             Enable verbose output

Commands:
  check                                     Check repo for required scripts and other stuff.
  deps-graph [options]                      Analyze project files and output a dependency graph as Mermaid markup.
  deps-upgrade [options]                    Upgrade all dependencies in the current project to their latest versions.
  doc-command <command>                     Generate Markdown documentation for a specified command and output the result.
  doc-insert <readme> [heading] [foldable]  Insert Markdown from stdin into a specified section of a Markdown file.
  doc-toc <readme> [heading]                Generate a Table of Contents (TOC) in a Markdown file.
  doc-typescript [options]                  Generate documentation for a TypeScript project.
  help [command]                            display help for command
  release-npm [options] [path]              Publish an npm package from the specified path to the npm registry.

Subcommand: vrt check

$ vrt check
Usage: vrt check [options]

Check repo for required scripts and other stuff.

Options:
  -h, --help  display help for command

Subcommand: vrt deps-graph

$ vrt deps-graph
Usage: vrt deps-graph [options]

Analyze project files and output a dependency graph as Mermaid markup.

Options:
  --collapse-dir <glob>  Collapse all files matching the glob into a single node
                         (repeatable). (default: [])
  --exclude <glob>       Drop files matching the glob from the graph entirely
                         (repeatable). (default: [])
  -h, --help             display help for command

Subcommand: vrt deps-upgrade

$ vrt deps-upgrade
Usage: vrt deps-upgrade [options]

Upgrade all dependencies in the current project to their latest versions.

Options:
  -h, --help                  display help for command
  --ignore <package[@range]>  Do not upgrade this dependency, optionally only up
                              to a semver range, e.g. "path-to-regexp@<7.0.0"
                              (repeatable). (default: [])

Subcommand: vrt doc-command

$ vrt doc-command
Usage: vrt doc-command [options] <command>

Generate Markdown documentation for a specified command and output the result.

Arguments:
  command     Command to document (e.g., "npm run build").

Options:
  -h, --help  display help for command

Subcommand: vrt doc-insert

$ vrt doc-insert
Usage: vrt doc-insert [options] <readme> [heading] [foldable]

Insert Markdown from stdin into a specified section of a Markdown file.

Arguments:
  readme      Path to the target Markdown file (e.g., README.md).
  heading     Heading in the Markdown file where content should be placed.
              Default is "# API". (default: "# API")
  foldable    Whether to wrap the inserted content in a foldable section.
              (default: false)

Options:
  -h, --help  display help for command

Subcommand: vrt doc-toc

$ vrt doc-toc
Usage: vrt doc-toc [options] <readme> [heading]

Generate a Table of Contents (TOC) in a Markdown file.

Arguments:
  readme      Path to the Markdown file (e.g., README.md).
  heading     Heading in the Markdown file where TOC should be inserted. Default
              is "# Table of Content". (default: "# Table of Content")

Options:
  -h, --help  display help for command

Subcommand: vrt doc-typescript

$ vrt doc-typescript
Usage: vrt doc-typescript [options]

Generate documentation for a TypeScript project.

Options:
  -f, --format <format>      Allowed are "markdown", "wiki" and "html". Default
                             is "markdown".
  -h, --help                 display help for command
  -i, --input <entryPoint>   Entry point of the TypeScript project. Default is
                             "./src/index.ts".
  -o, --output <outputPath>  Output path for the generated documentation.
                             Default is "./docs".

Subcommand: vrt release-npm

$ vrt release-npm
Usage: vrt release-npm [options] [path]

Publish an npm package from the specified path to the npm registry.

Arguments:
  path           Root path of the Node.js project. Defaults to the current
                 directory.

Options:
  -h, --help     display help for command
  -n, --dry-run  Show what would be done without making any changes

Development

Dependency Graph

---
config:
  layout: elk
---
flowchart TB

subgraph 0["src"]
subgraph 1["commands"]
2["check.ts"]
6["deps-graph.ts"]
7["deps-upgrade.ts"]
9["doc-command.ts"]
B["doc-typescript.ts"]
C["markdown.ts"]
D["release-npm.ts"]
end
subgraph 3["lib"]
4["log.ts"]
5["errors.ts"]
8["shell.ts"]
A["utils.ts"]
E["changelog.ts"]
F["git.ts"]
G["retry.ts"]
I["benchmark.ts"]
end
H["index.ts"]
end
2-->4
4-->5
6-->4
7-->5
7-->4
7-->8
8-->5
8-->4
9-->A
B-->4
C-->5
C-->A
D-->E
D-->5
D-->F
D-->4
D-->G
D-->8
E-->F
F-->8
H-->2
H-->6
H-->7
H-->9
H-->B
H-->C
H-->D
H-->4

class 0,1,3 subgraphs;
classDef subgraphs fill-opacity:0.1, fill:#888, color:#888, stroke:#888;
Loading

About

Helper tool for automating Node.js package releases across VersaTiles repositories.

Resources

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages