Socket
Socket
Sign inDemoInstall

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 Compare versions

Comparing version 12.0.1 to 12.1.0

60

distribution/commands/danger-init.js

@@ -98,2 +98,3 @@ #! /usr/bin/env node

_a.sent();
if (!state.isAnOSSRepo) return [3 /*break*/, 6];
return [4 /*yield*/, setupGitHubAccount(ui, state)];

@@ -108,7 +109,15 @@ case 3:

_a.sent();
return [4 /*yield*/, wrapItUp(ui, state)];
case 6:
return [3 /*break*/, 8];
case 6:
// We can use the private github workflow for private repos
return [4 /*yield*/, (0, add_to_ci_1.githubActions)(ui, state)];
case 7:
// We can use the private github workflow for private repos
_a.sent();
_a.label = 8;
case 8: return [4 /*yield*/, wrapItUp(ui, state)];
case 9:
_a.sent();
return [4 /*yield*/, thanks(ui, state)];
case 7:
case 10:
_a.sent();

@@ -139,7 +148,7 @@ return [2 /*return*/];

_a.sent();
ui.say(" - [ ] Create a GitHub account for Danger to use, for messaging.");
ui.say(" - [ ] Potentially create a GitHub account for Danger to use, for messaging.");
return [4 /*yield*/, ui.pause(0.6)];
case 3:
_a.sent();
ui.say(" - [ ] Set up an access token for Danger.");
ui.say(" - [ ] Set up an access token for Danger to comment with.");
return [4 /*yield*/, ui.pause(0.6)];

@@ -307,8 +316,7 @@ case 4:

link = function (name, url) { return ui.say(" * " + ui.link(name, url)); };
link("artsy/Emission#dangerfile.ts", "https://github.com/artsy/emission/blob/master/dangerfile.ts");
link("facebook/react-native#danger/dangerfile.js", "https://github.com/facebook/react-native/blob/master/bots/dangerfile.js");
link("apollographql/apollo-client#dangerfile.ts", "https://github.com/apollographql/apollo-client/blob/master/config/dangerfile.ts");
link("styleguidist/react-styleguidist#dangerfile.js", "https://github.com/styleguidist/react-styleguidist/blob/master/dangerfile.js");
link("storybooks/storybook#dangerfle.js", "https://github.com/storybooks/storybook/blob/master/dangerfile.js");
link("ReactiveX/rxjs#dangerfle.js", "https://github.com/ReactiveX/rxjs/blob/master/dangerfile.js");
link("artsy/eigen#dangerfile.ts", "https://github.com/artsy/eigen/blob/master/dangerfile.ts");
link("facebook/react-native#main/packages/react-native-bots/dangerfile.js", "https://github.com/facebook/react-native/blob/main/packages/react-native-bots/dangerfile.js");
link("mui/material-ui#dangerfile.ts", "https://github.com/mui/material-ui/blob/main/dangerfile.ts#L4");
link("styleguidist/react-styleguidist#dangerfile.ts", "https://github.com/styleguidist/react-styleguidist/blob/master/dangerfile.ts");
link("storybooks/storybook#.ci/danger/dangerfile.ts", "https://github.com/storybookjs/storybook/blob/master/.ci/danger/dangerfile.ts");
return [4 /*yield*/, ui.pause(1)];

@@ -329,18 +337,24 @@ case 4:

