Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: RasPhilCo/leif
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: peternhale/leif
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 7, 2021

  1. Copy the full SHA
    7159900 View commit details

Commits on Apr 8, 2021

  1. Revert "fix: jobs not applied properly when target has more entries t…

    …han source"
    
    This reverts commit 7159900.
    peternhale committed Apr 8, 2021
    Copy the full SHA
    c306d1d View commit details
  2. Copy the full SHA
    9f67b36 View commit details
Showing with 20 additions and 7 deletions.
  1. +2 −1 package.json
  2. +4 −5 src/asserters/yaml.ts
  3. +14 −1 yarn.lock
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@
"cli-ux": "^5.3.3",
"fast-glob": "^3.2.5",
"fs-extra": "^9.1.0",
"js-yaml": "^4.0.0"
"js-yaml": "^4.0.0",
"merge-yaml": "^1.1.0"
},
"devDependencies": {
"@oclif/dev-cli": "^1",
9 changes: 4 additions & 5 deletions src/asserters/yaml.ts
Original file line number Diff line number Diff line change
@@ -3,15 +3,14 @@ import * as fs from 'fs-extra'
import * as yaml from 'js-yaml'

import AsserterBase from './base'
import {deepAssign} from '../utils'

const mergeYaml = require('merge-yaml')

export class YamlHasPropertiesAsserter extends AsserterBase {
protected async uniqWork() {
const targetYamlPath = path.join(this.workingDir, this.assertion.target_relative_filepath)
const sourceYamlAsJson = yaml.load(await fs.readFile(path.join(this.templateDir, this.assertion.source_relative_filepath), 'utf-8')) as object
const targetYamlAsJson = yaml.load(await fs.readFile(targetYamlPath, 'utf-8')) as object

const assertedJson = deepAssign({...targetYamlAsJson}, sourceYamlAsJson)
const sourceYamlPath = path.join(this.templateDir, this.assertion.source_relative_filepath)
const assertedJson = mergeYaml([targetYamlPath, sourceYamlPath])
const assertedYaml = yaml.dump(assertedJson, {indent: 2})
await fs.writeFile(targetYamlPath, assertedYaml)
}
15 changes: 14 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
@@ -1922,7 +1922,7 @@ js-yaml@4.0.0, js-yaml@^4.0.0:
dependencies:
argparse "^2.0.1"

js-yaml@^3.13.1:
js-yaml@^3.13.1, js-yaml@^3.6.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
@@ -2046,6 +2046,11 @@ lodash.kebabcase@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"

lodash.merge@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
@@ -2118,6 +2123,14 @@ make-error@^1.1.1:
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==

merge-yaml@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/merge-yaml/-/merge-yaml-1.1.0.tgz#4d0a72c27abbd54ffd266d48a1ea910869209489"
integrity sha512-SBNEC9hh6Ibxrwv7DUpmVObjTrSaHeO9VTbbZ0rIIzMi/BfYXYYikj/aSgXwsCWQyaUIGsE2wZsgc5sLr/Tn3Q==
dependencies:
js-yaml "^3.6.1"
lodash.merge "^4.6.2"

merge2@^1.2.3, merge2@^1.3.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"