Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds danger-yarn plugin #278

Merged
merged 6 commits into from
Jun 12, 2017
Merged

Adds danger-yarn plugin #278

merged 6 commits into from
Jun 12, 2017

Conversation

orta
Copy link
Member

@orta orta commented Jun 10, 2017

This is a bit of a dupe right now, as the contents of that plugin came from this dangerfile - but I'm more interested in overall integration. If this works then I'll modify the Dangerfile inside this PR.

@orta
Copy link
Member Author

orta commented Jun 10, 2017

I feel like there's something uniquely wrong here, maybe it's my plugin? Danger has no problem with other external modules inside the dangerfile.

import * as fs from "fs"
import * as child_process from "child_process"
import fetch from "node-fetch"
import { distanceInWords } from "date-fns"

// For some reason we're getting type errors on this includes module?
// Wonder if we could move to the includes function in ES2015?
import * as includesOriginal from "lodash.includes"

@orta
Copy link
Member Author

orta commented Jun 10, 2017

It is - lols

@orta
Copy link
Member Author

orta commented Jun 10, 2017

Just went to check the files:

screen shot 2017-06-10 at 11 27 25

@orta
Copy link
Member Author

orta commented Jun 10, 2017

OK, this works, I'm re-writing danger-plugin-yarn now - so may have improvements

@orta
Copy link
Member Author

orta commented Jun 10, 2017

oh wrong place, this was meant to go danger/generator-danger-plugin#16 - ah well @macklinu will still see it

@orta orta force-pushed the use-plugin branch 12 times, most recently from 30b0b25 to 5e3cbcf Compare June 11, 2017 10:05
@danger danger deleted a comment from DangerCI Jun 12, 2017
@orta orta force-pushed the use-plugin branch 3 times, most recently from d10c608 to 1b1d667 Compare June 12, 2017 08:04
@DangerCI
Copy link

DangerCI commented Jun 12, 2017

Warnings
⚠️

New dependencies added: danger-plugin-yarn.

danger-plugin-yarn

Author: Orta Therox

Description: Provides dependency information on dependency changes in a PR

Homepage: https://github.com/orta/danger-plugin-yarn#readme

Created24 days ago
Last Updated21 minutes ago
LicenseMIT
Maintainers1
Releases14
Direct Dependenciesdate-fns, lodash.flatten, lodash.includes, node-fetch and esdoc
Keywordsdanger, danger-plugin and yarn
README # danger-plugin-yarn

Build Status
npm version
semantic-release

Provides dependency information on dependency changes in a PR

Usage

Install:

yarn add danger-plugin-yarn --dev

At a glance:

// dangerfile.js
import yarn from 'danger-plugin-yarn'

schedule(yarn())

Provides 4 separate rules:

  • checkForRelease - Provides a 🎉 when there's a package version bump.
  • checkForNewDependencies (async) - Provides npmjs.com and yarn why metadata about new dependencies.
  • checkForLockfileDiff - Will warn you when there are dependencies or devDependencies changes without a yarn.lock change.
  • checkForTypesInDeps - Will fail the build if you add any @types/[x] to dependencies instead of devDependencies.

And exports a default function to handle all of them at once.

Note: async functions like the default one have be to schedule'd by Danger.

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.

yarn why danger-plugin-yarn output

  • Has been hoisted to "danger-plugin-yarn"
  • This module exists because it's specified in "devDependencies".
  • Disk size without dependencies: "80kB"
  • Disk size with unique dependencies: "3.98MB"
  • Disk size with transitive dependencies: "4.43MB"
  • Number of shared dependencies: 7

Generated by 🚫 dangerJS

@orta
Copy link
Member Author

orta commented Jun 12, 2017

Doh - spent all this time thinking things were broken, but really the check only works for dependencies, not devDependencies.

@orta orta force-pushed the use-plugin branch 3 times, most recently from 092bd1c to faa24e4 Compare June 12, 2017 09:55
added: ["@types/danger"],
},
}
checkForTypesInDeps(deps)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a weird-ish test, as it's making assertions about how danger-plugin-yarn works, but I'd rather have a test for something, and this seems reasonable enough

added?: any[]
/** If both before & after are arrays, then you optionally get what is removed. Emprty is no removed objects. */
/** If both before & after are arrays, then you optionally get what is removed. Empty ig no removed objects. */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typos

node_js: node
script:
- yarn run link
- danger run --verbose
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't run by default, but it's nice when you're working on the dangerfile and want to test quickly

@orta orta merged commit 587530e into master Jun 12, 2017
@orta orta deleted the use-plugin branch June 12, 2017 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants