Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# NetCreate ignored directories
/runtime/netcreate.loki
/runtime/logs
/runtime
# /runtime/netcreate.loki
# /runtime/logs

# Also ignore build system directories
.npmignore
Expand Down
3 changes: 3 additions & 0 deletions build/app/assets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# this is dynamically generated by nc.js
# so it shouldn't be tracked by git
netcreate-config.js
47 changes: 41 additions & 6 deletions build/brunch-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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) => {
Expand Down Expand Up @@ -122,23 +131,49 @@ 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 <detached> branch');
console.log(PR);
console.log(PR,'.. You are running a <detached> 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
EXEC('node --version',(error, stdout,stderr)=>{
if (stdout) {
stdout=stdout.trim();
if (stdout!==NODE_VER) {
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,'NODE VERSION:',stdout,'OK');
}
});
// now start the UNISYS network
UNISYS.RegisterHandlers();
UNISYS.StartNetwork();
// invoke brunch callback
console.log(PR,'brunch-server.js returning control to brunch');
callback();
}).
on('error', function(err) {
Expand Down
87 changes: 47 additions & 40 deletions netcreate-2018.code-workspace
Original file line number Diff line number Diff line change
@@ -1,42 +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
},
}
// 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"
}
}