-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): patch renovate post execution mode
- Loading branch information
1 parent
5ebc9d8
commit 8eef82c
Showing
8 changed files
with
89 additions
and
14 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
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
17 changes: 17 additions & 0 deletions
17
packages/dev-dependencies/patches/updateRenovatePostExecutionMode.js
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,17 @@ | ||
const path = require("path"); | ||
const { readJson, writeJsonFile } = require("../utils"); | ||
|
||
function updateRenovatePostExecutionMode() { | ||
const renovateJsonPath = path.resolve("renovate.json"); | ||
const renovateJson = readJson(renovateJsonPath); | ||
|
||
if ( | ||
renovateJson.postUpgradeTasks && | ||
renovateJson.postUpgradeTasks.executionMode !== "branch" | ||
) { | ||
renovateJson.postUpgradeTasks.executionMode = "branch"; | ||
writeJsonFile(renovateJsonPath, renovateJson); | ||
} | ||
} | ||
|
||
module.exports = updateRenovatePostExecutionMode; |
40 changes: 40 additions & 0 deletions
40
packages/dev-dependencies/patches/updateRenovatePostExecutionMode.spec.js
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,40 @@ | ||
const updateRenovatePostExecutionMode = require("./updateRenovatePostExecutionMode"); | ||
const { writeJsonFile, readJson } = require("../utils"); | ||
|
||
jest.mock("../utils"); | ||
|
||
describe("updateRenovatePostExecutionMode", () => { | ||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it("should ignore if no postUpgradeTasks", () => { | ||
readJson.mockReturnValueOnce({ | ||
packageRules: [ | ||
{ | ||
groupName: "next-core packages", | ||
}, | ||
], | ||
}); | ||
updateRenovatePostExecutionMode(); | ||
expect(writeJsonFile).not.toBeCalled(); | ||
}); | ||
|
||
it("should update fileFilters", () => { | ||
readJson.mockReturnValueOnce({ | ||
postUpgradeTasks: { | ||
commands: ["yarn renew"], | ||
}, | ||
}); | ||
updateRenovatePostExecutionMode(); | ||
expect(writeJsonFile).toBeCalledWith( | ||
expect.stringContaining("renovate.json"), | ||
{ | ||
postUpgradeTasks: { | ||
commands: ["yarn renew"], | ||
executionMode: "branch", | ||
}, | ||
} | ||
); | ||
}); | ||
}); |