@uniorg/localneo
Advanced tools
Comparing version 1.7.1 to 1.7.2
{ | ||
"name": "@uniorg/localneo", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"author": "m.schmale@uniorg.de", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -99,7 +99,3 @@ const fs = require('fs') | ||
if (!reg.has(`srv:${targetInfo.name}@${targetInfo.entryPath}`)) { | ||
reg.put(`srv:${targetInfo.name}@${targetInfo.entryPath}`, ServiceFactory.create(targetInfo, targetPath, serviceConfig)) | ||
} | ||
return reg.get(`srv:${targetInfo.name}@${targetInfo.entryPath}`) | ||
return ServiceFactory.create(targetInfo, targetPath, serviceConfig) | ||
} | ||
@@ -168,5 +164,6 @@ } | ||
if (fs.existsSync(fullDir + '/destinations.json')) { | ||
dest = require(fullDir + '/destinations.json') | ||
dest = JSON.parse(fs.readFileSync(fullDir + '/destinations.json')) | ||
} | ||
return new MapReader(require(fullDir + '/neo-app.json'), dest, fullDir) | ||
const neoApp = fs.readFileSync(fullDir + '/neo-app.json') | ||
return new MapReader(JSON.parse(neoApp), dest, fullDir) | ||
} catch (err) { | ||
@@ -173,0 +170,0 @@ console.error(`Error while reading application files from "${fullDir}": ${err.message}`) |
@@ -20,2 +20,7 @@ let instance | ||
clear () { | ||
this.cache = {} | ||
return this | ||
} | ||
has (key) { | ||
@@ -22,0 +27,0 @@ return this.cache[key] !== undefined |
@@ -20,4 +20,7 @@ const Router = require('../Router') | ||
} | ||
if (remotePath.startsWith('/')) { | ||
prefix = prefix.replace(/\/+$/, '') | ||
} | ||
console.log('Serving UI5 from %s', prefix) | ||
console.log('Serving UI5 from %s%s', prefix, localPath) | ||
this.proxy = proxy.createProxyServer({ | ||
@@ -24,0 +27,0 @@ target: prefix + remotePath, |
@@ -9,2 +9,3 @@ const test = require('tape') | ||
const MapReader = require('../src/MapReader') | ||
const AppRegistry = require('../src/Registry') | ||
@@ -43,2 +44,3 @@ function buildMockServer (prepare, config) { | ||
process.chdir(oldWd) | ||
AppRegistry.getInstance().clear() | ||
} | ||
@@ -208,1 +210,150 @@ | ||
}) | ||
test('service loads openui5', function (t) { | ||
t.plan(1) | ||
buildMockServer( | ||
() => { }, | ||
{ | ||
neoApp: { | ||
routes: [ | ||
{ | ||
path: '/resources', | ||
target: { | ||
type: 'service', | ||
name: 'sapui5', | ||
entryPath: '/resources' | ||
} | ||
} | ||
] | ||
}, | ||
destinations: { | ||
service: { | ||
sapui5: {} | ||
} | ||
} | ||
} | ||
).then(({url, cleanup}) => { | ||
const fileUrl = `${url}/resources/sap-ui-version.json` | ||
got(fileUrl) | ||
.then(response => { | ||
cleanup() | ||
const json = JSON.parse(response.body) | ||
t.equal(json.name, 'OpenUI5 Distribution') | ||
}) | ||
.catch(err => { | ||
cleanup() | ||
console.error(err) | ||
t.ok(false) | ||
}) | ||
}) | ||
}) | ||
test('service loads sapui5 when requested to do so', function (t) { | ||
t.plan(1) | ||
buildMockServer( | ||
() => { }, | ||
{ | ||
neoApp: { | ||
routes: [ | ||
{ | ||
path: '/resources', | ||
target: { | ||
type: 'service', | ||
name: 'sapui5', | ||
entryPath: '/resources' | ||
} | ||
} | ||
] | ||
}, | ||
destinations: { | ||
service: { | ||
sapui5: { | ||
useSAPUI5: true | ||
} | ||
} | ||
} | ||
} | ||
).then(({url, cleanup}) => { | ||
const fileUrl = `${url}/resources/sap-ui-version.json` | ||
got(fileUrl) | ||
.then(response => { | ||
cleanup() | ||
const json = JSON.parse(response.body) | ||
t.equal(json.name, 'SAPUI5 Distribution') | ||
}) | ||
.catch(err => { | ||
cleanup() | ||
console.error(err) | ||
t.ok(false) | ||
}) | ||
}) | ||
}) | ||
test('service loads sapui5 when requested to do so', function (t) { | ||
t.plan(1) | ||
buildMockServer( | ||
() => { | ||
fs.mkdirSync('./app') | ||
fs.writeFileSync('./app/neo-app.json', JSON.stringify({ | ||
routes: [{ | ||
'path': '/resources', | ||
'target': { | ||
'type': 'service', | ||
'name': 'sapui5', | ||
'entryPath': '/resources' | ||
}, | ||
'description': 'SAPUI5 Resources' | ||
}] | ||
})) | ||
}, | ||
{ | ||
neoApp: { | ||
routes: [ | ||
{ | ||
path: '/app', | ||
target: { | ||
type: 'application', | ||
name: 'app' | ||
} | ||
}, | ||
{ | ||
path: '/resources', | ||
target: { | ||
type: 'service', | ||
name: 'sapui5', | ||
entryPath: '/resources' | ||
} | ||
} | ||
] | ||
}, | ||
destinations: { | ||
applications: { | ||
app: { | ||
path: './app' | ||
} | ||
}, | ||
service: { | ||
sapui5: { | ||
useSAPUI5: true | ||
} | ||
} | ||
} | ||
} | ||
).then(({url, cleanup}) => { | ||
const fileUrl = `${url}/resources/sap-ui-version.json` | ||
got(fileUrl) | ||
.then(response => { | ||
const json = JSON.parse(response.body) | ||
t.equal(json.name, 'SAPUI5 Distribution') | ||
cleanup() | ||
}) | ||
.catch(err => { | ||
cleanup() | ||
console.error(err) | ||
t.ok(false) | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
24218
799
3