@uxf/scripts 14.2.0 → 14.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/gitlab.js +2 -1
- package/src/gitlab.test.js +12 -0
- package/src/uxf-release/cli.js +8 -0
- package/src/uxf-release/index.js +4 -1
- package/src/uxf-release/run.test.js +16 -0
package/README.md
CHANGED
|
@@ -48,6 +48,7 @@ Without the options below it behaves as it always did. They let a project releas
|
|
|
48
48
|
- `--notes-file` – Markdown used instead of the commit list, in the release as is and in the message converted to Google Chat formatting. The migration warning is still added.
|
|
49
49
|
- `--fallback-note` – put before the commit list when the notes file is missing or empty, so a failed notes job still ends in a release that says what to do.
|
|
50
50
|
- `--no-release` – send the message only, e.g. when deploying an already released version to production.
|
|
51
|
+
- `--no-release-migration-warning` – keep the DB migration warning in the message only, out of the release description, e.g. when the release is shown to end users.
|
|
51
52
|
|
|
52
53
|
```
|
|
53
54
|
Usage:
|
|
@@ -72,6 +73,7 @@ Options:
|
|
|
72
73
|
--notes-file Markdown used instead of the commit list
|
|
73
74
|
--fallback-note Text before the commit list when notes are missing
|
|
74
75
|
--release Create the GitLab release; --no-release only notifies
|
|
76
|
+
--release-migration-warning Also in the release; --no-… keeps it in the message
|
|
75
77
|
-d, --dry-run Skip publishing and notifications [boolean]
|
|
76
78
|
-h, --help Show help [boolean]
|
|
77
79
|
```
|
package/package.json
CHANGED
package/src/gitlab.js
CHANGED
|
@@ -108,7 +108,8 @@ async function findMigrationFiles(commits) {
|
|
|
108
108
|
}),
|
|
109
109
|
);
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
// Diffy se stahují souběžně, bez řazení by pořadí záviselo na tom, který doběhne dřív.
|
|
112
|
+
const migrationList = Array.from(migrationFiles).sort();
|
|
112
113
|
console.log(`Nalezeno ${migrationList.length} migračních souborů.`);
|
|
113
114
|
return migrationList;
|
|
114
115
|
}
|
package/src/gitlab.test.js
CHANGED
|
@@ -228,6 +228,18 @@ describe("compareCommits", () => {
|
|
|
228
228
|
});
|
|
229
229
|
|
|
230
230
|
describe("findMigrationFiles", () => {
|
|
231
|
+
it("lists the migrations sorted, whichever diff answers first", async () => {
|
|
232
|
+
stubFetch([
|
|
233
|
+
{ body: [{ new_path: "api/migrations/Version20260301120000.php" }] },
|
|
234
|
+
{ body: [{ new_path: "api/migrations/Version20260101120000.php" }] },
|
|
235
|
+
]);
|
|
236
|
+
|
|
237
|
+
await expect(GitLab.findMigrationFiles([{ id: "new" }, { id: "old" }])).resolves.toEqual([
|
|
238
|
+
"api/migrations/Version20260101120000.php",
|
|
239
|
+
"api/migrations/Version20260301120000.php",
|
|
240
|
+
]);
|
|
241
|
+
});
|
|
242
|
+
|
|
231
243
|
it("collects api migration files and ignores everything else", async () => {
|
|
232
244
|
stubFetch([
|
|
233
245
|
{
|
package/src/uxf-release/cli.js
CHANGED
|
@@ -76,6 +76,13 @@ Environment variables:
|
|
|
76
76
|
default: true,
|
|
77
77
|
group: "Options",
|
|
78
78
|
})
|
|
79
|
+
.option("release-migration-warning", {
|
|
80
|
+
describe:
|
|
81
|
+
"Put the DB migration warning in the release too (--no-release-migration-warning keeps it in the message only)",
|
|
82
|
+
type: "boolean",
|
|
83
|
+
default: true,
|
|
84
|
+
group: "Options",
|
|
85
|
+
})
|
|
79
86
|
.option("d", {
|
|
80
87
|
alias: "dry-run",
|
|
81
88
|
describe: "Skip publishing and sending slack notification",
|
|
@@ -132,6 +139,7 @@ Environment variables:
|
|
|
132
139
|
notes: notesFile && existsSync(notesFile) ? readFileSync(notesFile, "utf8") : undefined,
|
|
133
140
|
fallbackNote: options["fallback-note"],
|
|
134
141
|
release: options.release,
|
|
142
|
+
releaseMigrationWarning: options["release-migration-warning"],
|
|
135
143
|
channel: slackChannel,
|
|
136
144
|
googleChatWebhook: googleChatWebhook || env.GOOGLE_WEBHOOK_URL,
|
|
137
145
|
});
|
package/src/uxf-release/index.js
CHANGED
|
@@ -127,6 +127,7 @@ function generateBody({ commits, notes, fallbackNote }) {
|
|
|
127
127
|
* notes?: string,
|
|
128
128
|
* fallbackNote?: string,
|
|
129
129
|
* release?: boolean,
|
|
130
|
+
* releaseMigrationWarning?: boolean,
|
|
130
131
|
* }}
|
|
131
132
|
*/
|
|
132
133
|
module.exports = async function (config) {
|
|
@@ -172,7 +173,9 @@ module.exports = async function (config) {
|
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
await GitLab.createReleaseForTag({
|
|
175
|
-
|
|
176
|
+
// Varování o migracích je pro toho, kdo nasazuje; projekt, který release ukazuje uživatelům, ho
|
|
177
|
+
// může nechat jen ve zprávě (--no-release-migration-warning).
|
|
178
|
+
description: (config.releaseMigrationWarning === false ? "" : migrationWarning) + body.release,
|
|
176
179
|
tag: config.tag || GitLab.generateTagName(config.tagPrefix),
|
|
177
180
|
ref,
|
|
178
181
|
dryRun: config.dryRun,
|
|
@@ -85,6 +85,22 @@ describe("uxf-release", () => {
|
|
|
85
85
|
expect(GoogleChat.chatPostMessage.mock.calls[0][0].text).toBe("ACU\n\n*Novinky*\n\n• Žluté složky\n");
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
it("keeps the migration warning in the message only with --no-release-migration-warning", async () => {
|
|
89
|
+
GitLab.compareCommits.mockResolvedValue([commit]);
|
|
90
|
+
GitLab.findMigrationFiles.mockResolvedValue(["api/migrations/Version1.php"]);
|
|
91
|
+
|
|
92
|
+
await release({
|
|
93
|
+
messageTitle: "ACU",
|
|
94
|
+
from: "1.0.20",
|
|
95
|
+
tag: "1.0.21",
|
|
96
|
+
notes: "- Notes",
|
|
97
|
+
releaseMigrationWarning: false,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
expect(GitLab.createReleaseForTag.mock.calls[0][0].description).toBe("- Notes");
|
|
101
|
+
expect(GoogleChat.chatPostMessage.mock.calls[0][0].text).toContain("api/migrations/Version1.php");
|
|
102
|
+
});
|
|
103
|
+
|
|
88
104
|
it("only sends the message with --no-release", async () => {
|
|
89
105
|
GitLab.compareCommits.mockResolvedValue([commit]);
|
|
90
106
|
|