trm-client 4.1.1 → 4.2.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.
Files changed (47) hide show
  1. package/changelog.txt +22 -0
  2. package/dist/commands/addRegistry.js +5 -2
  3. package/dist/commands/arguments/ContentArguments.d.ts +6 -0
  4. package/dist/commands/arguments/ContentArguments.js +2 -0
  5. package/dist/commands/arguments/ImportArguments.d.ts +19 -0
  6. package/dist/commands/arguments/ImportArguments.js +2 -0
  7. package/dist/commands/arguments/ListArguments.d.ts +3 -1
  8. package/dist/commands/arguments/PackArguments.d.ts +22 -0
  9. package/dist/commands/arguments/PackArguments.js +2 -0
  10. package/dist/commands/arguments/index.d.ts +2 -0
  11. package/dist/commands/arguments/index.js +2 -0
  12. package/dist/commands/commons/CommandContext.d.ts +3 -3
  13. package/dist/commands/commons/CommandContext.js +2 -1
  14. package/dist/commands/commons/viewRegistryPackage.js +1 -1
  15. package/dist/commands/content.d.ts +2 -0
  16. package/dist/commands/content.js +179 -0
  17. package/dist/commands/import.d.ts +2 -0
  18. package/dist/commands/import.js +82 -0
  19. package/dist/commands/index.d.ts +3 -0
  20. package/dist/commands/index.js +3 -0
  21. package/dist/commands/info.js +11 -4
  22. package/dist/commands/list.js +17 -4
  23. package/dist/commands/pack.d.ts +2 -0
  24. package/dist/commands/pack.js +95 -0
  25. package/dist/commands/view.js +2 -2
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +59 -2
  28. package/dist/registryAlias/RegistryAlias.d.ts +3 -2
  29. package/dist/registryAlias/RegistryAlias.js +9 -6
  30. package/dist/utils/NoConnection.d.ts +53 -46
  31. package/dist/utils/NoConnection.js +50 -41
  32. package/dist/utils/checkTrmDependencies.js +21 -34
  33. package/dist/utils/executeCommand.js +25 -8
  34. package/dist/utils/getClientNodeDependencies.d.ts +3 -0
  35. package/dist/utils/getClientNodeDependencies.js +9 -0
  36. package/dist/utils/getClientVersion.js +2 -2
  37. package/dist/utils/getNodePackage.d.ts +1 -0
  38. package/dist/utils/{getClientPackage.js → getNodePackage.js} +3 -3
  39. package/dist/utils/index.d.ts +2 -3
  40. package/dist/utils/index.js +2 -3
  41. package/dist/utils/registerCommand.js +2 -0
  42. package/package.json +10 -9
  43. package/dist/utils/getClientDependencies.d.ts +0 -1
  44. package/dist/utils/getClientDependencies.js +0 -9
  45. package/dist/utils/getClientPackage.d.ts +0 -1
  46. package/dist/utils/getTrmDependencies.d.ts +0 -1
  47. package/dist/utils/getTrmDependencies.js +0 -9