_a.sent();
if (!(state.ciType === "travis")) return [3 /*break*/, 3];
return [4 /*yield*/, (0, add_to_ci_1.travis)(ui, state)];
if (!(state.ciType === "gh-actions")) return [3 /*break*/, 3];
return [4 /*yield*/, (0, add_to_ci_1.githubActions)(ui, state)];
case 2:
_a.sent();
return [3 /*break*/, 7];
return [3 /*break*/, 9];
case 3:
if (!(state.ciType === "circle")) return [3 /*break*/, 5];
return [4 /*yield*/, (0, add_to_ci_1.circle)(ui, state)];
if (!(state.ciType === "travis")) return [3 /*break*/, 5];
return [4 /*yield*/, (0, add_to_ci_1.travis)(ui, state)];
case 4:
_a.sent();
return [3 /*break*/, 7];
case 5: return [4 /*yield*/, (0, add_to_ci_1.unsure)(ui, state)];
return [3 /*break*/, 9];
case 5:
if (!(state.ciType === "circle")) return [3 /*break*/, 7];
return [4 /*yield*/, (0, add_to_ci_1.circle)(ui, state)];
case 6:
_a.sent();
_a.label = 7;
case 7: return [2 /*return*/];
return [3 /*break*/, 9];
case 7: return [4 /*yield*/, (0, add_to_ci_1.unsure)(ui, state)];
case 8:
_a.sent();
_a.label = 9;
case 9: return [2 /*return*/];
}

@@ -360,6 +374,4 @@ });

ui.say("If you like Danger, let others know. If you want to know more, follow " +
(0, interfaces_1.highlight)("@orta") +
" and " +
(0, interfaces_1.highlight)("@DangerSystems") +
" on Twitter.");
(0, interfaces_1.highlight)("@orta@webtoo.ls") +
" on Mastodon!");
ui.say("If you don't like something about Danger, help us improve the project - it's all done on volunteer time! xxx");

@@ -366,0 +378,0 @@ ui.say("Remember: it's nice to be nice.\n");

1

distribution/commands/init/add-to-ci.d.ts
import { InitUI, InitState } from "./interfaces";
export declare const githubActions: (ui: InitUI, state: InitState) => Promise<void>;
export declare const travis: (ui: InitUI, state: InitState) => Promise<void>;
export declare const circle: (ui: InitUI, state: InitState) => Promise<void>;
export declare const unsure: (ui: InitUI, _state: InitState) => Promise<void>;

