(metaphysicsEnv, metaphysicsVersion = 2)
| 19 | } |
| 20 | |
| 21 | const getBreakingChanges = async (metaphysicsEnv, metaphysicsVersion = 2) => { |
| 22 | const localSchema = readFileSync( |
| 23 | path.join(__dirname, "../data/schema.graphql"), |
| 24 | { |
| 25 | encoding: "utf8", |
| 26 | } |
| 27 | ) |
| 28 | const metaphysicsSchemaSuffix = metaphysicsVersion === 2 ? "V2" : "" |
| 29 | const metaphysicsRef = metaphysicsEnv == "production" ? "release" : "staging" |
| 30 | const metaphyicsSchema = await downloadMetaphysicsSchema( |
| 31 | `https://raw.githubusercontent.com/artsy/metaphysics/${metaphysicsRef}/_schema${metaphysicsSchemaSuffix}.graphql` |
| 32 | ) |
| 33 | |
| 34 | const allChanges = diff( |
| 35 | buildSchema(localSchema), |
| 36 | buildSchema(metaphyicsSchema) |
| 37 | ) |
| 38 | const breakings = allChanges.filter(c => c.criticality.level === "BREAKING") |
| 39 | const messages = breakings.map(c => c.message) |
| 40 | return messages |
| 41 | } |
| 42 | |
| 43 | module.exports = { |
| 44 | getBreakingChanges, |
no test coverage detected