trm-client 6.0.1 → 6.1.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 +4 -0
- package/dist/commands/arguments/LockArguments.d.ts +4 -0
- package/dist/commands/arguments/LockArguments.js +2 -0
- package/dist/commands/arguments/index.d.ts +1 -0
- package/dist/commands/arguments/index.js +1 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/lock.d.ts +2 -0
- package/dist/commands/lock.js +64 -0
- package/dist/commands/publish.js +1 -1
- package/dist/index.js +10 -1
- package/package.json +1 -1
package/changelog.txt
CHANGED
|
@@ -37,3 +37,4 @@ __exportStar(require("./SettingsArgument"), exports);
|
|
|
37
37
|
__exportStar(require("./UpdateArguments"), exports);
|
|
38
38
|
__exportStar(require("./ContentArguments"), exports);
|
|
39
39
|
__exportStar(require("./PackArguments"), exports);
|
|
40
|
+
__exportStar(require("./LockArguments"), exports);
|
package/dist/commands/index.d.ts
CHANGED
package/dist/commands/index.js
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
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.lock = lock;
|
|
13
|
+
const trm_core_1 = require("trm-core");
|
|
14
|
+
const commons_1 = require("./commons");
|
|
15
|
+
const trm_commons_1 = require("trm-commons");
|
|
16
|
+
const fs_1 = require("fs");
|
|
17
|
+
function resolveRegistry(registry) {
|
|
18
|
+
if (!registry || registry.trim().toLowerCase() === trm_core_1.PUBLIC_RESERVED_KEYWORD) {
|
|
19
|
+
return 'https://trmregistry.com/registry/';
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return registry;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function lock(commandArgs) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var lock = {
|
|
28
|
+
lockfileVersion: 1,
|
|
29
|
+
packages: []
|
|
30
|
+
};
|
|
31
|
+
const packages = yield commons_1.CommandContext.getSystemPackages();
|
|
32
|
+
const root = packages.find(o => o.compareName(commandArgs.package) && o.compareRegistry(commons_1.CommandContext.getRegistry()));
|
|
33
|
+
if (!root) {
|
|
34
|
+
throw new Error(`Package "${commandArgs.package}" not found`);
|
|
35
|
+
}
|
|
36
|
+
const rootManifest = root.manifest.get();
|
|
37
|
+
var dependencies = rootManifest.dependencies || [];
|
|
38
|
+
lock.name = rootManifest.name;
|
|
39
|
+
lock.version = rootManifest.version;
|
|
40
|
+
for (const dep of dependencies) {
|
|
41
|
+
const registryResolved = resolveRegistry(dep.registry);
|
|
42
|
+
if (!lock.packages.find(o => o.name === dep.name && o.registry === registryResolved)) {
|
|
43
|
+
const depRegistry = trm_core_1.RegistryProvider.getRegistry(dep.registry);
|
|
44
|
+
const depPackage = packages.find(o => o.compareName(dep.name) && o.compareRegistry(depRegistry));
|
|
45
|
+
if (depPackage) {
|
|
46
|
+
const depManifest = depPackage.manifest.get();
|
|
47
|
+
const depIntegrity = yield trm_core_1.SystemConnector.getPackageIntegrity(depPackage);
|
|
48
|
+
lock.packages.push({
|
|
49
|
+
name: dep.name,
|
|
50
|
+
version: depManifest.version,
|
|
51
|
+
registry: registryResolved,
|
|
52
|
+
integrity: depIntegrity
|
|
53
|
+
});
|
|
54
|
+
dependencies = dependencies.concat(depManifest.dependencies || []);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
trm_commons_1.Logger.warning(`Dependency "${dep.name}", registry "${registryResolved}" not found in system ${trm_core_1.SystemConnector.getDest()}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
(0, fs_1.writeFileSync)(commandArgs.outputPath, JSON.stringify(lock, null, 2));
|
|
62
|
+
trm_commons_1.Logger.info(`Generated lock file "${commandArgs.outputPath}"`);
|
|
63
|
+
});
|
|
64
|
+
}
|
package/dist/commands/publish.js
CHANGED
|
@@ -122,7 +122,7 @@ function publish(commandArgs) {
|
|
|
122
122
|
transportTarget: commandArgs.transportTarget
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
|
-
const sOutput = `+ ${result.trmPackage.manifest.get().name} ${result.trmPackage.manifest.get().version} on ${commons_1.CommandContext.getRegistry().name}`;
|
|
125
|
+
const sOutput = `+ ${result.trmPackage.manifest.get().name} v${result.trmPackage.manifest.get().version} on ${commons_1.CommandContext.getRegistry().name}`;
|
|
126
126
|
trm_commons_1.Logger.success(sOutput);
|
|
127
127
|
});
|
|
128
128
|
}
|
package/dist/index.js
CHANGED
|
@@ -117,7 +117,7 @@ const pack = program.command(`pack`)
|
|
|
117
117
|
Translation transport is only generated for packages that contain one or more objects with translations (unless skipped by flag).
|
|
118
118
|
Customizing transport is only generated if a valid list of customizing transports is provided (unless skipped by flag).
|
|
119
119
|
If a default manifest with dependencies is provided in conjunction with the automatic dependency generation, results will be merged.`)
|
|
120
|
-
.option(`-o, --output
|
|
120
|
+
.option(`-o, --output <outputPath>`, `Output path.`)
|
|
121
121
|
.option(`-np, --noPrompts`, `No prompts (will force some decisions).`, false)
|
|
122
122
|
.option(`-nl, --noLanguageTransport`, `Skip language (translations) transport publish.`, false)
|
|
123
123
|
.option(`-nd, --noDependenciesDetection`, `Skip automatic dependencies detection.`, false)
|
|
@@ -221,6 +221,15 @@ const _import = program.command(`import <file>`)
|
|
|
221
221
|
requiresConnection: true,
|
|
222
222
|
requiresTrmDependencies: true
|
|
223
223
|
});
|
|
224
|
+
const lock = program.command(`lock`)
|
|
225
|
+
.argument(`<package>`, `Name of the package to generate lock file.`)
|
|
226
|
+
.argument(`[outputPath]`, `Output path.`, 'trm-lock.json')
|
|
227
|
+
.description(`Generate lock file.`);
|
|
228
|
+
(0, utils_1.registerCommand)(lock, {
|
|
229
|
+
requiresConnection: true,
|
|
230
|
+
requiresRegistry: true,
|
|
231
|
+
ignoreRegistryUnreachable: true
|
|
232
|
+
});
|
|
224
233
|
const view = program.command(`view`)
|
|
225
234
|
.argument(`<package>`, `Name of the package to view.`)
|
|
226
235
|
.description(`View package.`)
|