@nordicsemiconductor/pc-nrfconnect-shared 92.0.0 → 94.0.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.
@@ -3299,6 +3299,7 @@ input[type=button].btn-block {
3299
3299
  display: block;
3300
3300
  min-height: 1.2500000004rem;
3301
3301
  padding-left: 1.5rem;
3302
+ -webkit-print-color-adjust: exact;
3302
3303
  print-color-adjust: exact;
3303
3304
  }
3304
3305
  .custom-control-inline {
@@ -18,6 +18,7 @@ import {
18
18
  LogMessage,
19
19
  ModuleVersion,
20
20
  NrfutilJson,
21
+ NrfutilProgress,
21
22
  Progress,
22
23
  Task,
23
24
  TaskBegin,
@@ -79,7 +80,10 @@ const commonParser = <Result>(
79
80
  const processItem = (item: NrfutilJson<Result>) => {
80
81
  switch (item.type) {
81
82
  case 'task_progress':
82
- callbacks.onProgress?.(item.data.progress, item.data.task);
83
+ callbacks.onProgress?.(
84
+ convertNrfutilProgress(item.data.progress),
85
+ item.data.task
86
+ );
83
87
  break;
84
88
  case 'task_begin':
85
89
  callbacks.onTaskBegin?.(item.data);
@@ -492,13 +496,32 @@ export default async (
492
496
  version ?? (moduleVersions?.[0] as string)
493
497
  );
494
498
 
495
- onProgress?.({ progressPercentage: 0 });
499
+ onProgress?.(convertNrfutilProgress({ progressPercentage: 0 }));
496
500
  const result = await sandbox.isSandboxInstalled();
497
501
 
498
502
  if (!result) {
499
503
  await sandbox.prepareSandbox(onProgress);
500
504
  }
501
505
 
502
- onProgress?.({ progressPercentage: 100 });
506
+ onProgress?.(convertNrfutilProgress({ progressPercentage: 100 }));
503
507
  return sandbox;
504
508
  };
509
+
510
+ const convertNrfutilProgress = (progress: NrfutilProgress): Progress => {
511
+ const amountOfSteps = progress.amountOfSteps ?? 1;
512
+ const step = progress.step ?? 1;
513
+
514
+ const singleStepWeight = (1 / amountOfSteps) * 100;
515
+
516
+ const totalProgressPercentage =
517
+ singleStepWeight * (step - 1) +
518
+ progress.progressPercentage / amountOfSteps;
519
+
520
+ return {
521
+ ...progress,
522
+ stepProgressPercentage: progress.progressPercentage,
523
+ totalProgressPercentage,
524
+ amountOfSteps,
525
+ step,
526
+ };
527
+ };
@@ -44,9 +44,22 @@ export type TaskEnd<T = void> = {
44
44
  data?: T;
45
45
  };
46
46
 
47
+ export type NrfutilProgress = {
48
+ progressPercentage: number;
49
+ message?: string;
50
+ description?: string;
51
+ amountOfSteps?: number;
52
+ duration?: number;
53
+ name?: string;
54
+ operation?: string;
55
+ result?: string;
56
+ state?: string;
57
+ step?: number;
58
+ };
59
+
47
60
  export type TaskProgress = {
48
61
  task: Task;
49
- progress: Progress;
62
+ progress: NrfutilProgress;
50
63
  };
51
64
 
52
65
  type NrfutilJsonProgress = {
@@ -96,16 +109,17 @@ export type NrfutilJson<T = unknown> =
96
109
  | NrfutilJsonBatchUpdate<T>;
97
110
 
98
111
  export type Progress = {
99
- progressPercentage: number;
112
+ totalProgressPercentage: number;
113
+ stepProgressPercentage: number;
100
114
  message?: string;
101
115
  description?: string;
102
- amountOfSteps?: number;
116
+ amountOfSteps: number;
103
117
  duration?: number;
104
118
  name?: string;
105
119
  operation?: string;
106
120
  result?: string;
107
121
  state?: string;
108
- step?: number;
122
+ step: number;
109
123
  };
110
124
 
111
125
  export type LogMessage = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "92.0.0",
3
+ "version": "94.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,17 +40,15 @@
40
40
  "@swc/core": "1.3.56",
41
41
  "@swc/jest": "0.2.24",
42
42
  "@testing-library/jest-dom": "5.16.5",
43
- "@testing-library/react": "10.4.9",
43
+ "@testing-library/react": "^14.0.0",
44
44
  "@types/adm-zip": "^0.5.0",
45
45
  "@types/date-fns": "^2.6.0",
46
- "@types/enzyme": "3.10.12",
47
- "@types/enzyme-adapter-react-16": "1.0.6",
48
46
  "@types/ftp": "0.3.33",
49
47
  "@types/klaw": "3.0.3",
50
48
  "@types/lodash.range": "3.2.7",
51
49
  "@types/mousetrap": "1.6.11",
52
50
  "@types/react": "17.0.55",
53
- "@types/react-dom": "17.0.19",
51
+ "@types/react-dom": "18.2.6",
54
52
  "@types/react-redux": "7.1.25",
55
53
  "@types/semver": "7.3.13",
56
54
  "@types/shasum": "1.0.0",
@@ -65,11 +63,8 @@
65
63
  "date-fns": "2.29.3",
66
64
  "electron": "22.3.5",
67
65
  "electron-store": "8.1.0",
68
- "enzyme": "3.11.0",
69
- "enzyme-adapter-react-16": "1.15.7",
70
- "enzyme-to-json": "3.6.2",
71
- "esbuild": "0.17.18",
72
- "esbuild-sass-plugin": "2.9.0",
66
+ "esbuild": "0.19.2",
67
+ "esbuild-sass-plugin": "2.13.0",
73
68
  "esbuild-style-plugin": "1.6.2",
74
69
  "eslint": "8.37.0",
75
70
  "eslint-config-airbnb": "19.0.4",
@@ -101,14 +96,14 @@
101
96
  "prettier-plugin-tailwindcss": "^0.3.0",
102
97
  "prettysize": "2.0.0",
103
98
  "protobufjs": "^7.0.0",
104
- "react": "16.14.0",
99
+ "react": "18.2.0",
105
100
  "react-bootstrap": "1.6.6",
106
- "react-dom": "16.14.0",
101
+ "react-dom": "18.2.0",
107
102
  "react-flip-toolkit": "7.0.17",
108
- "react-markdown": "4.3.1",
103
+ "react-markdown": "8.0.7",
109
104
  "react-redux": "7.2.9",
110
- "react-resize-detector": "6.7.8",
111
- "react-test-renderer": "16.14.0",
105
+ "react-resize-detector": "9.1.0",
106
+ "react-test-renderer": "18.2.0",
112
107
  "redux": "4.2.1",
113
108
  "redux-devtools-extension": "2.13.9",
114
109
  "redux-thunk": "2.4.2",