@microtronics/studio-cli 0.50.0 → 0.51.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.md +13 -1
- package/README.md +15 -0
- package/dist/main.js +24 -24
- package/dist/studio-cli.d.ts +3 -1
- package/out/log.js +8 -0
- package/out/myDatanetClient.js +7 -2
- package/package.json +1 -1
package/dist/studio-cli.d.ts
CHANGED
|
@@ -138,7 +138,7 @@ export declare function build(cwd: URI, fs: LocalFS, logger: Log.Logger, env: Gl
|
|
|
138
138
|
/**
|
|
139
139
|
* Build development installation info from manifest and options
|
|
140
140
|
*/
|
|
141
|
-
export declare function buildDevelopmentInstallInfo(cwd: URI, fs: LocalFS, serialNumber: string, userName: string, customerUid: string | null): Promise<DevelopmentInstallInfo>;
|
|
141
|
+
export declare function buildDevelopmentInstallInfo(cwd: URI, fs: LocalFS, logger: Log.Logger, serialNumber: string, userName: string, customerUid: string | null, customSiteName?: string): Promise<DevelopmentInstallInfo>;
|
|
142
142
|
|
|
143
143
|
declare interface components {
|
|
144
144
|
schemas: {
|
|
@@ -2184,10 +2184,12 @@ export declare namespace Log {
|
|
|
2184
2184
|
};
|
|
2185
2185
|
export class Logger {
|
|
2186
2186
|
private _logHandler;
|
|
2187
|
+
private _silent;
|
|
2187
2188
|
constructor(logOutput?: {
|
|
2188
2189
|
log: (...args: any[]) => void;
|
|
2189
2190
|
});
|
|
2190
2191
|
_log(type: LogMessageType, msg: any, ...args: any[]): void;
|
|
2192
|
+
set silent(value: boolean);
|
|
2191
2193
|
log(msg: any, ...args: any[]): void;
|
|
2192
2194
|
error(msg: any, ...args: any[]): void;
|
|
2193
2195
|
info(msg: any, ...args: any[]): void;
|
package/out/log.js
CHANGED
|
@@ -24,13 +24,21 @@ var Log;
|
|
|
24
24
|
};
|
|
25
25
|
class Logger {
|
|
26
26
|
_logHandler;
|
|
27
|
+
_silent = false;
|
|
27
28
|
constructor(logOutput = console) {
|
|
28
29
|
this._logHandler = logOutput;
|
|
29
30
|
}
|
|
30
31
|
_log(type, msg, ...args) {
|
|
32
|
+
// only log errors if silent is set
|
|
33
|
+
if (this._silent && type !== LogMessageType.error) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
31
36
|
args = [Log.LOG_PREFIX[type], msg, ...args];
|
|
32
37
|
this._logHandler.log(...args);
|
|
33
38
|
}
|
|
39
|
+
set silent(value) {
|
|
40
|
+
this._silent = value;
|
|
41
|
+
}
|
|
34
42
|
log(msg, ...args) {
|
|
35
43
|
this._log(LogMessageType.log, msg, ...args);
|
|
36
44
|
}
|
package/out/myDatanetClient.js
CHANGED
|
@@ -265,7 +265,7 @@ function generateDevApmId(developmentReference) {
|
|
|
265
265
|
/**
|
|
266
266
|
* Build development installation info from manifest and options
|
|
267
267
|
*/
|
|
268
|
-
async function buildDevelopmentInstallInfo(cwd, fs, serialNumber, userName, customerUid) {
|
|
268
|
+
async function buildDevelopmentInstallInfo(cwd, fs, logger, serialNumber, userName, customerUid, customSiteName) {
|
|
269
269
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
270
270
|
const currentUserId = userName.replaceAll(' ', '_').replace(/[^a-zA-Z0-9-]+/g, '');
|
|
271
271
|
const appName = manifest.name.replaceAll(' ', '_').replace(/[^a-zA-Z0-9-]+/g, '');
|
|
@@ -273,10 +273,15 @@ async function buildDevelopmentInstallInfo(cwd, fs, serialNumber, userName, cust
|
|
|
273
273
|
const useDeviceSerial = hasDlo && serialNumber;
|
|
274
274
|
const siteName = useDeviceSerial ? serialNumber.toUpperCase() : `${appName}_${currentUserId}`;
|
|
275
275
|
const developmentReference = useDeviceSerial ? serialNumber : siteName;
|
|
276
|
+
let realSiteName = customSiteName || siteName;
|
|
277
|
+
if (realSiteName.length > 50) {
|
|
278
|
+
logger.warn(`Site name "${realSiteName}" is too long. Truncating to 50 characters.`);
|
|
279
|
+
realSiteName = realSiteName.substring(0, 50);
|
|
280
|
+
}
|
|
276
281
|
return {
|
|
277
282
|
apmId: generateDevApmId(developmentReference),
|
|
278
283
|
applicationId: null,
|
|
279
|
-
name:
|
|
284
|
+
name: realSiteName,
|
|
280
285
|
version: 1,
|
|
281
286
|
serialNumber: hasDlo ? serialNumber : undefined,
|
|
282
287
|
siteUid: null,
|