Comparing version 0.0.8 to 0.0.9
20
api.js
@@ -7,4 +7,4 @@ const express = require('express'); | ||
const appRoot = pkgDir.sync(__dirname); | ||
console.log(appRoot); | ||
const appRoot = require('app-root-path').toString() + "/../.."; | ||
console.log({appRoot}); | ||
@@ -16,4 +16,4 @@ const app = express(); | ||
let config = {}; | ||
if (fs.existsSync('./webdash.json')) { | ||
config = require('./webdash.json'); | ||
if (fs.existsSync(`${appRoot}/webdash.json`)) { | ||
config = require(`${appRoot}/webdash.json`); | ||
} | ||
@@ -23,12 +23,10 @@ return config; | ||
app.locals.appRoot = appRoot; | ||
const bowerJson = require(`${appRoot}/bower.json`); | ||
const bowerJson = require('./bower.json'); | ||
const plugins = getPlugins(bowerJson); | ||
for (const plugin of plugins) { | ||
const pluginSrc = require(`./bower_components/${plugin}/api.js`); | ||
const pluginSrc = require(`${appRoot}/bower_components/${plugin}/api.js`); | ||
if (!pluginSrc.routes) { | ||
@@ -53,3 +51,3 @@ continue; | ||
app.get('/api/webdash/info', (req, res) => { | ||
const packageJson = require('./package.json'); | ||
const packageJson = require(`${appRoot}/package.json`); | ||
const appName = packageJson.name; | ||
@@ -62,4 +60,4 @@ | ||
let config = {}; | ||
if (fs.existsSync('./webdash.json')){ | ||
config = require('./webdash.json'); | ||
if (fs.existsSync(`${appRoot}/webdash.json`)){ | ||
config = require(`${appRoot}/webdash.json`); | ||
} | ||
@@ -66,0 +64,0 @@ |
{ | ||
"name": "webdash", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "scripts": { |
const fs = require('fs'); | ||
const pkgDir = require('pkg-dir'); | ||
const appRoot = require('app-root-path').toString() | ||
const { COPYFILE_EXCL } = fs.constants; | ||
const appRoot = pkgDir.sync(__dirname); | ||
fs.copyFile(`${__dirname}/webdash-config.json`, `${appRoot}/webdash.json`, COPYFILE_EXCL, (err) => { | ||
@@ -8,0 +6,0 @@ if (err) { |
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
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
169653
318
8