Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

danger

Package Overview
Dependencies
Maintainers
3
Versions
320
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

danger - npm Package Versions

1
32

0.15.0

Diff

Changelog

Source

0.15.0

  • When a Dangerfile fails to eval, send a message to the PR - [@orta]
dangersystems
published 0.14.2 •

Changelog

Source

0.14.2

  • Updated jest-* dependencies to 19.x - [@orta]

    Updating the jest-* dependencies seems to be exhibiting strange behavior in tests for windows if you update, and use windows, can you please confirm that everything is 👍

  • Added type shapings to JSONPatchForFile - [@orta]

  • Replaced deprecated lodash.isarray package with Array.isArray - damassi

dangersystems
published 0.14.1 •

Changelog

Source

0.14.1

  • Moved @types/chalk from dependencies to devDependencies - [@orta]
  • Killed some stray console logs - [@orta]
  • Updated the danger.d.ts - [@orta]
dangersystems
published 0.14.0 •

Changelog

Source

0.14.0

  • TypeScript Dangerfiles are now support in Danger - [@orta]

    We use TypeScript in Danger, and a lot of my work in Artsy now uses TypeScript (see: JS2017 at Artsy), so I wanted to explore using TypeScript in Dangerfiles.

    This is built on top of Jest's custom transformers, so if you are already using Jest with TypeScript, then you can change the dangerfile.js to dangerfile.ts and nothing should need changing ( except that you might have new warnings/errors ) (note: in changing this for Danger, I had to also add the dangerfile.ts to the "exclude" section of the tsconfig.json so that it didn't change the project's root folder.)

    This repo is now using both a babel Dangerfile (running on Circle CI) and a TypeScript one (running on Travis) to ensure that we don't accidentally break either.

  • Created a new danger.d.ts for VS Code users to get auto-completion etc - [@orta]

  • Added a two new git DSL functions: git.JSONDiffForFile(filename) and git.JSONPatchForFile(filename).

    • git.JSONPatchForFile

      This will generate a rfc6902 JSON patch between two files inside your repo. These patch files are useful as a standard, but are pretty tricky to work with in something like a Dangerfile, where rule terseness takes priority.

    • git.JSONDiffForFile

      This uses JSONPatchForFile to generate an object that represents all changes inside a Dangerfile as a single object, with keys for the changed paths. For example with a change like this:

      {
        "dependencies": {
          "babel-polyfill": "^6.20.0",
       +  "chalk": "^1.1.1",
          "commander": "^2.9.0",
          "debug": "^2.6.0"
        },
      }
      

      You could become aware of what has changed with a Dangerfile in a schedule'd function like:

      const packageDiff = await git.JSONDiffForFile("package.json")
      if (packageDiff.dependencies) {
        const deps = packageDiff.dependencies
      
        deps.added // ["chalk"],
        deps.removed // []
        deps.after // { "babel-polyfill": "^6.20.0", "chalk": "^1.1.1", "commander": "^2.9.0", "debug": "^2.6.0" }
        deps.before // { "babel-polyfill": "^6.20.0", "commander": "^2.9.0", "debug": "^2.6.0" }
      }
      

      The keys: added and removed only exist on the object if:

      • before and after are both objects - in which case added and removed are the added or removed keys
      • before and after are both arrays - in which case added and removed are the added or removed values
  • Exposed all global functions ( like warn, fail, git, schedule, ... ) on the danger object. - [@orta]

    This is specifically to simplify building library code. It should not affect end-users. If you want to look at making a Danger JS Plugin, I'd recommend exposing a function which takes the danger object and working from that. If you're interested, there is an active discussion on plugin support in the DangerJS issues.

  • Improves messaging to the terminal - [@orta]

  • Adds the ability to not have Danger post to GitHub via a flag: danger run --text-only - [@orta]

  • Fix a crasher with prs.find #181 - [@orta]

dangersystems
published 0.13.0 •

Changelog

Source

0.13.0

  • Add danger.utils DSL, which includes danger.utils.href() and danger.utils.sentence() - macklinu

    We were finding that a lot of Dangerfiles needed similar functions, so we've added a utils object to offer functions that are going to be used across the board. If you can think of more functions you use, we'd love to add them. Ideally you shouldn't need to use anything but Danger + utils to write your Dangerfiles.

    danger.utils.href("http://danger.systems", "Danger") // <a href="http://danger.systems">Danger</a>
    danger.utils.sentence(["A", "B", "C"]) // "A, B and C"
    
  • Adds danger.github.utils - which currently has only one function: fileLinks - [@orta]

    Most of the time people are working with a list of files (e.g. modified, or created) and then want to present clickable links to those. As the logic to figure the URLs is very GitHub specific, we've moved that into it's own object with space to grow.

    const files = danger.git.modified_files // ["lib/component/a.ts", "lib/component/b.ts"]
    const links = danger.github.utils.fileLinks(files) // "<a href='...'>a</a> and <a href='...'>b</a>"
    warn(`These files have changes: ${links}`)
    
dangersystems
published 0.12.1 •

Changelog

Source

0.12.1

  • Add support for Drone - gabro
dangersystems
published 0.12.0 •

Changelog

Source

0.12.0

  • Added support for handling async code in a Dangerfile - deecewan

    This is still a bit of a work in progress, however, there is a new function added to the DSL: schedule.

    A Dangerfile is evaluated as a script, and so async code has not worked out of the box. With the schedule function you can now register a section of code to evaluate across multiple tick cycles.

    schedule currently handles two types of arguments, either a promise or a function with a resolve arg. Assuming you have a working Babel setup for this inside your project, you can run a Dangerfile like this:

    schedule(async () => {
      const thing = await asyncAction()
      if (thing) {
        warn("After Async Function")
      }
    })
    

    Or if you wanted something simpler,

    schedule(resolved => {
      if (failed) {
        fail("Failed to run")
      }
    })
    
  • Adds new GitHub DSL elements - deecewan

  • danger.github.issue - As a PR is an issue in GitHub terminology, the issue contains a bit more metadata. Mainly labels, so if you want to know what labels are applied to a PR, use danger.github.issue.labels
  • danger.github.reviews - Find out about your reviews in the new GitHub Reviewer systems,
  • danger.github.requested_reviewers - Find out who has been requested to review a PR.
  • Updated TypeScript and Jest dependencies - [@orta]
  • Add support for Github Enterprise via DANGER_GITHUB_API_BASE_URL env var - mashbourne
dangersystems
published 0.11.5 •

Changelog

Source

0.11.3 - 0.11.5

  • Internal changes for usage with Peril - [@orta]

  • Add danger pr --repl, which drops into a Node.js REPL after evaluating the dangerfile - macklinu

  • Add support for Codeship - deecewan

dangersystems
published 0.11.4 •

dangersystems
published 0.11.3 •

Changelog

Source

0.11.3 - 0.11.5

  • Internal changes for usage with Peril - [@orta]

  • Add danger pr --repl, which drops into a Node.js REPL after evaluating the dangerfile - macklinu

  • Add support for Codeship - deecewan

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc