Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Char1zardd committed Mar 6, 2022
1 parent 78ccc92 commit 14299ff
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"es2021": true
},
Expand Down
92 changes: 46 additions & 46 deletions AppSchemas.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
exports.newAppSchemas = function () {

let thisObject = {
initialize: initialize
}
let thisObject = {
initialize: initialize
}

return thisObject
return thisObject

async function initialize() {
/*
Here we will load into memory all the APP_SCHEMA files of every project.
*/
async function initialize() {
/*
Here we will load into memory all the APP_SCHEMA files of every project.
*/

await loadAppSchemas()
await loadAppSchemas()

async function loadAppSchemas() {
async function loadAppSchemas() {

return new Promise(loadAppSchemasForAllProjects)
return new Promise(loadAppSchemasForAllProjects)

function loadAppSchemasForAllProjects(resolve, reject) {
function loadAppSchemasForAllProjects(resolve, reject) {

let projectsLoaded = 0
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
let projectDefinition = PROJECTS_SCHEMA[i]
loadAppSchemasForProject(projectDefinition.name)
}
let projectsLoaded = 0
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
let projectDefinition = PROJECTS_SCHEMA[i]
loadAppSchemasForProject(projectDefinition.name)
}

function loadAppSchemasForProject(project) {
function loadAppSchemasForProject(project) {

let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/'
let folder = 'App-Schema'
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/'
let folder = 'App-Schema'

SA.projects.foundations.utilities.filesAndDirectories.getAllFilesInDirectoryAndSubdirectories(filePath + folder, onFilesReady)
SA.projects.foundations.utilities.filesAndDirectories.getAllFilesInDirectoryAndSubdirectories(filePath + folder, onFilesReady)

function onFilesReady(files) {
function onFilesReady(files) {

for (let k = 0; k < files.length; k++) {
let name = files[k]
let nameSplitted = name.split(folder)
let fileName = nameSplitted[1]
for (let i = 0; i < 10; i++) {
fileName = fileName.replace('\\', '/')
}
let fileToRead = filePath + folder + fileName
for (let k = 0; k < files.length; k++) {
let name = files[k]
let nameSplitted = name.split(folder)
let fileName = nameSplitted[1]
for (let i = 0; i < 10; i++) {
fileName = fileName.replace('\\', '/')
}
let fileToRead = filePath + folder + fileName

let fileContent = SA.nodeModules.fs.readFileSync(fileToRead)
let schemaDocument
try {
schemaDocument = JSON.parse(fileContent)
SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.set(project + '-' + schemaDocument.type, schemaDocument)
} catch (err) {
console.log('[WARN] loadAppSchemasForProject -> Error Parsing JSON File: ' + fileToRead + '. Error = ' + err.stack)
return
}
}
projectsLoaded++
let fileContent = SA.nodeModules.fs.readFileSync(fileToRead)
let schemaDocument
try {
schemaDocument = JSON.parse(fileContent)
SA.projects.foundations.globals.schemas.APP_SCHEMA_MAP.set(project + '-' + schemaDocument.type, schemaDocument)
} catch (err) {
console.log('[WARN] loadAppSchemasForProject -> Error Parsing JSON File: ' + fileToRead + '. Error = ' + err.stack)
return
}
}
projectsLoaded++

if (projectsLoaded === PROJECTS_SCHEMA.length) {
resolve()
}
}
}
if (projectsLoaded === PROJECTS_SCHEMA.length) {
resolve()
}
}
}
}
}
}
}
26 changes: 12 additions & 14 deletions Launch-Scripts/runSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const installExternalScripts = () => {
const url = externalScriptsURLs[i]
const filename = url.split('/').pop()
const dest = path.join(externalScriptsDir, filename)
const res = https.get(url, resp => {
https.get(url, resp => {
if (resp.statusCode !== 200) {
console.error(
`Error downloading ${url}: HTTP response code ${response.statusCode}.`
`Error downloading ${url}: HTTP response code ${resp.statusCode}.`
)
return false
} else {
Expand Down Expand Up @@ -78,7 +78,7 @@ const setUpstreamAndOrigin = async (dir, repo='Superalgos') => {
if (repo === 'Superalgos' && origin) {
if (origin.indexOf('@') === -1) {
gitUser = origin.split('/')[3]
useSSH = false
usesSSH = false
} else {
gitUser = origin.split(':')[1].split('/')[0]
usesSSH = true
Expand Down Expand Up @@ -130,20 +130,19 @@ const runSetup = (tfjs=false) => {
// install tensorflow if user ran tensorflow setup file
if (tfjs !== false) {
console.log('Including tensorflow.js in your setup...')
nodeModulesDirs = [
path.join(process.cwd(),
"Projects",
"TensorFlow",
"TS",
"Bot-Modules",
"Learning-Bot",
"Low-Frequency-Learning")
]

path.join(process.cwd(),
"Projects",
"TensorFlow",
"TS",
"Bot-Modules",
"Learning-Bot",
"Low-Frequency-Learning")
}

let dir = process.cwd()
let command = 'echo Results of install at ' + dir + ' & npm ci'
let nodeInstPromise = new Promise(resolve => {
let nodeInstPromise = new Promise(() => {
exec(command,
{
cwd: dir
Expand Down Expand Up @@ -179,7 +178,6 @@ const runSetup = (tfjs=false) => {
// Initialize and update git repositories
// Ensure upstream and origin are set for this repo and submodules

let gitUser
setUpstreamAndOrigin().then(async () => {
Object.values(projectPluginMap).forEach(plugin => {
setUpstreamAndOrigin(plugin.dir, plugin.repo)
Expand Down

0 comments on commit 14299ff

Please sign in to comment.