-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
48 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { dirname } from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
import { readPackageUp } from 'read-pkg-up' | ||
|
||
// Retrieve runtime versions common to all runners | ||
export const getCommonVersions = async function () { | ||
return await getSpydVersion() | ||
} | ||
|
||
// Store the `spyd` version on each result | ||
// TODO: use static JSON imports once those are possible | ||
const getSpydVersion = async function () { | ||
const cwd = dirname(fileURLToPath(import.meta.url)) | ||
const { | ||
packageJson: { version }, | ||
} = await readPackageUp({ cwd, normalize: false }) | ||
return { Spyd: version } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { groupBy } from '../../../utils/group.js' | ||
|
||
// Merge `result.combinations[*].dimensions.runner.versions` into | ||
// `result.systems[*].versions`. | ||
export const mergeSystemVersions = function (rawResult) { | ||
const versions = getSystemVersions(rawResult) | ||
return { ...rawResult, systems: [{ ...rawResult.systems[0], versions }] } | ||
} | ||
|
||
const getSystemVersions = function ({ combinations }) { | ||
const runners = combinations.map(getRunner) | ||
const versionsArray = Object.values(groupBy(runners, 'id')).map( | ||
getRunnerVersions, | ||
) | ||
return Object.assign({}, ...versionsArray) | ||
} | ||
|
||
const getRunner = function ({ dimensions: { runner } }) { | ||
return runner | ||
} | ||
|
||
const getRunnerVersions = function ([{ versions }]) { | ||
return versions | ||
} |