Skip to content

Commit

Permalink
Updated libraries to latest non-breaking versions, and removed unneed…
Browse files Browse the repository at this point in the history
…ed libraries which have been replaced by simple JS logic

Signed-off-by: 1000TurquoisePogs <[email protected]>
  • Loading branch information
1000TurquoisePogs committed Mar 7, 2024
1 parent 5b6422c commit ee9cfdb
Show file tree
Hide file tree
Showing 9 changed files with 415 additions and 2,802 deletions.
4 changes: 2 additions & 2 deletions lib/swagger-catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Promise = require('bluebird');
const zLuxUrl = require('./url')
const path = require('path');
const fs = require('fs');
const jsyaml = require('js-yaml');
const yaml = require('yaml');
const swaggerParser = require('swagger-parser')
const os = require('os');
const zluxUtil = require('./util');
Expand Down Expand Up @@ -201,7 +201,7 @@ function readSingleSwaggerFile (dirName, serviceName, serviceVersion) {
if (err) {
return reject(err);
}
let swaggerJson = jsyaml.safeLoad(fileContent);
let swaggerJson = yaml.parse(fileContent);
swaggerParser.validate(swaggerJson).then(function(valid) {
return resolve(swaggerJson)
}).catch(function(err) {
Expand Down
10 changes: 4 additions & 6 deletions lib/tomcatManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ unpack the wars ahead of time, so the symbolic links are the unpacked dirs
import { Path, TomcatConfig, TomcatShutdown, TomcatHttps, JavaServerManager, AppServerInfo } from './javaTypes';
import * as fs from 'graceful-fs';
import * as path from 'path';
import * as mkdirp from 'mkdirp';
import * as child_process from 'child_process';
//import * as xml2js from 'xml2js';
import * as yauzl from 'yauzl';
import * as utils from './util';
import * as rimraf from 'rimraf';

const log = utils.loggers.langManager;
const spawn = child_process.spawn;
Expand Down Expand Up @@ -63,7 +61,7 @@ export class TomcatManager implements JavaServerManager {

private makeRoot():Promise<void> {
return new Promise((resolve,reject)=> {
mkdirp(this.appdir, {mode: DIR_WRITE_MODE}, (err)=> {
fs.mkdir(this.appdir, {recursive: true, mode: DIR_WRITE_MODE}, (err)=> {
if (err) {
reject(err);
} else {
Expand Down Expand Up @@ -279,7 +277,7 @@ export class TomcatManager implements JavaServerManager {
log.info(`ZWED0092I`, this.id); //log.info(`Tomcat Manager ID=${this.id} stopping`);
TomcatManager.isWindows ? this.stopForWindows() : this.stopForUnix();
return new Promise((resolve, reject) => {
rimraf(this.appdir, (error)=> {
fs.rm(this.appdir, { recursive: true, force: true }, (error)=> {
if (error) {
reject(error);
} else {
Expand Down Expand Up @@ -368,7 +366,7 @@ export class TomcatManager implements JavaServerManager {
zipfile.on("entry", function(entry) {
if (entry.fileName.endsWith('/')) {
//directory
mkdirp(path.join(destPath,entry.fileName), {mode: DIR_WRITE_MODE}, (err)=> {
fs.mkdir(path.join(destPath,entry.fileName), {recursive: true, mode: DIR_WRITE_MODE}, (err)=> {
if (err) {
error = err;
zipfile.close();
Expand All @@ -380,7 +378,7 @@ export class TomcatManager implements JavaServerManager {
zipfile.readEntry(); //TODO is it correct to skip this?
} else {
//file
mkdirp(path.join(destPath,path.dirname(entry.fileName)), {mode: DIR_WRITE_MODE}, (err)=> {
fs.mkdir(path.join(destPath,path.dirname(entry.fileName)), {recursive: true, mode: DIR_WRITE_MODE}, (err)=> {
if (err) {
error = err;
zipfile.close();
Expand Down
17 changes: 9 additions & 8 deletions lib/translation-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'use strict';
const path = require('path');
const jsonUtils = require('./jsonUtils.js');
const glob = require('glob');
const zluxUtil = require('./util');
const acceptLanguageParser = require('accept-language-parser');

Expand All @@ -31,15 +30,17 @@ const utilLog = zluxUtil.loggers.utilLogger;
*/
function loadTranslations(pluginLocation) {
const translationMaps = {};
const relativePath = 'web/assets/i18n';
const filePrefix = 'pluginDefinition.i18n.';
const fileExt = '.json';
const pattern = path.join(
pluginLocation,
relativePath,
`${filePrefix}*${fileExt}`
);
const files = glob.sync(pattern, {});
const folder = path.join(pluginLocation, 'web/assets/i18n');
const files = fs.readdirSync(folder)
.filter((filename)=> {
return filename.startsWith(filePrefix) && filename.endsWith(fileExt);
})
.map((filename)=> {
return path.join(folder, filename);
});

for (const file of files) {
const basename = path.basename(file);
const languageCountry = basename.substring(
Expand Down
3 changes: 2 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ if (!global.COM_RS_COMMON_LOGGER) {

const path = require('path');
const fs = require('fs');
const util = require('node:util');
const fsPromises = require('node:fs/promises');
const Promise = require('bluebird');
const ipaddr = require('ipaddr.js');
const dns = require('dns');
const dnsLookup = Promise.promisify(dns.lookup);
const dnsLookup = util.promisify(dns.lookup);
const mergeUtils = require('../utils/mergeUtils');
const forge = require('node-forge');

Expand Down
Loading

0 comments on commit ee9cfdb

Please sign in to comment.