Skip to content

Commit

Permalink
Merge branch 'master' into 8437-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
repo-ranger[bot] authored Jan 14, 2023
2 parents f823f73 + dad6ce5 commit 6896c65
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 41 deletions.
33 changes: 0 additions & 33 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,6 @@ services_steps: &services_steps
path: junit

jobs:
danger:
docker:
- image: cimg/node:16.15
steps:
- checkout

- run:
name: Install dependencies
command: npm ci
environment:
CYPRESS_INSTALL_BINARY: 0

- run:
name: Danger
when: always
environment:
# https://github.com/gatsbyjs/gatsby/pull/11555
NODE_ENV: test
command: npm run danger ci

services:
docker:
- image: cimg/node:16.15
Expand Down Expand Up @@ -77,13 +57,6 @@ workflows:
ignore:
- master
- gh-pages
- danger:
filters:
branches:
ignore:
- master
- gh-pages
- /dependabot\/.*/
# on-commit-with-cache:
# jobs:
# - npm-install:
Expand All @@ -102,9 +75,3 @@ workflows:
# filters:
# branches:
# ignore: master
# - danger:
# requires:
# - npm-install
# filters:
# branches:
# ignore: /dependabot\/.*/
29 changes: 29 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Danger
on:
pull_request_target:
types: [opened, edited, reopened, synchronize]

permissions:
checks: write
pull-requests: write
statuses: write

jobs:
danger:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup
with:
node-version: 16

- name: Danger
run: npm run danger ci
env:
# https://github.com/gatsbyjs/gatsby/pull/11555
NODE_ENV: test
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
"npm-run-all": "^4.1.5",
"open-cli": "^7.1.0",
"portfinder": "^1.0.32",
"prettier": "2.8.1",
"prettier": "2.8.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-error-overlay": "^6.0.11",
Expand Down
29 changes: 29 additions & 0 deletions services/pipenv-helpers.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
/**
* Common functions and utilities for tasks related to pipenv
*
* @module
*/

import Joi from 'joi'
import { InvalidParameter } from './index.js'

/**
* Joi schema for validating dependency.
*
* @type {Joi}
*/
const isDependency = Joi.object({
version: Joi.string(),
ref: Joi.string(),
}).required()

/**
* Joi schema for validating lock file object.
* Checks if the lock file object has required properties and the properties are valid.
*
* @type {Joi}
*/
const isLockfile = Joi.object({
_meta: Joi.object({
requires: Joi.object({
Expand All @@ -16,6 +33,18 @@ const isLockfile = Joi.object({
develop: Joi.object().pattern(Joi.string(), isDependency),
}).required()

/**
* Determines the dependency version based on the dependency type.
*
* @param {object} attrs - Refer to individual attributes
* @param {string} attrs.kind - Wanted dependency type ('dev' or 'default'), defaults to 'default'
* @param {string} attrs.wantedDependency - Name of the wanted dependency
* @param {object} attrs.lockfileData - Object containing lock file data
* @throws {Error} - Error if unknown dependency type provided
* @throws {InvalidParameter} - Error if wanted dependency is not present in lock file data
* @throws {InvalidParameter} - Error if version or ref is not present for the wanted dependency
* @returns {object} Object containing wanted dependency version or ref
*/
function getDependencyVersion({
kind = 'default',
wantedDependency,
Expand Down

0 comments on commit 6896c65

Please sign in to comment.