trm-core 6.0.0 → 6.1.1
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/dist/actions/publish/init.js +2 -1
- package/dist/actions/publish/setManifestValues.js +22 -24
- package/dist/actions/publish/setTransportTarget.js +1 -1
- package/dist/inquirer/validators/index.d.ts +1 -0
- package/dist/inquirer/validators/index.js +1 -0
- package/dist/inquirer/validators/validateDevclass.d.ts +1 -1
- package/dist/inquirer/validators/validatePackageVisibility.d.ts +2 -0
- package/dist/inquirer/validators/validatePackageVisibility.js +26 -0
- package/dist/inquirer/validators/validateTransportTarget.d.ts +1 -1
- package/dist/inquirer/validators/validateTransportTarget.js +3 -0
- package/dist/manifest/Manifest.d.ts +3 -0
- package/dist/manifest/Manifest.js +31 -2
- package/package.json +1 -1
- package/dist/actions/publish/generateCustTr.d.ts +0 -3
- package/dist/actions/publish/generateCustTr.js +0 -72
|
@@ -136,7 +136,8 @@ exports.init = {
|
|
|
136
136
|
registry,
|
|
137
137
|
manifest: Object.assign(Object.assign({}, context.rawInput.packageData.manifest), {
|
|
138
138
|
name: context.rawInput.packageData.name,
|
|
139
|
-
version: context.rawInput.packageData.version
|
|
139
|
+
version: context.rawInput.packageData.version,
|
|
140
|
+
private: context.rawInput.publishData.private
|
|
140
141
|
})
|
|
141
142
|
},
|
|
142
143
|
systemData: {
|
|
@@ -39,11 +39,8 @@ exports.setManifestValues = {
|
|
|
39
39
|
else if (o.email) {
|
|
40
40
|
author = o.email;
|
|
41
41
|
}
|
|
42
|
-
else {
|
|
43
|
-
throw new Error(`Invalid manifest values: authors.`);
|
|
44
|
-
}
|
|
45
42
|
return author;
|
|
46
|
-
}).join(', ');
|
|
43
|
+
}).filter(o => o !== undefined).join(', ');
|
|
47
44
|
}
|
|
48
45
|
else {
|
|
49
46
|
defaultAuthors = context.runtime.trmPackage.manifest.authors;
|
|
@@ -55,6 +52,21 @@ exports.setManifestValues = {
|
|
|
55
52
|
defaultKeywords = context.runtime.trmPackage.manifest.keywords;
|
|
56
53
|
}
|
|
57
54
|
var inq = yield inquirer_1.Inquirer.prompt([{
|
|
55
|
+
type: "list",
|
|
56
|
+
message: "Package visibility",
|
|
57
|
+
name: "private",
|
|
58
|
+
default: false,
|
|
59
|
+
choices: [{
|
|
60
|
+
name: `Public`,
|
|
61
|
+
value: false
|
|
62
|
+
}, {
|
|
63
|
+
name: `Private`,
|
|
64
|
+
value: true
|
|
65
|
+
}],
|
|
66
|
+
validate: (input) => {
|
|
67
|
+
return (0, inquirer_1.validatePackageVisibility)(context.rawInput.packageData.registry.getRegistryType(), context.rawInput.packageData.name, input);
|
|
68
|
+
},
|
|
69
|
+
}, {
|
|
58
70
|
type: "input",
|
|
59
71
|
message: "Short description",
|
|
60
72
|
name: "description",
|
|
@@ -124,28 +136,14 @@ exports.setManifestValues = {
|
|
|
124
136
|
name: "license",
|
|
125
137
|
default: context.runtime.trmPackage.manifest.license
|
|
126
138
|
}]);
|
|
127
|
-
inq.authors = inq.authors.split(',').map(s => {
|
|
128
|
-
const match = s.trim().match(/^(.*?)(?:\s*<([^>]+)>)?$/);
|
|
129
|
-
if (match && match.length >= 3) {
|
|
130
|
-
return {
|
|
131
|
-
name: match[1] ? match[1].trim() : undefined,
|
|
132
|
-
email: match[2] ? match[2].trim() : undefined
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
throw new Error(`Invalid manifest values: authors.`);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
inq.keywords = inq.keywords.split(',').map(s => {
|
|
140
|
-
if (s) {
|
|
141
|
-
return s.trim();
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
throw new Error(`Invalid manifest values: keywords.`);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
139
|
context.runtime.trmPackage.manifest = Object.assign(Object.assign({}, context.runtime.trmPackage.manifest), inq);
|
|
148
140
|
}
|
|
141
|
+
else {
|
|
142
|
+
const validateVisibility = (0, inquirer_1.validatePackageVisibility)(context.rawInput.packageData.registry.getRegistryType(), context.rawInput.packageData.name, context.runtime.trmPackage.manifest.private);
|
|
143
|
+
if (validateVisibility !== true) {
|
|
144
|
+
throw new Error(validateVisibility);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
149
147
|
if (context.runtime.packageData.namespace) {
|
|
150
148
|
context.runtime.trmPackage.manifest.namespace = {
|
|
151
149
|
replicense: context.runtime.packageData.namespace.trnspacet.replicense,
|
|
@@ -48,7 +48,7 @@ exports.setTransportTarget = {
|
|
|
48
48
|
if (validate && validate !== true) {
|
|
49
49
|
throw new Error(validate);
|
|
50
50
|
}
|
|
51
|
-
logger_1.Logger.info(`Publish transport target:
|
|
51
|
+
logger_1.Logger.info(`Publish transport release target: ${transportTarget}`);
|
|
52
52
|
}
|
|
53
53
|
context.rawInput.systemData.transportTarget = transportTarget;
|
|
54
54
|
})
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./validateDevclass"), exports);
|
|
18
18
|
__exportStar(require("./validateTransportTarget"), exports);
|
|
19
|
+
__exportStar(require("./validatePackageVisibility"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DEVCLASS } from "../../client";
|
|
2
|
-
export declare function validateDevclass(devclass: DEVCLASS, allowTemporaryPackages?: boolean): Promise<string | true
|
|
2
|
+
export declare function validateDevclass(devclass: DEVCLASS, allowTemporaryPackages?: boolean): Promise<string | true>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePackageVisibility = validatePackageVisibility;
|
|
4
|
+
const commons_1 = require("../../commons");
|
|
5
|
+
const registry_1 = require("../../registry");
|
|
6
|
+
function validatePackageVisibility(registryType, packageName, isPrivate) {
|
|
7
|
+
if (registryType === registry_1.RegistryType.PUBLIC) {
|
|
8
|
+
if (isPrivate) {
|
|
9
|
+
const packageNameParsed = (0, commons_1.parsePackageName)({
|
|
10
|
+
fullName: packageName
|
|
11
|
+
});
|
|
12
|
+
if (!packageNameParsed.organization) {
|
|
13
|
+
return `Private packages on public registry need a scope!`;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TR_TARGET, TMSCSYS } from "../../client";
|
|
2
|
-
export declare function validateTransportTarget(target: TR_TARGET, systemTmscsys: TMSCSYS[]): Promise<string | true
|
|
2
|
+
export declare function validateTransportTarget(target: TR_TARGET, systemTmscsys: TMSCSYS[]): Promise<string | true>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TrmManifest } from "./TrmManifest";
|
|
2
2
|
import { Transport } from "../transport";
|
|
3
3
|
import { TrmPackage } from "../trmPackage";
|
|
4
|
+
import { TrmManifestAuthor } from "./TrmManifestAuthor";
|
|
4
5
|
export declare class Manifest {
|
|
5
6
|
private _manifest;
|
|
6
7
|
constructor(_manifest: TrmManifest);
|
|
@@ -17,4 +18,6 @@ export declare class Manifest {
|
|
|
17
18
|
static _parseAbapXmlSapEntriesArray(input: any): any[];
|
|
18
19
|
static fromJson(sJson: string): Manifest;
|
|
19
20
|
static compare(o1: Manifest, o2: Manifest, checkVersion?: boolean): boolean;
|
|
21
|
+
static stringAuthorsToArray(sAuthors: string): TrmManifestAuthor[];
|
|
22
|
+
static stringKeywordsToArray(sKeywords: string): string[];
|
|
20
23
|
}
|
|
@@ -351,7 +351,7 @@ class Manifest {
|
|
|
351
351
|
if (manifestClone.authors) {
|
|
352
352
|
var aAuthors;
|
|
353
353
|
if (typeof (manifestClone.authors) === 'string') {
|
|
354
|
-
aAuthors = manifestClone.authors
|
|
354
|
+
aAuthors = this.stringAuthorsToArray(manifestClone.authors);
|
|
355
355
|
}
|
|
356
356
|
else {
|
|
357
357
|
aAuthors = manifestClone.authors;
|
|
@@ -382,7 +382,7 @@ class Manifest {
|
|
|
382
382
|
if (manifestClone.keywords) {
|
|
383
383
|
var originalKeywords;
|
|
384
384
|
if (typeof (manifestClone.keywords) === 'string') {
|
|
385
|
-
originalKeywords = manifestClone.keywords
|
|
385
|
+
originalKeywords = this.stringKeywordsToArray(manifestClone.keywords);
|
|
386
386
|
}
|
|
387
387
|
else {
|
|
388
388
|
originalKeywords = manifestClone.keywords;
|
|
@@ -598,5 +598,34 @@ class Manifest {
|
|
|
598
598
|
const s2 = o2.getKey(checkVersion);
|
|
599
599
|
return s1 === s2;
|
|
600
600
|
}
|
|
601
|
+
static stringAuthorsToArray(sAuthors) {
|
|
602
|
+
var authors = [];
|
|
603
|
+
if (sAuthors) {
|
|
604
|
+
sAuthors.split(',').forEach(s => {
|
|
605
|
+
if (s) {
|
|
606
|
+
const match = sAuthors.trim().match(/^(.*?)(?:\s*<([^>]+)>)?$/);
|
|
607
|
+
if (match && match.length >= 3) {
|
|
608
|
+
authors.push({
|
|
609
|
+
name: match[1] ? match[1].trim() : undefined,
|
|
610
|
+
email: match[2] ? match[2].trim() : undefined
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
return authors;
|
|
617
|
+
}
|
|
618
|
+
static stringKeywordsToArray(sKeywords) {
|
|
619
|
+
if (sKeywords) {
|
|
620
|
+
return sKeywords.split(',').map(s => {
|
|
621
|
+
if (s) {
|
|
622
|
+
return s.trim();
|
|
623
|
+
}
|
|
624
|
+
}).filter(k => k !== undefined);
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
return [];
|
|
628
|
+
}
|
|
629
|
+
}
|
|
601
630
|
}
|
|
602
631
|
exports.Manifest = Manifest;
|
package/package.json
CHANGED
|
@@ -1,72 +0,0 @@
|
|
|
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.generateCustTr = void 0;
|
|
13
|
-
const transport_1 = require("../../transport");
|
|
14
|
-
const logger_1 = require("../../logger");
|
|
15
|
-
exports.generateCustTr = {
|
|
16
|
-
name: 'generate-cust-tr',
|
|
17
|
-
filter: (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
if (!context.parsedInput.skipCust && context.runtime.inputCustTransports.length > 0) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
logger_1.Logger.log(`Skipping CUST transport (no input in step)`, true);
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}),
|
|
26
|
-
run: (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
const customizingTransports = context.runtime.inputCustTransports;
|
|
28
|
-
logger_1.Logger.loading(`Generating CUST transport...`);
|
|
29
|
-
context.runtime.custTransport = yield transport_1.Transport.createToc({
|
|
30
|
-
target: context.parsedInput.trTarget,
|
|
31
|
-
text: `@X1@TRM: ${context.runtime.manifest.name} v${context.runtime.manifest.version} (C)`,
|
|
32
|
-
trmIdentifier: transport_1.TrmTransportIdentifier.CUST
|
|
33
|
-
});
|
|
34
|
-
context.runtime.tryCustDeleteRevert = true;
|
|
35
|
-
for (const transport of customizingTransports) {
|
|
36
|
-
yield context.runtime.custTransport.addObjectsFromTransport(transport.trkorr);
|
|
37
|
-
}
|
|
38
|
-
var e071 = yield context.runtime.custTransport.getE071();
|
|
39
|
-
e071 = e071.filter(o => !(o.pgmid === 'CORR' && o.object === 'MERG'));
|
|
40
|
-
if (e071.length === 0) {
|
|
41
|
-
logger_1.Logger.info(`Customizing transport has no content.`);
|
|
42
|
-
yield context.runtime.custTransport.delete();
|
|
43
|
-
delete context.runtime.custTransport;
|
|
44
|
-
context.runtime.tryCustDeleteRevert = false;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
const wrongEntries = e071.filter(o => !(o.pgmid === 'R3TR' && o.object === 'TABU'));
|
|
48
|
-
if (wrongEntries.length > 0) {
|
|
49
|
-
throw new Error(`Customizing transport contains invalid objects.`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}),
|
|
53
|
-
revert: (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
-
if (context.runtime.tryCustDeleteRevert) {
|
|
55
|
-
logger_1.Logger.loading(`Rollback CUST transport ${context.runtime.custTransport.trkorr}...`);
|
|
56
|
-
try {
|
|
57
|
-
const canBeDeleted = yield context.runtime.custTransport.canBeDeleted();
|
|
58
|
-
if (canBeDeleted) {
|
|
59
|
-
yield context.runtime.custTransport.delete();
|
|
60
|
-
logger_1.Logger.info(`Executed rollback on transport ${context.runtime.custTransport.trkorr}`);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
throw new Error(`Transport ${context.runtime.custTransport.trkorr} cannot be deleted`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
logger_1.Logger.info(`Unable to rollback transport ${context.runtime.custTransport.trkorr}`);
|
|
68
|
-
logger_1.Logger.error(e.toString(), true);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
};
|