@peril/utils
Maybe this will turn into a mono-repo with a lot of smaller packages, but for now - this is fine.
Last updated 4 months ago by orta .
MIT · Original npm · Tarball · package.json
$ cnpm install @peril/utils 
SYNC missed versions from official npm registry.

@peril/utils

Maybe this will turn into a mono-repo with a lot of smaller packages, but for now - this is fine.

Generating a Peril Settings Repo

export const fileMapForPerilSettingsRepo = async (api: octokit, options: NewRepoOptions)

Which returns a fileMap for an example Peril settings repo. There are a few options.

Usage:

const map = await fileMapForPerilSettingsRepo(api, {
  isPublic: true,
  setupTests: true,
  useTypeScript: true,
  repo: {
    name: "Fake Repo",
    owner: {
      login: "User Name",
    },
  },
})

Linting

Mainly one function:

export function lint(
  settingsReference: string,
  api: octokit,
  currentSettings?: FileRelatedPartOfJSON
): Promise<ErrorReport>

You pass in the dangerfile reference URL for the settings repo, an already set-up OctoKit api object (so you handle auth basically) and you can optionally pass in the currentSettings - if you don't this lib will grab the version in the settingsReference.

Usage:

import { lint } from "peril-settings-linter"

const runLinter = async () => {
  const results = await lint("artsy/peril-settings@settings.json", api)
  if (results.networkErrors.length) {
    console.error(`Could not find files at: ${results.networkErrors.join(",")}`)
  }

  if (results.schemaErrors.length) {
    console.error(`Settings file did not pass schema validation: ${results.schemaHumanReadableErrors}`)
    console.error(`Settings file did not pass schema validation: ${results.schemaErrors}`)
  }
}

How do I work on this?

git clone https://github.com/orta/peril-settings-linter.git
cd peril-settings-linter
yarn install

# Open VS Code with `code .`
code .

# Run tests
yarn jest
yarn type-check

How do I deploy this?

yarn release

Current Tags

  • 1.0.3                                ...           latest (4 months ago)

3 Versions

  • 1.0.3                                ...           4 months ago
  • 1.0.2                                ...           4 months ago
  • 1.0.1                                ...           4 months ago
Maintainers (1)
Downloads
Today 0
This Week 6
This Month 9
Last Day 0
Last Week 3
Last Month 0
Dependencies (3)
Dev Dependencies (12)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |