0.1.4 • Published 6 years ago

@keymux/dev_utils v0.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Keymux Dev Utils

Build Status

BranchStatus
MasterBuild Status
DevBuild Status

Dependencies

Ubuntu

  • libssl-dev
  • libcurl4-openssl-dev

Components

directory-changed.js

The directory-changed utility is intended to provide a portable way to diff specific elements of your repository in order to generate a comment for a pull request / merge request.

Usage

#!/bin/bash

# Output a diff if changelog.txt has changed relative to my local master but don't error if not
yarn directory-changed --startsWith=changelog.txt --diffAgainstReference=master --noChangeExitCode=0

Options

Each of these options can be provided optionally, else the default will be used.

nameRequiredDefaultExplanation
startsWithno.changesStarting path to search for changes, usually a directory
noChangeMessagenoNo changes were foundThe message to output if there are no modifications found
noChangeExitCodeno-1The process exit code to use when no changes were found
gitDirno.gitThe location of the .git directory to use for diffing
diffAgainstReferencenorefs/remotes/origin/masterThe reference to diff against
diffFormatEnginenogithubThe diff format engine
diffFormatEngine

This will be expanded to include more options later, but for now, it only supports bitbucket and github, for which the outputs are the same.

```diff
  existing line
+ added line
- removed line
  existing line
```

Gotchas

Commit your changes before diffing

In order to properly execute the directory-changed script, you need to have already committed your changes. Staged or unstaged changes are not compared.

mochawesome-markdown.js

The mochawesome-markdown utility is intended to provide a portable way to convert mochawesome.json output into markdown format for easy digestion in a pull request comment.

Usage

#!/bin/bash

# Setup shared variables
REPORT_DIR=reports

# Run mochawesome
yarn mocha \
  --reporter mochawesome \
  --reporter-options reportDir="${REPORT_DIR}" \
  test/**

# Convert to markdown
yarn mochawesome-markdown \
  --mochawesome_json="${REPORT_DIR}/mochawesome.json" \
  | tee -a "${REPORT_DIR}/comment"

Options

nameRequiredDefaultExplanation
mochawesome_jsonyesThe full path to the mochawesome.json file
tableHeadernoPassed,Failed,Skipped,Total,PercentThe header row of the table
fieldsnopasses,failures,pending,tests,passPercentThe arrangement of output fields
preno"","*__","*","",""Pre-text per data cell, columns delimited by commas
postno"","__*","*","","%"Post-text per data cell, columns delimited by commas
headernoText to display above the table
footernoText to display below the table

nyc-markdown.js

The nyc-markdown utility is intended to provide a portable way to convert nyc/istanbul output into markdown format for easy digestion in a pull request comment.

Usage

#!/bin/bash

# Setup shared variables
REPORT_DIR=reports

yarn nyc \
  --reporter=lcov \
  --reporter=json-summary \
  --report-dir=${REPORT_DIR}/coverage \
  mocha test/**

yarn nyc-markdown \
  --coverage_filename "${REPORT_DIR}/coverage/coverage-summary.json" \
  | tee -a "${REPORT_DIR}/comment"

Options

nameRequiredDefaultExplanation
coverage_filenameyesThe full path to the coverage-summary.json file
tableHeadernoType,Covered,Skipped,Total,PercentThe header row of the table*
preno"","*__","*","",""Pre-text per data cell, columns delimited by commas
postno"","__*","*","","%"Post-text per data cell, columns delimited by commas
headernoText to display above the table
footernoText to display below the table

* doesn't affect child rows currently, so it's not particularly useful unless you just want different names.

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago