trm-core 9.9.0 → 9.10.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/changelog.txt +6 -0
- package/dist/actions/publish/index.d.ts +1 -0
- package/dist/actions/publish/index.js +2 -0
- package/dist/actions/publish/publishToRegistry.js +2 -1
- package/dist/actions/publish/setChangelog.d.ts +3 -0
- package/dist/actions/publish/setChangelog.js +69 -0
- package/dist/registry/AbstractRegistry.d.ts +1 -1
- package/dist/registry/RegistryV2.d.ts +1 -1
- package/dist/registry/RegistryV2.js +34 -2
- package/dist/trmPackage/TrmPackage.d.ts +1 -0
- package/dist/trmPackage/TrmPackage.js +1 -1
- package/package.json +2 -2
package/changelog.txt
CHANGED
|
@@ -32,6 +32,7 @@ export interface PublishActionInput {
|
|
|
32
32
|
keepLatestReleaseManifestValues?: boolean;
|
|
33
33
|
private?: boolean;
|
|
34
34
|
readme?: string;
|
|
35
|
+
changelog?: string;
|
|
35
36
|
skipCustomizingTransports?: boolean;
|
|
36
37
|
customizingTransports?: string | Transport[];
|
|
37
38
|
noLanguageTransport?: boolean;
|
|
@@ -33,6 +33,7 @@ const updatePackageData_1 = require("./updatePackageData");
|
|
|
33
33
|
const publishToRegistry_1 = require("./publishToRegistry");
|
|
34
34
|
const getSourceCode_1 = require("./getSourceCode");
|
|
35
35
|
const checkAllObjectsReleased_1 = require("./checkAllObjectsReleased");
|
|
36
|
+
const setChangelog_1 = require("./setChangelog");
|
|
36
37
|
;
|
|
37
38
|
const WORKFLOW_NAME = 'publish';
|
|
38
39
|
function publish(inputData) {
|
|
@@ -48,6 +49,7 @@ function publish(inputData) {
|
|
|
48
49
|
setManifestValues_1.setManifestValues,
|
|
49
50
|
setCustomizingTransports_1.setCustomizingTransports,
|
|
50
51
|
setReadme_1.setReadme,
|
|
52
|
+
setChangelog_1.setChangelog,
|
|
51
53
|
getSourceCode_1.getSourceCode,
|
|
52
54
|
checkAllObjectsReleased_1.checkAllObjectsReleased,
|
|
53
55
|
generateDevcTransport_1.generateDevcTransport,
|
|
@@ -30,7 +30,8 @@ exports.publishToRegistry = {
|
|
|
30
30
|
yield context.runtime.trmPackage.package.publish({
|
|
31
31
|
artifact: context.runtime.trmPackage.artifact,
|
|
32
32
|
readme: context.rawInput.publishData.readme,
|
|
33
|
-
tags: context.rawInput.packageData.tags
|
|
33
|
+
tags: context.rawInput.packageData.tags,
|
|
34
|
+
changelog: context.rawInput.publishData.changelog
|
|
34
35
|
});
|
|
35
36
|
})
|
|
36
37
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.setChangelog = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
|
+
const registry_1 = require("../../registry");
|
|
15
|
+
exports.setChangelog = {
|
|
16
|
+
name: 'set-changelog',
|
|
17
|
+
filter: (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
if (context.rawInput.publishData.changelog !== undefined) {
|
|
19
|
+
trm_commons_1.Logger.log(`Skipping changelog input (user provided)`, true);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
if (context.rawInput.packageData.registry.getRegistryType() === registry_1.RegistryType.LOCAL) {
|
|
24
|
+
trm_commons_1.Logger.log(`Skipping changelog input (registry is local)`, true);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
run: (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
trm_commons_1.Logger.log('Set changelog step', true);
|
|
34
|
+
if (!context.rawInput.contextData.noInquirer) {
|
|
35
|
+
context.rawInput.publishData.changelog = (yield trm_commons_1.Inquirer.prompt([{
|
|
36
|
+
message: `Do you want to write a release changelog?`,
|
|
37
|
+
type: 'confirm',
|
|
38
|
+
name: 'editChangelog',
|
|
39
|
+
default: false
|
|
40
|
+
}, {
|
|
41
|
+
message: 'Write changelog',
|
|
42
|
+
type: 'editor',
|
|
43
|
+
name: 'changelog',
|
|
44
|
+
postfix: '.md',
|
|
45
|
+
when: (hash) => {
|
|
46
|
+
return hash.editChangelog;
|
|
47
|
+
},
|
|
48
|
+
default: `${context.rawInput.packageData.name} changelog
|
|
49
|
+
=================
|
|
50
|
+
|
|
51
|
+
Legend
|
|
52
|
+
------
|
|
53
|
+
\`\`\`
|
|
54
|
+
* : fixed
|
|
55
|
+
! : changed
|
|
56
|
+
+ : added
|
|
57
|
+
- : removed
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
${new Date().toISOString().split('T')[0]} v${context.runtime.trmPackage.manifest.version}
|
|
61
|
+
-------------------
|
|
62
|
+
\`\`\`
|
|
63
|
+
...
|
|
64
|
+
\`\`\`
|
|
65
|
+
`
|
|
66
|
+
}])).changelog;
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
};
|
|
@@ -13,7 +13,7 @@ export declare abstract class AbstractRegistry {
|
|
|
13
13
|
abstract getPackage: (fullName: string, version: string) => Promise<Package>;
|
|
14
14
|
abstract downloadArtifact: (fullName: string, version: string) => Promise<TrmArtifact>;
|
|
15
15
|
abstract validatePublish: (fullName: string, version: string, isPrivate: boolean) => Promise<void>;
|
|
16
|
-
abstract publish: (fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string) => Promise<Package | void>;
|
|
16
|
+
abstract publish: (fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string, changelog?: string) => Promise<Package | void>;
|
|
17
17
|
abstract unpublish: (fullName: string, version: string) => Promise<void>;
|
|
18
18
|
abstract deprecate: (fullName: string, version: string, deprecate: Deprecate) => Promise<void>;
|
|
19
19
|
abstract addDistTag: (fullName: string, distTag: DistTagAdd) => Promise<void>;
|
|
@@ -26,7 +26,7 @@ export declare class RegistryV2 implements AbstractRegistry {
|
|
|
26
26
|
getPackage(fullName: string, version?: string): Promise<Package>;
|
|
27
27
|
downloadArtifact(fullName: string, version?: string): Promise<TrmArtifact>;
|
|
28
28
|
validatePublish(fullName: string, version: string, isPrivate: boolean): Promise<void>;
|
|
29
|
-
publish(fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string): Promise<void>;
|
|
29
|
+
publish(fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string, changelog?: string): Promise<void>;
|
|
30
30
|
unpublish(fullName: string, version: string): Promise<void>;
|
|
31
31
|
deprecate(fullName: string, version: string, deprecate: Deprecate): Promise<void>;
|
|
32
32
|
addDistTag(fullName: string, distTag: DistTagAdd): Promise<void>;
|
|
@@ -459,7 +459,7 @@ class RegistryV2 {
|
|
|
459
459
|
}
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
|
-
publish(fullName, version, artifact, readme, tags) {
|
|
462
|
+
publish(fullName, version, artifact, readme, tags, changelog) {
|
|
463
463
|
return __awaiter(this, void 0, void 0, function* () {
|
|
464
464
|
const fileName = `${fullName}_v${version}`.replace('.', '_') + '.trm';
|
|
465
465
|
const formData = new FormData.default();
|
|
@@ -473,14 +473,46 @@ class RegistryV2 {
|
|
|
473
473
|
contentType: 'text/markdown'
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
|
+
if (changelog) {
|
|
477
|
+
formData.append('changelog', Buffer.from(changelog), {
|
|
478
|
+
filename: 'changelog.md',
|
|
479
|
+
contentType: 'text/markdown'
|
|
480
|
+
});
|
|
481
|
+
}
|
|
476
482
|
var params = { version, tags };
|
|
477
483
|
if (!tags) {
|
|
478
484
|
delete params.tags;
|
|
479
485
|
}
|
|
480
|
-
yield this._axiosInstance.post(`/publish/${fullName}`, formData, {
|
|
486
|
+
const response = yield this._axiosInstance.post(`/publish/${fullName}`, formData, {
|
|
481
487
|
params,
|
|
482
488
|
headers: formData.getHeaders()
|
|
483
489
|
});
|
|
490
|
+
if (response.status === 202) {
|
|
491
|
+
let publishStatus = response.data;
|
|
492
|
+
const progressPoolUrl = publishStatus.progress_pool_url;
|
|
493
|
+
const logProgress = trm_commons_1.Logger.progressbar(`↑ ${fullName} ${version} [{bar}] {value}/{total} {message} | Last refresh: {lastRefresh}`, '>');
|
|
494
|
+
logProgress.start(publishStatus.steps, publishStatus.current_step, {
|
|
495
|
+
message: publishStatus.current_step_message || '',
|
|
496
|
+
lastRefresh: new Date().toLocaleTimeString()
|
|
497
|
+
});
|
|
498
|
+
try {
|
|
499
|
+
while (publishStatus.current_step < publishStatus.steps) {
|
|
500
|
+
yield new Promise(resolve => setTimeout(resolve, 5000));
|
|
501
|
+
publishStatus = (yield this._axiosInstance.get(progressPoolUrl)).data;
|
|
502
|
+
logProgress.update(publishStatus.current_step, {
|
|
503
|
+
message: publishStatus.current_step_message || '',
|
|
504
|
+
lastCheck: new Date().toLocaleTimeString()
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
catch (e) {
|
|
509
|
+
trm_commons_1.Logger.error(e.toString());
|
|
510
|
+
trm_commons_1.Logger.warning(`Unable to check status on registry, check manually`);
|
|
511
|
+
}
|
|
512
|
+
finally {
|
|
513
|
+
logProgress.stop();
|
|
514
|
+
}
|
|
515
|
+
}
|
|
484
516
|
});
|
|
485
517
|
}
|
|
486
518
|
unpublish(fullName, version) {
|
|
@@ -51,7 +51,7 @@ class TrmPackage {
|
|
|
51
51
|
tags = data.tags.join(',');
|
|
52
52
|
}
|
|
53
53
|
trm_commons_1.Logger.loading(`Publishing "${packageName}" ${packageVersion} to registry "${this.registry.name}"...`, false);
|
|
54
|
-
yield this.registry.publish(packageName, packageVersion, artifact, data.readme, tags);
|
|
54
|
+
yield this.registry.publish(packageName, packageVersion, artifact, data.readme, tags, data.changelog);
|
|
55
55
|
this.manifest = new manifest_1.Manifest(trmManifest);
|
|
56
56
|
return this;
|
|
57
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trm-core",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"description": "TRM (Transport Request Manager) Core",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"semver": "^7.5.4",
|
|
63
63
|
"semver-sort": "^1.0.0",
|
|
64
64
|
"spdx-license-ids": "^3.0.13",
|
|
65
|
-
"trm-registry-types": "^2.
|
|
65
|
+
"trm-registry-types": "^2.4.0",
|
|
66
66
|
"xml-beautify": "^1.2.3",
|
|
67
67
|
"xml-js": "^1.6.11"
|
|
68
68
|
},
|