From 3039aef8c8d98e52ebf1083b35aa692896d62230 Mon Sep 17 00:00:00 2001 From: DSri Seah Date: Thu, 1 Jun 2023 15:09:48 -0400 Subject: [PATCH 1/5] dev-ds: add arch X86_64 default to VSC integrated terminal settings --- netcreate-2018.code-workspace | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netcreate-2018.code-workspace b/netcreate-2018.code-workspace index 4723f1e3..a8d9c60e 100644 --- a/netcreate-2018.code-workspace +++ b/netcreate-2018.code-workspace @@ -38,5 +38,12 @@ "editor.insertSpaces": true, "editor.tabSize": 2 }, + "terminal.integrated.profiles.osx": { + "x86 zsh": { + "path": "/usr/bin/arch", + "args": ["-arch", "x86_64"] + } + }, + "terminal.integrated.defaultProfile.osx": "x86 zsh" } } \ No newline at end of file From 5a50ab4abed3d8e067e5a4d4585b1db46d1580e0 Mon Sep 17 00:00:00 2001 From: DSri Seah Date: Thu, 1 Jun 2023 15:16:12 -0400 Subject: [PATCH 2/5] dev-ds: reformat to 2-space indent, also add missing 'zsh' argument --- netcreate-2018.code-workspace | 94 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/netcreate-2018.code-workspace b/netcreate-2018.code-workspace index a8d9c60e..8a7731dc 100644 --- a/netcreate-2018.code-workspace +++ b/netcreate-2018.code-workspace @@ -1,49 +1,49 @@ { - // enable whitespace rendering by default - "folders": [ - { - "path": "." - } - ], - "settings": { - // configure glob patterns for excluding files and folders. - "files.exclude": { - "**/.git": true, - "**/.svn": true, - "**/.hg": true, - "**/CVS": true, - "**/.DS_Store": true, - "**/public": true, - "**/node_modules": true, - "**/bower_components": true, - "*.sublime-*": true - }, - // make errors more obvious, de-emphasize warnings - "workbench.colorCustomizations": { - "editorError.border": "#ff0000" - }, - // other theme overrides - "editor.tokenColorCustomizations": { - }, - // langauge specific overrides - "[javascript]" : { - "editor.renderWhitespace": "all", - "editor.detectIndentation": false, - "editor.insertSpaces": true, - "editor.tabSize": 2 - }, - "[javascriptreact]" :{ - "editor.renderWhitespace": "all", - "editor.detectIndentation": false, - "editor.insertSpaces": true, - "editor.tabSize": 2 - }, - "terminal.integrated.profiles.osx": { - "x86 zsh": { - "path": "/usr/bin/arch", - "args": ["-arch", "x86_64"] - } - }, - "terminal.integrated.defaultProfile.osx": "x86 zsh" - } + // enable whitespace rendering by default + "folders": [ + { + "path": "." + } + ], + "settings": { + // configure glob patterns for excluding files and folders. + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/public": true, + "**/node_modules": true, + "**/bower_components": true, + "*.sublime-*": true + }, + // make errors more obvious, de-emphasize warnings + "workbench.colorCustomizations": { + "editorError.border": "#ff0000" + }, + // other theme overrides + "editor.tokenColorCustomizations": { + }, + // langauge specific overrides + "[javascript]" : { + "editor.renderWhitespace": "all", + "editor.detectIndentation": false, + "editor.insertSpaces": true, + "editor.tabSize": 2 + }, + "[javascriptreact]" :{ + "editor.renderWhitespace": "all", + "editor.detectIndentation": false, + "editor.insertSpaces": true, + "editor.tabSize": 2 + }, + "terminal.integrated.profiles.osx": { + "x86 zsh": { + "path": "/usr/bin/arch", + "args": ["-arch", "x86_64", "/bin/zsh"] + } + }, + "terminal.integrated.defaultProfile.osx": "x86 zsh" + } } \ No newline at end of file From f3a275b3cf1aa6488fb0641609c2fa9c14c031c6 Mon Sep 17 00:00:00 2001 From: DSri Seah Date: Fri, 2 Jun 2023 06:43:40 -0400 Subject: [PATCH 3/5] dev-ds: add NODE VERSION CHECK to brunch-server.js --- build/brunch-server.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/build/brunch-server.js b/build/brunch-server.js index c849fb1f..97f01dc9 100644 --- a/build/brunch-server.js +++ b/build/brunch-server.js @@ -10,6 +10,7 @@ const COMPRESS = require('compression'); const EXPRESS = require('express'); const COOKIEP = require('cookie-parser'); +const FS = require('fs'); const APP = EXPRESS(); const UNISYS = require('./app/unisys/server'); const PATH = require('path'); @@ -26,6 +27,14 @@ var UKEY_IDX = 0; const USRV_START = new Date(Date.now()).toISOString(); const NC_CONFIG = require("./app/assets/netcreate-config"); +let NODE_VER; +try { + NODE_VER = FS.readFileSync('./.nvmrc', 'utf8').trim(); +} catch (err) { + console.error('could not read .nvmrc',err); + throw Error(`Could not read .nvmrc ${err}`); +} + /// BRUNCH CUSTOM SERVER START FUNCTION /////////////////////////////////////// /// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - module.exports = (config, callback) => { @@ -135,6 +144,22 @@ module.exports = (config, callback) => { console.log(PR); } }); + // check nvm version + EXEC('node --version',(error, stdout,stderr)=>{ + if (stdout) { + stdout=stdout.trim(); + if (stdout!==NODE_VER) { + console.log(PR); + console.log(PR,'*** NODE VERSION MISMATCH ***'); + console.log(PR,'expected',NODE_VER, 'got', stdout); + console.log(PR,'did you remember to run nvm use?'); + // eslint-disable-next-line no-process-exit + process.exit(100); + } + console.log(PR); + console.log(PR,'NODE VERSION:',stdout,'OK'); + } + }); // now start the UNISYS network UNISYS.RegisterHandlers(); UNISYS.StartNetwork(); From 7338ff30421a2579d7f262d6453df47c7e6bd506 Mon Sep 17 00:00:00 2001 From: DSri Seah Date: Fri, 2 Jun 2023 15:58:56 -0400 Subject: [PATCH 4/5] dev-ds: add architecture check and prompting --- build/brunch-server.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/build/brunch-server.js b/build/brunch-server.js index 97f01dc9..bbe05a9d 100644 --- a/build/brunch-server.js +++ b/build/brunch-server.js @@ -131,17 +131,28 @@ module.exports = (config, callback) => { EXEC('git symbolic-ref --short -q HEAD',(error,stdout,stderr) => { if (error) { // console.error(BP,'git symbolic-ref query error',error); - console.log(PR); console.log(PR,'GIT STATUS:'); - console.log(PR,'You are running a branch'); - console.log(PR); + console.log(PR,'.. You are running a branch'); } if (stdout) { stdout = stdout.trim(); - console.log(PR); console.log(PR,'GIT STATUS:'); - console.log(PR,'You are running the "'+stdout+'" branch'); - console.log(PR); + console.log(PR,'.. You are running the "'+stdout+'" branch'); + } + }); + // check architecture + EXEC('arch',(error, stdout,stderr)=>{ + if (stdout) { + stdout=stdout.trim(); + if (stdout!=='i386') { + console.log(PR,`ARCHITECTURE: ${stdout}`); + console.log(PR,'.. Expected i386, operation may be unstable'); + console.log(PR,'.. For arm64 on mac, consider using Rosetta-compatible shell by running'); + console.log(PR,`.. 'arch x86_64 /bin/zsh'`); + + } else { + console.log(PR,`ARCHITECTURE: ${stdout}`); + } } }); // check nvm version @@ -149,14 +160,12 @@ module.exports = (config, callback) => { if (stdout) { stdout=stdout.trim(); if (stdout!==NODE_VER) { - console.log(PR); console.log(PR,'*** NODE VERSION MISMATCH ***'); - console.log(PR,'expected',NODE_VER, 'got', stdout); - console.log(PR,'did you remember to run nvm use?'); + console.log(PR,'.. expected',NODE_VER, 'got', stdout); + console.log(PR,'.. did you remember to run nvm use?'); // eslint-disable-next-line no-process-exit process.exit(100); } - console.log(PR); console.log(PR,'NODE VERSION:',stdout,'OK'); } }); From ecff732529966b2bf23496b0aca4a1e4c483b20d Mon Sep 17 00:00:00 2001 From: DSri Seah Date: Fri, 9 Jun 2023 15:54:57 -0400 Subject: [PATCH 5/5] dev-ds/build-system-fixes: gitignore additional generated files --- build/.gitignore | 5 +++-- build/app/assets/.gitignore | 3 +++ build/brunch-server.js | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 build/app/assets/.gitignore diff --git a/build/.gitignore b/build/.gitignore index c20be3bc..96544f41 100644 --- a/build/.gitignore +++ b/build/.gitignore @@ -1,6 +1,7 @@ # NetCreate ignored directories -/runtime/netcreate.loki -/runtime/logs +/runtime +# /runtime/netcreate.loki +# /runtime/logs # Also ignore build system directories .npmignore diff --git a/build/app/assets/.gitignore b/build/app/assets/.gitignore new file mode 100644 index 00000000..e3388542 --- /dev/null +++ b/build/app/assets/.gitignore @@ -0,0 +1,3 @@ +# this is dynamically generated by nc.js +# so it shouldn't be tracked by git +netcreate-config.js \ No newline at end of file diff --git a/build/brunch-server.js b/build/brunch-server.js index bbe05a9d..57520ff8 100644 --- a/build/brunch-server.js +++ b/build/brunch-server.js @@ -173,6 +173,7 @@ module.exports = (config, callback) => { UNISYS.RegisterHandlers(); UNISYS.StartNetwork(); // invoke brunch callback + console.log(PR,'brunch-server.js returning control to brunch'); callback(); }). on('error', function(err) {