JSPM

virmator

6.4.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 447
  • Score
    100M100P100Q91895F
  • License MIT

Handle common package configs, commands, and dependencies.

Package Exports

  • virmator
  • virmator/base-configs/base-cspell.js
  • virmator/base-configs/base-mocharc.js
  • virmator/base-configs/base-nyc.js
  • virmator/base-configs/base-prettierrc.js
  • virmator/base-configs/base-web-test-runner.mjs
  • virmator/dist/augments/string
  • virmator/dist/augments/string.js
  • virmator/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (virmator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

virmator

Centralize and automate all the things! So I don't have to copy pasta configs in every single project.

Install

npm -i D virmator

Help

npx virmator --help

Below is full documentation for the cli, which is generated via the cli's help message:

virmator usage

[npx] virmator [--flags] command subCommand

npx is needed when the command is run directly from the terminal (not scoped within an npm script) unless the package has been globally installed (which will work just fine but I wouldn't recommend, simply because I prefer explicit dependencies).

Available commands

code-in-markdown

Insert code snippets into markdown files. This uses the markdown-code-example-inserter package to expand code link comments inside of markdown files to actual markdown code blocks. See that package's README for more details but the basics are that you need a comment that looks like the following in your markdown file for this to do anything: <!-- example-link: path/to/file.ts -->

By default this command parses all markdown files in the repo (ignoring node_modules). Specific markdown files can be parsed by giving virmator extra parameters.

To check if files are up-to-date (rather than actually updating them), use the "check" sub-command.

Examples

  • default experience (usually all you need): virmator code-in-markdown
  • checking if files are up-to-date: virmator code-in-markdown check
  • override files to check to a single file: virmator code-in-markdown only/this/one/file.md
  • override files to check to a group of files: virmator code-in-markdown "only/this/dir/*.md"

check

Check that markdown files have their examples inserted and are up-to-date.

compile

compile typescript files Pass any extra tsc flags to this command.

Examples

  • no extra flags: virmator compile
  • one extra flag: virmator compile --noEmit

check

Run type checking without emitting compiled files.

format

Formats source files with Prettier.

file extensions:

If only specific file extensions should be formatted, add the "--file-types" argument to this command. All following arguments will be treated as file extensions to be formatted. For example, the following command will format files only if they have the extension ".md" or ".json": virmator format --file-types md json

Prettier flags:

Any other arguments encountered between the operation command (if provided) and the "--file-types" marker are treated as extra arguments to Prettier and will be passed along.

Examples

  • checks formatting for files: virmator format check

  • checks formatting only for .md files: virmator format check --file-types md

  • checks formatting only for .md and .json files: virmator format check --file-types md json

  • fixes formatting for files:

    virmator format
    virmator format
  • examples with extra Prettier flags:

    virmator format --ignore-path .prettierignore
    virmator format --ignore-path .prettierignore
    virmator format --ignore-path .prettierignore --file-types md json

check

check formatting without overwriting files.

frontend

Runs a frontend. Currently uses vite.

build

Builds and bundles the frontend for deployment.

preview

Builds and previews the built output.

init

Initialize a repo with all virmator config files.

Examples

  • run init: virmator init
  • run init and force all configs to be written: virmator init force

force

force overwrite files even if they already exist.

publish

Publish an npm package. Includes workspace support. Add test commands to run before publish as arguments.

Examples

  • publish a package: virmator publish
  • publish a package and run tests beforehand: virmator publish npm test

spellcheck

Spellcheck code with cspell. By default this spellchecks every file in the entire repo (except for those ignored in the config file), including .dot files. If any arguments are passed to this command, the default cspell args that this command applies are ignored, you'll have to supply them via your args.

test

Test all .test.ts files with Mocha and Chai. By default this command tests all ".test.ts" files in the current directory (recursively) that are not ".type.test.ts" files. To override this behavior, override the "spec" property in .mocharc.js.

This command is meant to run Node.js tests. For running web-based testing, see the test-web command.

Note that the below single file examples only work because the base Mocha config from virmator is setup to handle them. (So if you don't use that config, the examples may not work properly.)

Examples

  • Test all .test.ts and .test.tsx files: virmator test
  • Test a single file: virmator test ./path/to/single/file.js
  • Test multiple files: virmator test "./**/single-file.js"

coverage

run tests with code coverage calculations. This will often result in incorrect stack traces on errors, so this is only recommended after having first gotten all tests to pass without coverage calculations.

test-web

Runs tests within browsers rather than inside of Node.js. Test files fed into this command cannot be mixed with test files run by the "virmator test" command, as the run-time environment is quite different (Node.js vs browser). However, just like the test command, this command will all ".test.ts" files in the current directory (recursively) that are not ".type.test.ts" files. To override this behavior, override the "files" property in web-test-runner.config.mjs.

By default this command runs all tests three times: in Chromium (Chrome), Firefox, and Webkit (Safari) using playwright.

Examples

  • Test all .test.ts and .test.tsx files: virmator test-web
  • Test a specific file: virmator test-web path/to/file.test.ts

coverage

run web tests with code coverage calculations

update-configs

Update all existing configuration files that virmator is able to update. (Like base config files.)

upgrade-deps

Upgrade all packages using npm-check-updates and config/ncu.config.ts.

Examples

  • Run command: virmator upgrade-deps