package/changelog.txt ADDED
@@ -0,0 +1,22 @@
1
+ trm-client changelog
2
+ =================
3
+
4
+ Legend
5
+ ------
6
+ * : fixed
7
+ ! : changed
8
+ + : added
9
+ - : removed
10
+
11
+ 2025-02-26 v4.2.0
12
+ -------------------
13
+
14
+ ! connect to registry via option
15
+ - trm dependencies on client
16
+ + content command
17
+ + pack/import command
18
+
19
+ 2025-04-23 v4.2.1
20
+ -------------------
21
+
22
+ * node-r3trans version read
@@ -18,8 +18,11 @@ function addRegistry(commandArgs) {
18
18
  const auth = commandArgs.authentication;
19
19
  var endpoint = commandArgs.endpoint;
20
20
  var oAuth;
21
- if (registryName.toLowerCase() === 'public') {
22
- throw new Error(`Registry name "public" is a reserved keyword.`);
21
+ if (registryName.toLowerCase() === trm_core_1.PUBLIC_RESERVED_KEYWORD) {
22
+ throw new Error(`Registry name "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" is a reserved keyword.`);
23
+ }
24
+ if (registryName.toLowerCase() === trm_core_1.LOCAL_RESERVED_KEYWORD) {
25
+ throw new Error(`Registry name "${trm_core_1.LOCAL_RESERVED_KEYWORD}" is a reserved keyword.`);
23
26
  }
24
27
  if (auth) {
25
28
  try {
@@ -0,0 +1,6 @@
1
+ export type ContentArguments = {
2
+ package: string;
3
+ all: boolean;
4
+ version?: string;
5
+ r3transPath?: string;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ export type ImportArguments = {
2
+ file: string;
3
+ noPrompts: boolean;
4
+ overwrite: boolean;
5
+ safe: boolean;
6
+ noDependencies: boolean;
7
+ noObjectTypes: boolean;
8
+ noSapEntries: boolean;
9
+ noLanguageTransport: boolean;
10
+ noCustomizingTransport: boolean;
11
+ importTimeout: string;
12
+ keepOriginalPackages: boolean;
13
+ createInstallTransport: boolean;
14
+ r3transPath?: string;
15
+ integrity?: string;
16
+ transportLayer?: string;
17
+ packageReplacements?: string;
18
+ installTransportTargetSys?: string;
19
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,3 @@
1
- export type ListArguments = {};
1
+ export type ListArguments = {
2
+ locals: boolean;
3
+ };
@@ -0,0 +1,22 @@
1
+ export type PackArguments = {
2
+ package: string;
3
+ version?: string;
4
+ outputPath?: string;
5
+ noPrompts: boolean;
6
+ noLanguageTransport: boolean;
7
+ noDependenciesDetection: boolean;
8
+ skipCustomizingTransports: boolean;
9
+ releaseTimeout: string;
10
+ devclass?: string;
11
+ customizingTransports?: string;
12
+ transportTarget?: string;
13
+ backwardsCompatible: boolean;
14
+ description?: string;
15
+ git?: string;
16
+ website?: string;
17
+ license?: string;
18
+ authors?: string;
19
+ keywords?: string;
20
+ dependencies?: string;
21
+ sapEntries?: string;
22
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -19,3 +19,5 @@ export * from "./RemoveRegistryArguments";
19
19
  export * from "./FindDependenciesArguments";
20
20
  export * from "./SettingsArgument";
21
21
  export * from "./UpdateArguments";
22
+ export * from "./ContentArguments";
23
+ export * from "./PackArguments";
@@ -35,3 +35,5 @@ __exportStar(require("./RemoveRegistryArguments"), exports);
35
35
  __exportStar(require("./FindDependenciesArguments"), exports);
36
36
  __exportStar(require("./SettingsArgument"), exports);
37
37
  __exportStar(require("./UpdateArguments"), exports);
38
+ __exportStar(require("./ContentArguments"), exports);
39
+ __exportStar(require("./PackArguments"), exports);
@@ -1,8 +1,8 @@
1
- import { Registry, TrmPackage } from "trm-core";
1
+ import { AbstractRegistry, TrmPackage } from "trm-core";
2
2
  export declare namespace CommandContext {
3
- var registry: Registry;
3
+ var registry: AbstractRegistry;
4
4
  var trmDependencies: TrmPackage[];
5
5
  var missingTrmDependencies: (TrmPackage | string)[];
6
- function getRegistry(): Registry;
6
+ function getRegistry(): AbstractRegistry;
7
7
  function getSystemPackages(): Promise<TrmPackage[]>;
8
8
  }
@@ -29,7 +29,8 @@ var CommandContext;
29
29
  function getSystemPackages() {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
31
  if (!this._systemPackages) {
32
- this._systemPackages = yield trm_core_1.SystemConnector.getInstalledPackages(true);
32
+ trm_core_1.Logger.loading(`Reading system packages...`);
33
+ this._systemPackages = yield trm_core_1.SystemConnector.getInstalledPackages(true, true, true);
33
34
  }
34
35
  return this._systemPackages;
35
36
  });
@@ -21,7 +21,7 @@ function viewRegistryPackage(packageName, print = true) {
21
21
  trm_core_1.Logger.loading(`Reading registry data...`);
22
22
  var oRegistryView;
23
23
  try {
24
- oRegistryView = yield CommandContext_1.CommandContext.getRegistry().view(packageName);
24
+ oRegistryView = yield CommandContext_1.CommandContext.getRegistry().view(packageName, 'latest');
25
25
  }
26
26
  catch (e) {
27
27
  trm_core_1.Logger.error(e, true);
@@ -0,0 +1,2 @@
1
+ import { ContentArguments } from "./arguments";
2
+ export declare function content(commandArgs: ContentArguments): Promise<void>;
@@ -0,0 +1,179 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.content = void 0;
16
+ const trm_core_1 = require("trm-core");
17
+ const commons_1 = require("./commons");
18
+ const utils_1 = require("../utils");
19
+ const chalk_1 = __importDefault(require("chalk"));
20
+ function content(commandArgs) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ trm_core_1.Logger.loading(`Searching package "${commandArgs.package}"...`);
23
+ const remotePackage = new trm_core_1.TrmPackage(commandArgs.package, commons_1.CommandContext.getRegistry());
24
+ const remoteManifest = yield remotePackage.fetchRemoteManifest(commandArgs.version);
25
+ trm_core_1.Logger.loading(`Reading content...`);
26
+ var transports = {};
27
+ var aNodes = [];
28
+ var iOtherEntries = 0;
29
+ const packageContent = yield remotePackage.fetchRemoteContent(commandArgs.version, {
30
+ tempDirPath: (0, utils_1.getTempFolder)(),
31
+ r3transDirPath: commandArgs.r3transPath
32
+ });
33
+ if (!commandArgs.all) {
34
+ transports.TADIR = packageContent.TADIR.trkorr;
35
+ aNodes.push({
36
+ tableName: 'TADIR',
37
+ content: packageContent.TADIR.content.TADIR
38
+ });
39
+ Object.keys(packageContent).forEach(type => {
40
+ if (type === 'TADIR') {
41
+ return;
42
+ }
43
+ Object.keys(packageContent[type].content).forEach(tableName => {
44
+ iOtherEntries += packageContent[type].content[tableName].length;
45
+ });
46
+ });
47
+ }
48
+ else {
49
+ Object.keys(packageContent).forEach(type => {
50
+ transports[type] = packageContent[type].trkorr;
51
+ Object.keys(packageContent[type].content).forEach(tableName => {
52
+ var nodeIndex = aNodes.findIndex(o => o.tableName === tableName);
53
+ if (nodeIndex < 0) {
54
+ nodeIndex = (aNodes.push({
55
+ tableName,
56
+ content: []
57
+ })) - 1;
58
+ }
59
+ aNodes[nodeIndex].content = aNodes[nodeIndex].content.concat(packageContent[type].content[tableName].map(o => {
60
+ o.__isDevc = type === 'DEVC';
61
+ o.__isLang = type === 'LANG';
62
+ o.__isCust = type === 'CUST';
63
+ return o;
64
+ }));
65
+ });
66
+ });
67
+ }
68
+ var tree = {
69
+ text: `${chalk_1.default.bold(commandArgs.package)} v${remoteManifest.get().version} content`,
70
+ children: []
71
+ };
72
+ aNodes.forEach(node => {
73
+ if (node.content.length > 0) {
74
+ var tableNode = {
75
+ text: `${chalk_1.default.bold(node.tableName)} (${node.content.length} record${node.content.length > 1 ? 's' : ''})`,
76
+ children: []
77
+ };
78
+ node.content.forEach(record => {
79
+ var sRecord = [];
80
+ Object.keys(record).filter(k => !k.startsWith('__')).forEach(field => {
81
+ var fieldValue = record[field];
82
+ if (field && fieldValue) {
83
+ if (node.tableName === 'TADIR') {
84
+ if (field === 'SRCSYSTEM') {
85
+ fieldValue = chalk_1.default.strikethrough(fieldValue);
86
+ }
87
+ else if (field === 'DEVCLASS') {
88
+ fieldValue = chalk_1.default.italic(fieldValue);
89
+ }
90
+ }
91
+ sRecord.push(`${chalk_1.default.bold(field)}: ${fieldValue}`);
92
+ }
93
+ });
94
+ if (sRecord.length > 0) {
95
+ if (record.__isDevc) {
96
+ tableNode.children.push({
97
+ text: chalk_1.default.bgGrey(sRecord.join(', ')),
98
+ children: []
99
+ });
100
+ }
101
+ else if (record.__isLang) {
102
+ tableNode.children.push({
103
+ text: chalk_1.default.bgGreen(sRecord.join(', ')),
104
+ children: []
105
+ });
106
+ }
107
+ else if (record.__isCust) {
108
+ tableNode.children.push({
109
+ text: chalk_1.default.bgYellow(sRecord.join(', ')),
110
+ children: []
111
+ });
112
+ }
113
+ else {
114
+ tableNode.children.push({
115
+ text: sRecord.join(', '),
116
+ children: []
117
+ });
118
+ }
119
+ }
120
+ });
121
+ tree.children.push(tableNode);
122
+ }
123
+ });
124
+ trm_core_1.Logger.tree(tree);
125
+ var header = ['Namespace', 'ABAP Package', 'TRM Transport', 'Customizing', 'Translations'];
126
+ var row1 = [];
127
+ var row2 = [];
128
+ if (remoteManifest.get().namespace) {
129
+ row1.push(`\u2714`);
130
+ row2.push(remoteManifest.get().namespace.replicense);
131
+ }
132
+ else {
133
+ row1.push(`\u274C`);
134
+ row2.push(``);
135
+ }
136
+ if (Object.keys(packageContent).includes('DEVC')) {
137
+ row1.push(`\u2714 ${packageContent['DEVC'].trkorr}`);
138
+ row2.push(`${chalk_1.default.bgGrey('Highlight')}`);
139
+ }
140
+ else {
141
+ row1.push(`\u274C`);
142
+ row2.push(``);
143
+ }
144
+ if (Object.keys(packageContent).includes('TADIR')) {
145
+ row1.push(`\u2714 ${packageContent['TADIR'].trkorr}`);
146
+ row2.push(``);
147
+ }
148
+ else {
149
+ row1.push(`\u274C`);
150
+ row2.push(``);
151
+ }
152
+ if (Object.keys(packageContent).includes('CUST')) {
153
+ row1.push(`\u2714 ${packageContent['CUST'].trkorr}`);
154
+ row2.push(`${chalk_1.default.bgYellow('Highlight')}`);
155
+ }
156
+ else {
157
+ row1.push(`\u274C`);
158
+ row2.push(``);
159
+ }
160
+ if (Object.keys(packageContent).includes('LANG')) {
161
+ row1.push(`\u2714 ${packageContent['LANG'].trkorr}`);
162
+ row2.push(`${chalk_1.default.bgGreen('Highlight')}`);
163
+ }
164
+ else {
165
+ row1.push(`\u274C`);
166
+ row2.push(``);
167
+ }
168
+ if (row2.filter(s => s.length > 0).length > 0) {
169
+ trm_core_1.Logger.table(header, [row1, row2]);
170
+ }
171
+ else {
172
+ trm_core_1.Logger.table(header, [row1]);
173
+ }
174
+ if (iOtherEntries > 0) {
175
+ trm_core_1.Logger.warning(`There are ${iOtherEntries} other records to show. Run with option --all in order to see them.`);
176
+ }
177
+ });
178
+ }
179
+ exports.content = content;
@@ -0,0 +1,2 @@
1
+ import { ImportArguments } from "./arguments/ImportArguments";
2
+ export declare function _import(commandArgs: ImportArguments): Promise<void>;
@@ -0,0 +1,82 @@
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._import = void 0;
13
+ const trm_core_1 = require("trm-core");
14
+ const utils_1 = require("../utils");
15
+ const commons_1 = require("./commons");
16
+ const _parsePackageReplacementsArgument = (arg) => {
17
+ if (arg) {
18
+ try {
19
+ return JSON.parse(arg);
20
+ }
21
+ catch (e) { }
22
+ }
23
+ };
24
+ const _parseImportTimeoutArg = (arg) => {
25
+ if (arg) {
26
+ try {
27
+ return parseInt(arg);
28
+ }
29
+ catch (e) { }
30
+ }
31
+ };
32
+ function _import(commandArgs) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const registry = new trm_core_1.FileSystem(commandArgs.file);
35
+ const packages = yield commons_1.CommandContext.getSystemPackages();
36
+ const result = yield (0, trm_core_1.install)({
37
+ contextData: {
38
+ r3transOptions: {
39
+ tempDirPath: (0, utils_1.getTempFolder)(),
40
+ r3transDirPath: commandArgs.r3transPath
41
+ },
42
+ noInquirer: commandArgs.noPrompts,
43
+ systemPackages: packages,
44
+ noR3transInfo: false
45
+ },
46
+ packageData: {
47
+ name: 'dummy',
48
+ overwrite: commandArgs.overwrite,
49
+ integrity: commandArgs.integrity,
50
+ registry
51
+ },
52
+ installData: {
53
+ checks: {
54
+ safe: commandArgs.safe,
55
+ noDependencies: commandArgs.noDependencies,
56
+ noObjectTypes: commandArgs.noObjectTypes,
57
+ noSapEntries: commandArgs.noSapEntries
58
+ },
59
+ import: {
60
+ noLang: commandArgs.noLanguageTransport,
61
+ noCust: commandArgs.noCustomizingTransport,
62
+ timeout: _parseImportTimeoutArg(commandArgs.importTimeout)
63
+ },
64
+ installDevclass: {
65
+ keepOriginal: commandArgs.keepOriginalPackages,
66
+ transportLayer: commandArgs.transportLayer,
67
+ replacements: _parsePackageReplacementsArgument(commandArgs.packageReplacements)
68
+ },
69
+ installTransport: {
70
+ create: commandArgs.createInstallTransport,
71
+ targetSystem: commandArgs.installTransportTargetSys
72
+ }
73
+ }
74
+ });
75
+ var sOutput = `${result.trmPackage.packageName} installed`;
76
+ if (result.installTransport) {
77
+ sOutput += `, use ${result.installTransport.trkorr} transport in landscape`;
78
+ }
79
+ trm_core_1.Logger.success(sOutput);
80
+ });
81
+ }
82
+ exports._import = _import;
@@ -20,3 +20,6 @@ export * from "./check";
20
20
  export * from "./findDependencies";
21
21
  export * from "./settings";
22
22
  export * from "./update";
23
+ export * from "./content";
24
+ export * from "./pack";
25
+ export * from "./import";
@@ -36,3 +36,6 @@ __exportStar(require("./check"), exports);
36
36
  __exportStar(require("./findDependencies"), exports);
37
37
  __exportStar(require("./settings"), exports);
38
38
  __exportStar(require("./update"), exports);
39
+ __exportStar(require("./content"), exports);
40
+ __exportStar(require("./pack"), exports);
41
+ __exportStar(require("./import"), exports);
@@ -21,10 +21,10 @@ const path_1 = __importDefault(require("path"));
21
21
  const get_root_path_1 = require("get-root-path");
22
22
  const chalk_1 = __importDefault(require("chalk"));
23
23
  const semver_1 = require("semver");
24
- const _getDependencyVersion = (moduleName) => {
24
+ const _getDependencyVersion = (moduleName, rootModule = 'trm-client') => {
25
25
  var file;
26
26
  try {
27
- file = (0, fs_1.readFileSync)(path_1.default.join(get_root_path_1.rootPath, `/node_modules/trm-client/node_modules/${moduleName}/package.json`));
27
+ file = (0, fs_1.readFileSync)(path_1.default.join(get_root_path_1.rootPath, `/node_modules/${rootModule}/node_modules/${moduleName}/package.json`));
28
28
  }
29
29
  catch (e) {
30
30
  file = (0, fs_1.readFileSync)(path_1.default.join(get_root_path_1.rootPath, `/node_modules/${moduleName}/package.json`));
@@ -71,11 +71,12 @@ function info(commandArgs) {
71
71
  const npmGlobal = yield (0, trm_core_1.getNpmGlobalPath)();
72
72
  const clientLatest = yield (0, utils_1.checkCliUpdate)(false);
73
73
  const clientVersion = (0, utils_1.getClientVersion)();
74
- const clientDependencies = (0, utils_1.getClientDependencies)() || {};
75
- const trmDependencies = (0, utils_1.getTrmDependencies)() || {};
74
+ const clientDependencies = (0, utils_1.getClientNodeDependencies)();
75
+ const trmDependencies = (0, trm_core_1.getCoreTrmDependencies)();
76
76
  const trmDependenciesInstances = commons_1.CommandContext.trmDependencies;
77
77
  const trmMissingDependencies = commons_1.CommandContext.missingTrmDependencies;
78
78
  const nodeRfcVersion = _getNodeRfcVersion(npmGlobal);
79
+ const nodeR3transVersion = _getDependencyVersion("node-r3trans", "trm-core");
79
80
  const packages = yield commons_1.CommandContext.getSystemPackages();
80
81
  const trmRest = packages.find(o => o.compareName("trm-rest") && o.compareRegistry(new trm_core_1.Registry(trm_core_1.PUBLIC_RESERVED_KEYWORD)));
81
82
  var clientDependenciesTree = [];
@@ -166,6 +167,12 @@ function info(commandArgs) {
166
167
  children: []
167
168
  });
168
169
  }
170
+ if (nodeR3transVersion) {
171
+ clientChildrenTree.push({
172
+ text: yield _getNpmLatestForText('node-r3trans', nodeR3transVersion, `node-r3trans ${nodeR3transVersion}`),
173
+ children: []
174
+ });
175
+ }
169
176
  const clientTree = {
170
177
  text: chalk_1.default.bold(`Client`),
171
178
  children: clientChildrenTree
@@ -8,15 +8,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.list = void 0;
13
16
  const trm_core_1 = require("trm-core");
14
17
  const commons_1 = require("./commons");
18
+ const chalk_1 = __importDefault(require("chalk"));
15
19
  function list(commandArgs) {
16
20
  return __awaiter(this, void 0, void 0, function* () {
17
21
  trm_core_1.Logger.loading(`Reading packages...`);
18
22
  const dest = trm_core_1.SystemConnector.getDest();
19
- const aPackages = yield commons_1.CommandContext.getSystemPackages();
23
+ var aPackages = yield commons_1.CommandContext.getSystemPackages();
24
+ var iLocals = aPackages.filter(o => o.registry.getRegistryType() === trm_core_1.RegistryType.LOCAL).length;
25
+ if (!commandArgs.locals) {
26
+ aPackages = aPackages.filter(o => o.registry.getRegistryType() !== trm_core_1.RegistryType.LOCAL);
27
+ }
20
28
  if (aPackages.length > 0) {
21
29
  const tableHead = [`Name`, `Version`, `Registry`, `Devclass`, `Import transport`];
22
30
  var tableData = [];
@@ -24,10 +32,13 @@ function list(commandArgs) {
24
32
  try {
25
33
  const packageName = oPackage.packageName || '';
26
34
  const version = oPackage.manifest.get().version || '';
27
- const registry = oPackage.registry.getRegistryType() === trm_core_1.RegistryType.PUBLIC ? 'public' : oPackage.registry.endpoint;
35
+ const registry = oPackage.registry.getRegistryType() === trm_core_1.RegistryType.LOCAL ? chalk_1.default.bold(oPackage.registry.name) : oPackage.registry.name;
28
36
  const devclass = oPackage.getDevclass() || '';
29
37
  const linkedTransport = oPackage.manifest.getLinkedTransport();
30
- const importTransport = linkedTransport ? linkedTransport.trkorr : '';
38
+ var importTransport = '';
39
+ if (linkedTransport && (yield linkedTransport.isImported())) {
40
+ importTransport = linkedTransport.trkorr;
41
+ }
31
42
  tableData.push([
32
43
  packageName,
33
44
  version,
@@ -44,8 +55,10 @@ function list(commandArgs) {
44
55
  trm_core_1.Logger.warning(`${aPackages.length - tableData.length} packages couldn't be printed (check logs).`);
45
56
  }
46
57
  trm_core_1.Logger.info(`${dest} has ${aPackages.length} packages.`);
47
- trm_core_1.Logger.log(`\n`);
48
58
  trm_core_1.Logger.table(tableHead, tableData);
59
+ if (iLocals > 0 && !commandArgs.locals) {
60
+ trm_core_1.Logger.warning(`There ${iLocals === 1 ? 'is' : 'are'} ${iLocals} local package${iLocals === 1 ? '' : 's'}. Run with option -l (--locals) to list ${iLocals === 1 ? 'it' : 'them'}.`);
61
+ }
49
62
  }
50
63
  else {
51
64
  trm_core_1.Logger.info(`${dest} has 0 packages.`);
@@ -0,0 +1,2 @@
1
+ import { PackArguments } from "./arguments";
2
+ export declare function pack(commandArgs: PackArguments): Promise<void>;
@@ -0,0 +1,95 @@
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.pack = void 0;
13
+ const trm_core_1 = require("trm-core");
14
+ const utils_1 = require("../utils");
15
+ const commons_1 = require("./commons");
16
+ const _parseDependenciesArg = (arg) => {
17
+ if (arg) {
18
+ try {
19
+ return JSON.parse(arg);
20
+ }
21
+ catch (e) { }
22
+ }
23
+ };
24
+ const _parseSapEntriesArg = (arg) => {
25
+ if (arg) {
26
+ try {
27
+ return JSON.parse(arg);
28
+ }
29
+ catch (e) { }
30
+ }
31
+ };
32
+ const _parseReleaseTimeoutArg = (arg) => {
33
+ if (arg) {
34
+ try {
35
+ return parseInt(arg);
36
+ }
37
+ catch (e) { }
38
+ }
39
+ };
40
+ function pack(commandArgs) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ var outputPath = commandArgs.outputPath;
43
+ if (!outputPath) {
44
+ if (commandArgs.noPrompts) {
45
+ throw new Error(`Provide an output path for the file with option -o (--output). Run with option -h (--help) for more information.`);
46
+ }
47
+ else {
48
+ outputPath = (yield trm_core_1.Inquirer.prompt({
49
+ message: `Output path`,
50
+ name: 'outputPath',
51
+ type: `input`
52
+ })).outputPath;
53
+ }
54
+ }
55
+ const registry = new trm_core_1.FileSystem(outputPath);
56
+ const packages = yield commons_1.CommandContext.getSystemPackages();
57
+ const result = yield (0, trm_core_1.publish)({
58
+ contextData: {
59
+ logTemporaryFolder: (0, utils_1.getTempFolder)(),
60
+ systemPackages: packages,
61
+ noInquirer: commandArgs.noPrompts
62
+ },
63
+ packageData: {
64
+ name: commandArgs.package,
65
+ version: commandArgs.version,
66
+ devclass: commandArgs.devclass,
67
+ manifest: {
68
+ authors: commandArgs.authors,
69
+ backwardsCompatible: commandArgs.backwardsCompatible,
70
+ description: commandArgs.description,
71
+ git: commandArgs.git,
72
+ keywords: commandArgs.keywords,
73
+ license: commandArgs.license,
74
+ website: commandArgs.website,
75
+ dependencies: _parseDependenciesArg(commandArgs.dependencies),
76
+ sapEntries: _parseSapEntriesArg(commandArgs.sapEntries)
77
+ },
78
+ registry
79
+ },
80
+ publishData: {
81
+ noLanguageTransport: commandArgs.noLanguageTransport,
82
+ noDependenciesDetection: commandArgs.noDependenciesDetection,
83
+ skipCustomizingTransports: commandArgs.skipCustomizingTransports,
84
+ customizingTransports: commandArgs.customizingTransports
85
+ },
86
+ systemData: {
87
+ releaseTimeout: _parseReleaseTimeoutArg(commandArgs.releaseTimeout),
88
+ transportTarget: commandArgs.transportTarget
89
+ }
90
+ });
91
+ const sOutput = `+ ${result.trmPackage.manifest.get().name} ${result.trmPackage.manifest.get().version} >> ${outputPath}`;
92
+ trm_core_1.Logger.success(sOutput);
93
+ });
94
+ }
95
+ exports.pack = pack;
@@ -105,8 +105,8 @@ const _printDependenciesSection = (dependencies) => {
105
105
  const dependencyName = o.name;
106
106
  const dependencyVersion = o.version;
107
107
  var dependencyRegistry;
108
- if (!o.registry || o.registry.trim().toLowerCase() === 'public') {
109
- dependencyRegistry = 'public';
108
+ if (!o.registry || o.registry.trim().toLowerCase() === trm_core_1.PUBLIC_RESERVED_KEYWORD) {
109
+ dependencyRegistry = trm_core_1.PUBLIC_RESERVED_KEYWORD;
110
110
  }
111
111
  else {
112
112
  const oRegistryAlias = registryAliases.find(k => k.endpointUrl === o.registry);
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import 'dotenv/config';
2
+ export {};