Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Jul 26, 2023
1 parent 922a59f commit b81c673
Show file tree
Hide file tree
Showing 27 changed files with 943 additions and 801 deletions.
26 changes: 10 additions & 16 deletions .github/actions/get-workspaces/index.js

Large diffs are not rendered by default.

52 changes: 23 additions & 29 deletions .github/actions/release-manager/index.js

Large diffs are not rendered by default.

406 changes: 202 additions & 204 deletions .github/actions/release-please/index.js

Large diffs are not rendered by default.

36 changes: 0 additions & 36 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,3 @@ updates:
prefix-development: chore
labels:
- "Dependencies"
- package-ecosystem: npm
directory: workspaces/config/
schedule:
interval: daily
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
commit-message:
prefix: deps
prefix-development: chore
labels:
- "Dependencies"
- package-ecosystem: npm
directory: workspaces/get-workspaces/
schedule:
interval: daily
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
commit-message:
prefix: deps
prefix-development: chore
labels:
- "Dependencies"
- package-ecosystem: npm
directory: workspaces/release-manager/
schedule:
interval: daily
allow:
- dependency-type: direct
versioning-strategy: increase-if-necessary
commit-message:
prefix: deps
prefix-development: chore
labels:
- "Dependencies"
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,3 @@
!/workspaces/release-manager/
!/workspaces/release-please/
!/workspaces/rules/
!/workspaces/
/workspaces/*
!/workspaces/config/
!/workspaces/get-workspaces/
!/workspaces/release-manager/
!/workspaces/release-please/
!/workspaces/rules/
5 changes: 1 addition & 4 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
".": "4.11.4",
"workspaces/config": "1.0.0",
"workspaces/get-workspaces": "1.0.0",
"workspaces/release-manager": "1.0.0"
".": "4.11.4"
}
130 changes: 0 additions & 130 deletions lib/config.js

This file was deleted.

51 changes: 51 additions & 0 deletions lib/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const { omit } = require('lodash')
const { mergeWithArrays } = require('./merge')

const mergeDataOptions = mergeWithArrays('mergeArrays')

// Lookup a key in any config. First lookup the toplevel key
// and then lookup the same key in either the toplevel `root`
// or `workspace` objects
const getRootOrWorkspace = (data = {}, options) => {
const sharedData = omit(data, 'root', 'workspace')
const pkgData = options.pkg.isRoot ? data.root : data.workspace
return [sharedData, pkgData].filter(Boolean)
}

// Get the `data` config object and run it through the `postData`
// config function at each layer and then merge the results
const getData = (configs, baseOptions) => {
const dataLayers = configs.flatMap(({ config }) =>
getRootOrWorkspace(config.data, baseOptions))

const allLayers = dataLayers.reduce((acc, data) => {
if (data.values) {
acc.values.push(data.values)
}
if (data.options) {
acc.options.push(data.options)
}
if (data.postData) {
acc.postData.push(data.postData)
}
return acc
}, { values: [], options: [], postData: [] })

const mergedOptions = mergeDataOptions(...allLayers.options)
const mergeValues = mergeWithArrays(...mergedOptions.mergeArrays ?? [])

const allData = []
for (const values of allLayers.values) {
allData.push(values)
for (const fn of allLayers.postData) {
allData.push(fn(values, baseOptions))
}
}

return mergeValues(...allData)
}

module.exports = {
getData,
getRootOrWorkspace,
}

0 comments on commit b81c673

Please sign in to comment.