Skip to content

Commit

Permalink
Merge pull request #145 from xtremespb/core_300621
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
xtremespb committed Jul 22, 2021
2 parents a0328ad + dedb64d commit 87a0eec
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 279 deletions.
4 changes: 2 additions & 2 deletions dev/bin/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const commandLineArgs = require("command-line-args");
const extract = require("extract-zip");
const {
MongoClient,
ObjectID
ObjectId
} = require("mongodb");
const {
exec
Expand Down Expand Up @@ -305,7 +305,7 @@ try {
const item = rec;
Object.keys(item).map(i => {
if (types[i] === "objectid") {
item[i] = new ObjectID(item[i]);
item[i] = new ObjectId(item[i]);
} else if (types[i] === "date") {
item[i] = new Date(item[i]);
}
Expand Down
5 changes: 5 additions & 0 deletions dev/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
const {
exec
} = require("child_process");
const {
format,
} = require("date-fns");
const commandLineArgs = require("command-line-args");
const fs = require("fs-extra");
const path = require("path");
Expand Down Expand Up @@ -49,6 +52,8 @@ const execCommand = cmd => new Promise((resolve, reject) => {
let exitCode;
const workerProcess = exec(cmd, (error, stdout, stderr) => {
if (exitCode === 0) {
// eslint-disable-next-line no-control-regex
fs.writeFileSync(path.resolve(`${__dirname}/../logs/build_${format(new Date(), "yyyyMMdd_HHmmss")}.log`), stdout.replace(/[^\x00-\x7F]/g, ""));
resolve(stdout);
} else {
// eslint-disable-next-line prefer-promise-reject-errors
Expand Down
23 changes: 20 additions & 3 deletions dev/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,30 @@ const {
v4: uuidv4
} = require("uuid");
const {
execSync
format,
} = require("date-fns");
const {
exec
} = require("child_process");
const minify = require("@node-minify/core");
const htmlMinifier = require("@node-minify/html-minifier");
const packageJson = require("../package.json");

const execCommand = cmd => new Promise((resolve, reject) => {
let exitCode;
const workerProcess = exec(cmd, (error, stdout, stderr) => {
if (exitCode === 0) {
// eslint-disable-next-line no-control-regex
fs.writeFileSync(path.resolve(`${__dirname}/../logs/npm_${format(new Date(), "yyyyMMdd_HHmmss")}.log`), stdout.replace(/[^\x00-\x7F]/g, ""));
resolve(stdout);
} else {
// eslint-disable-next-line prefer-promise-reject-errors
reject(new Error(`${stdout || ""}${stderr || ""}`));
}
});
workerProcess.on("exit", code => exitCode = code);
});

const cleanUpWeb = argv => {
[argv.update ? "build/public/update_" : "build/public/zoia_", "build/scripts"].map(d => {
console.log(`Cleaning up directory: "${d}"`);
Expand Down Expand Up @@ -130,7 +148,6 @@ const generateModulesConfig = (moduleDirs, languages, argv) => {
modules.push(moduleDataCurrent);
if (moduleDataCurrent.admin) {
try {
console.log(moduleDirPath);
const adminConfig = require(path.resolve(`${__dirname}/../${argv.update ? "update" : "src"}/modules/${moduleDirPath}/admin.json`));
const trans = {};
languages.map(language => {
Expand Down Expand Up @@ -221,7 +238,7 @@ const installRequiredPackages = async (moduleDirs, argv) => {
if (cmd && cmd.length) {
try {
console.log(`Installing NPM packages for module "${dir}"...`);
execSync(`npm i ${cmd} --loglevel=error`);
await execCommand(`npm i ${cmd} --loglevel=error`);
} catch (e) {
console.error(e);
process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion package-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"sass-loader": "^12.1.0",
"semantic-release": "^17.4.4",
"svg-url-loader": "^7.1.1",
"webpack": "^5.45.1",
"webpack": "^5.46.0",
"webpack-cli": "^4.7.2",
"webpack-fix-style-only-entries": "^0.6.1",
"webpack-sources": "^2.3.1"
Expand Down
Loading

0 comments on commit 87a0eec

Please sign in to comment.