balena-deploy-request 0.8.0 → 0.8.2-specify-package-name-3ab5faddab1da937fa8f6f9beebf664f63b16b8c
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/CHANGELOG.md +10 -0
- package/package.json +4 -1
- package/src/index.js +11 -35
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file
|
|
|
4
4
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
# v0.8.2
|
|
8
|
+
## (2022-04-21)
|
|
9
|
+
|
|
10
|
+
* Allow specifying a package name for when there is no package.json [Pagan Gazzard]
|
|
11
|
+
|
|
12
|
+
# v0.8.1
|
|
13
|
+
## (2021-07-06)
|
|
14
|
+
|
|
15
|
+
* Remove CODEOWNERS [Page-]
|
|
16
|
+
|
|
7
17
|
# v0.8.0
|
|
8
18
|
## (2020-03-30)
|
|
9
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balena-deploy-request",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2-specify-package-name-3ab5faddab1da937fa8f6f9beebf664f63b16b8c",
|
|
4
4
|
"description": "A simple script for generating deploy requests along with release notes",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,5 +33,8 @@
|
|
|
33
33
|
"husky": "^2.2.0",
|
|
34
34
|
"lint-staged": "^8.1.6",
|
|
35
35
|
"prettier": "^1.17.1"
|
|
36
|
+
},
|
|
37
|
+
"versionist": {
|
|
38
|
+
"publishedAt": "2022-04-21T15:20:00.044Z"
|
|
36
39
|
}
|
|
37
40
|
}
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const { git, gitMultilineResults, toTitleCase } = require('./utils');
|
|
3
3
|
|
|
4
|
-
let packageName;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
let packageName = process.argv[2];
|
|
5
|
+
if (!packageName) {
|
|
6
|
+
try {
|
|
7
|
+
packageName = JSON.parse(fs.readFileSync('./package.json').toString()).name;
|
|
8
|
+
} catch (e) {
|
|
9
|
+
console.error(
|
|
10
|
+
`No 'package.json' found, you can manually specify a package name as the first argument`,
|
|
11
|
+
);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
const packageNameAliases = {
|
|
@@ -23,31 +27,6 @@ const moduleName =
|
|
|
23
27
|
moduleAliases[packageName] ||
|
|
24
28
|
packageName.replace('resin-', '').replace('balena-', '');
|
|
25
29
|
|
|
26
|
-
function getCodeowners() {
|
|
27
|
-
// git ls-files '*CODEOWNERS'
|
|
28
|
-
// * @user1 @user2
|
|
29
|
-
let codeownerSet = new Set();
|
|
30
|
-
const codeownersFiles = gitMultilineResults('ls-files *CODEOWNERS');
|
|
31
|
-
codeownersFiles.forEach(function(file) {
|
|
32
|
-
codeownerLine = fs
|
|
33
|
-
.readFileSync(file)
|
|
34
|
-
.toString()
|
|
35
|
-
.toLowerCase()
|
|
36
|
-
.split('\n')
|
|
37
|
-
.filter(n => n && !n.startsWith('#'));
|
|
38
|
-
codeownerLine.forEach(function(owner) {
|
|
39
|
-
owner
|
|
40
|
-
.split(/\s+/)
|
|
41
|
-
.slice(1)
|
|
42
|
-
.filter(n => n)
|
|
43
|
-
.forEach(function(user) {
|
|
44
|
-
codeownerSet.add(user);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
return Array.from(codeownerSet);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
30
|
function getLatestProdInfo() {
|
|
52
31
|
const tags = gitMultilineResults('tag -l --sort=refname production-*');
|
|
53
32
|
if (tags.length === 0) {
|
|
@@ -108,8 +87,6 @@ const date = new Date().toISOString().match(/\d+-\d+-\d+/)[0];
|
|
|
108
87
|
|
|
109
88
|
const changelog = rawChangelog.map(l => l.replace(/^\+/, ''));
|
|
110
89
|
|
|
111
|
-
const codeowners = getCodeowners();
|
|
112
|
-
|
|
113
90
|
const notableChanges = changelog.filter(l => l.match(/^\* /));
|
|
114
91
|
|
|
115
92
|
const result = [
|
|
@@ -117,11 +94,10 @@ const result = [
|
|
|
117
94
|
'',
|
|
118
95
|
`#devops please deploy #${packageName} ${newVersion} to production`,
|
|
119
96
|
'@@devops',
|
|
120
|
-
`CODEOWNERS: ${codeowners.join(' ')}`,
|
|
121
97
|
'',
|
|
122
98
|
'================================ Release notes =================================',
|
|
123
99
|
'```',
|
|
124
|
-
`# ${toTitleCase(packageName)} release
|
|
100
|
+
`# ${toTitleCase(packageName)} release-notes ${date}`,
|
|
125
101
|
'',
|
|
126
102
|
`The ${moduleName} has been updated from ${oldVersion} to ${newVersion}`,
|
|
127
103
|
'',
|