Skip to content

Commit 3d45eac

Browse files
authored
Merge pull request #297 from microsoft/user/ticastro/fix-build-lockfile
Re-add lock file, fix build breaks
2 parents c531eab + b23aab5 commit 3d45eac

File tree

6 files changed

+11064
-33
lines changed

6 files changed

+11064
-33
lines changed

Tools/WinMLDashboard/.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
.env.test.local
2323
.env.production.local
2424

25-
# vscode
25+
# vscode
2626
.vscode/*
2727

2828
# generated static files
2929
public/*
3030
!public/favicon.ico
31-
!public/index.html
31+
!public/index.html
3232
!public/manifest.json
3333
!public/winml_icon.ico
3434
!public/about.html
@@ -49,5 +49,3 @@ public/*
4949
npm-debug.log*
5050
yarn-debug.log*
5151
yarn-error.log*
52-
yarn.lock
53-
package-lock.json

Tools/WinMLDashboard/deps/copy_netron.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,16 @@ def main():
8383
if rebuild_needed(static_scripts, bundle_destination):
8484
import tempfile
8585
with tempfile.NamedTemporaryFile() as f:
86-
f.write(bundle_scripts(static_scripts))
87-
minify(f.name, bundle_destination)
86+
bundled_scripts = bundle_scripts(static_scripts)
87+
f.write(bundled_scripts)
88+
try:
89+
minify(f.name, bundle_destination)
90+
except:
91+
import traceback
92+
traceback.print_exc()
93+
print('Minifying Netron failed! A non-minified build will be done instead')
94+
with open(bundle_destination, 'wb') as f:
95+
f.write(bundled_scripts)
8896
else:
8997
print('Bundle is already up to date')
9098

Tools/WinMLDashboard/package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,42 +33,42 @@
3333
},
3434
"dependencies": {
3535
"@types/ncp": "^2.0.1",
36-
"electron-log": "^2.2.17",
36+
"electron-log": "^4.0.7",
3737
"electron-squirrel-startup": "^1.0.0"
3838
},
3939
"devDependencies": {
40-
"@types/fs-extra": "^5.0.4",
41-
"@types/jest": "^23.3.0",
40+
"@types/fs-extra": "^8.1.0",
41+
"@types/jest": "^25.1.3",
4242
"@types/md5": "^2.1.33",
4343
"@types/node": "^10.5.3",
4444
"@types/prop-types": "^15.5.4",
4545
"@types/react": "^16.4.7",
4646
"@types/react-dom": "^16.0.6",
47-
"@types/react-redux": "^6.0.11",
48-
"@types/react-select": "^2.0.6",
49-
"@types/webdriverio": "^4.13.0",
47+
"@types/react-redux": "^7.1.7",
48+
"@types/react-select": "^3.0.10",
49+
"@types/webdriverio": "^5.0.0",
5050
"@types/yauzl": "^2.9.0",
5151
"ajv": "^6.5.2",
52-
"babel-minify": "^0.4.3",
52+
"babel-minify": "^0.5.1",
5353
"chai": "^4.2.0",
5454
"chai-as-promised": "^7.1.1",
5555
"electron": "^3.0.11",
56-
"electron-winstaller": "^2.7.0",
57-
"fs-extra": "^7.0.1",
56+
"electron-winstaller": "^4.0.0",
57+
"fs-extra": "^8.1.0",
5858
"md5": "^2.2.1",
59-
"mocha": "^5.2.0",
59+
"mocha": "^7.1.0",
6060
"ncp": "^2.0.0",
6161
"npm-font-open-sans": "^1.1.0",
6262
"office-ui-fabric-react": "^6.40.0",
6363
"react": "^16.5.2",
64-
"react-app-rewired": "^1.5.2",
64+
"react-app-rewired": "^2.1.5",
6565
"react-dom": "^16.4.1",
66-
"react-markdown": "^3.4.1",
67-
"react-redux": "^5.0.7",
68-
"react-scripts-ts": "^2.16.0",
69-
"react-select": "^2.1.1",
66+
"react-markdown": "^4.3.1",
67+
"react-redux": "^7.2.0",
68+
"react-scripts-ts": "^3.1.0",
69+
"react-select": "^3.0.8",
7070
"redux": "^4.0.0",
71-
"spectron": "^5.0.0",
71+
"spectron": "^10.0.1",
7272
"typescript": "^3.2.2",
7373
"yauzl": "^2.10.0"
7474
}

Tools/WinMLDashboard/src/components/KeyValueEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class KeyValueEditor extends React.Component<IComponentProperties, IComponentSta
156156
}
157157

158158
private copyRenameKey = (obj: any, oldKey: string, newKey: string) => {
159-
return Object.entries(obj).reduce((acc: any[], keyValue: [string, string]) => {
159+
return Object.entries(obj).reduce((previousValue: any, keyValue: [string, string], currentIndex: number, acc: any[]) => {
160160
const [key, value] = keyValue;
161161
acc[key === oldKey ? newKey : key] = value;
162162
return acc;

Tools/WinMLDashboard/src/view/run/View.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
171171
<div className='ArgumentsControl'>
172172
{this.getArgumentsView()}
173173
</div>
174-
<DefaultButton id='RunButton' text='Run'
175-
disabled={!this.state.model || (this.state.capture === Capture.Debug && !(this.state.inputPath && this.state.outputPath))}
174+
<DefaultButton id='RunButton' text='Run'
175+
disabled={!this.state.model || (this.state.capture === Capture.Debug && !(this.state.inputPath && this.state.outputPath))}
176176
onClick={this.execModelRunner}/>
177177
</div>
178178
)
@@ -322,9 +322,13 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
322322
});
323323
}
324324

325-
private logError = (error: string | Error) => {
326-
const message = typeof error === 'string' ? error : (`${error.stack ? `${error.stack}: ` : ''}${error.message}`);
327-
log.error(message)
325+
private logError = (error: string | Error | Error[]) => {
326+
const toString = (error: string | Error) => typeof error === 'string' ? error : (`${error.stack ? `${error.stack}: ` : ''}${error.message}`);
327+
if (Array.isArray(error)) {
328+
log.error(error.map(toString).join('\n'));
329+
} else {
330+
log.error(toString(error));
331+
}
328332
}
329333

330334
private printMessage = (message: string) => {
@@ -351,7 +355,7 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
351355
save(ModelProtoSingleton.serialize(true), this.getDebugModelPath());
352356
runPath = debugRunnerPath;
353357
procParameters = [this.getDebugModelPath(), this.state.inputPath];
354-
}
358+
}
355359

356360
this.setState({
357361
console: '',
@@ -367,7 +371,7 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
367371
this.logError(e);
368372
this.printMessage("\n---------------------------\nRun Failed!\n")
369373
this.printMessage(`\n${(e as Error).message}`)
370-
374+
371375
log.info(this.state.model + " is failed to run");
372376
this.setState({
373377
currentStep: Step.Idle,
@@ -393,7 +397,7 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
393397
ncp.ncp(ModelProtoSingleton.getCurrentModelDebugDir(), filename, this.copyCallbackFunction);
394398
}
395399

396-
private copyCallbackFunction = (err: Error) => {
400+
private copyCallbackFunction = (err: Error[] | null) => {
397401
const runDialogOptions = {
398402
message: '',
399403
title: 'run result',
@@ -402,7 +406,6 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
402406
this.logError(err);
403407
runDialogOptions.message = 'Run failed! See console log for details.'
404408
require('electron').remote.dialog.showMessageBox(require('electron').remote.getCurrentWindow(), runDialogOptions)
405-
406409
} else {
407410
runDialogOptions.message = 'Run Successful: Debug capture saved to output path'
408411
require('electron').remote.dialog.showMessageBox(require('electron').remote.getCurrentWindow(), runDialogOptions)
@@ -422,4 +425,4 @@ const mapDispatchToProps = {
422425
setFile,
423426
}
424427

425-
export default connect(mapStateToProps, mapDispatchToProps)(RunView);
428+
export default connect(mapStateToProps, mapDispatchToProps)(RunView);

0 commit comments

Comments
 (0)