@@ -38,5 +38,54 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsure = exports.circle = exports.travis = void 0;
exports.unsure = exports.circle = exports.travis = exports.githubActions = void 0;
var interfaces_1 = require("./interfaces");
var chalk_1 = __importDefault(require("chalk"));
var githubActions = function (ui, state) { return __awaiter(void 0, void 0, void 0, function () {
var link;
return __generator(this, function (_a) {
if (!state.isAnOSSRepo) {
ui.say("For your closed-source project, we can use the default GitHub Auth token for posting.");
ui.say("So, you don't need to create a bot account.");
ui.pause(0.5);
ui.say("You will want to add a new step in an existing workflow yaml file.");
ui.pause(0.2);
ui.say("The step should look like this:");
ui.say("");
ui.say("```yaml");
ui.say(chalk_1.default.bold(" - name: Run Danger"));
ui.say(chalk_1.default.bold(" run: yarn danger ci"));
ui.say(chalk_1.default.bold(" env:"));
ui.say(chalk_1.default.bold(" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`"));
ui.say("```");
ui.say("");
ui.pause(1);
ui.say("This will run Danger on every PR, press return when you have added this to one of your workflows.");
ui.waitForReturn();
return [2 /*return*/];
}
link = ui.link("issue #918.", "https://github.com/danger/danger-js/issues/918");
ui.say("For your OSS project, there are a few options you can find in ".concat(link, ". We will continue with using the new GitHub user account here."));
ui.pause(0.5);
ui.say("For your OSS project, you need to add a new secret to your workflow in a way that is slightly obfuscated.");
ui.say("This is because GitHub Actions doesn't allow you to use the default GITHUB_TOKEN to update its own comments.");
ui.pause(0.5);
ui.say("This would make Danger very spammy on a Pull Request.");
ui.pause(0.1);
ui.say("To get started, add a new step in an existing workflow file.");
ui.say("The step should look like this:");
ui.say("");
ui.say("```yaml");
ui.say(chalk_1.default.bold(")\n - name: Run Danger\n run: |\n # Exposing this token is safe because the user of it has no other public repositories\n # and has no permission to modify this repository.\n TOKEN='ghp_On3bHOkcV2AmVY6'\n TOKEN+='56186c3b09b4f86b1c65136769'\n DANGER_GITHUB_API_TOKEN=$TOKEN yarn danger ci"));
ui.say("```");
ui.say("");
ui.pause(1);
ui.say("This will run Danger on every PR, press return when you have added this to one of your workflows.");
ui.waitForReturn();
return [2 /*return*/];
});
}); };
exports.githubActions = githubActions;
var travis = function (ui, state) { return __awaiter(void 0, void 0, void 0, function () {

@@ -43,0 +92,0 @@ var travisLink, travisLink;

import { InitState } from "./interfaces";
declare const generateDangerfileState: () => {
hasCHANGELOG: boolean;
hasSeparateTestFolder: boolean;
hasPrettier: boolean;
hasJest: boolean;
};
export declare const generateDefaultDangerfile: (state: InitState) => any;
export declare const formatDangerfile: (dangerfile: string, dangerfileState: any) => any;
export declare const formatDangerfile: (dangerfile: string, initState: InitState, dangerfileState: ReturnType<typeof generateDangerfileState>) => any;
export declare const createImport: (state: InitState) => "import {danger, warn} from 'danger'" | "const {danger, warn} = require('danger')";

@@ -9,1 +15,2 @@ export declare const changelogRule = "\n// Check for a CHANGELOG entry\nconst hasChangelog = danger.git.modified_files.some(f => f === 'CHANGELOG.md')\nconst description = danger.github.pr.body + danger.github.pr.title\nconst isTrivial = description.includes('#trivial')\n\nif (!hasChangelog && !isTrivial) {\n warn('Please add a changelog entry for your changes.')\n}\n";

export declare const checkSeparateTestsFolder: (src: string, tests: string) => string;
export {};

@@ -59,6 +59,6 @@ "use strict";

var dangerfile = "".concat((0, exports.createImport)(state), "\n\n ").concat(rules.join("\n"), "\n ");
return (0, exports.formatDangerfile)(dangerfile, dangerfileState);
return (0, exports.formatDangerfile)(dangerfile, state, dangerfileState);
};
exports.generateDefaultDangerfile = generateDefaultDangerfile;
var formatDangerfile = function (dangerfile, dangerfileState) {
var formatDangerfile = function (dangerfile, initState, dangerfileState) {
if (dangerfileState.hasPrettier) {

@@ -70,3 +70,3 @@ // eslint-disable-next-line @typescript-eslint/no-require-imports

// Always include this
var always = { editorconfig: true };
var always = { editorconfig: true, parser: "typescript", filepath: process.cwd() + " /" + initState.filename };
var settings = localPrettier ? __assign(__assign({}, always), localPrettier) : always;

@@ -73,0 +73,0 @@ return format(dangerfile, settings);

@@ -14,3 +14,3 @@ export interface InitState {

repoSlug: string | null;
ciType: "travis" | "circle" | "unknown";
ciType: "gh-actions" | "travis" | "circle" | "unknown";
isGitHub: boolean;

@@ -17,0 +17,0 @@ }

@@ -99,3 +99,4 @@ "use strict";

var hasCircle = fs.existsSync("circle.yml");
var ciType = hasTravis ? "travis" : hasCircle ? "circle" : "unknown";
var hasGitHubActions = fs.existsSync(".github/") && fs.existsSync(".github/workflows");
var ciType = hasGitHubActions ? "gh-actions" : hasTravis ? "travis" : hasCircle ? "circle" : "unknown";
var repoSlug = (0, get_repo_slug_1.getRepoSlug)();

@@ -102,0 +103,0 @@ var isGitHub = !!repoSlug;

{
"name": "danger",
"version": "12.0.1",
"version": "12.1.0",
"description": "Unit tests for Team Culture",

@@ -5,0 +5,0 @@ "main": "distribution/danger.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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