@globules-io/ogx.js
Advanced tools
Comparing version 1.8.7-e to 1.8.7-f
@@ -1,54 +0,30 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const copy = require('recursive-copy'); | ||
const src_ogx = path.normalize(__dirname+'/ogx'); | ||
const src_www = path.normalize(__dirname+'/www'); | ||
const src_lib = path.normalize(__dirname+'/www/js/lib'); | ||
const dest_www = path.normalize(__dirname+'./../../../www'); | ||
const src_ogx = path.normalize(__dirname+'/ogx'); | ||
const dest_ogx = path.normalize(__dirname+'./../../../ogx'); | ||
const dest_cli = path.normalize(__dirname+'/cli.json'); | ||
const dest_index = path.normalize(__dirname+'./../../../www/index.html'); | ||
const dest_index_bak = path.normalize(__dirname+'./../../../www/index.bak'); | ||
const dest_app = path.normalize(__dirname+'./../../../www/app.json'); | ||
const dest_app_bak = path.normalize(__dirname+'./../../../www/app.bak'); | ||
let app_exists = fs.existsSync(dest_app); | ||
let index_exists = fs.existsSync(dest_index); | ||
//if index exists, dont overwrite | ||
let overwrite_index = !index_exists; | ||
let remove_index = false; | ||
if(fs.existsSync(dest_cli)){ | ||
let cli_config = fs.readFileSync(dest_cli, 'utf-8'); | ||
if(cli_config.index !== 'index.html'){ | ||
overwrite_index = false; | ||
remove_index = true; | ||
const dest_lib = path.normalize(__dirname+'./../../js/lib'); | ||
//copy ogx folder | ||
copy(src_ogx, dest_ogx, {overwrite:true}); | ||
//if no www, copy the whole folder | ||
if(!fs.existsSync(dest_www)){ | ||
copy(src_www, dest_www); | ||
}else{ | ||
//if www, check if js and js/lib already there | ||
if(!fs.existsSync(dest_lib)){ | ||
copy(src_lib, dest_lib); | ||
}else{ | ||
//copy cryto, globules, howler, jquery, moment, mongogx | ||
let lib_folders = ['cryto', 'globules', 'howler', 'jquery', 'moment', 'mongogx']; | ||
let lib_folders_src; | ||
let lib_folders_dest; | ||
for(let i = 0; i < lib_folders.length; i++){ | ||
lib_folders_src = path.normalize(__dirname+'/www/js/lib/'+lib_folders[i]); | ||
lib_folders_dest = path.normalize(__dirname+'./../../js/lib/'+lib_folders[i]); | ||
copy(lib_folders_src, lib_folders_dest); | ||
} | ||
} | ||
} | ||
console.log('Overwrite index.html?', overwrite_index); | ||
console.log('Remove index.html?', remove_index); | ||
//if we don't overwrite index file, back it up since everything will be overwritten with recursive copy | ||
if(!overwrite_index){ | ||
fs.renameSync(dest_index, dest_index_bak); | ||
console.log('Back up index.html'); | ||
} | ||
if(app_exists){ | ||
fs.renameSync(dest_app, dest_app_bak); | ||
console.log('Back up app.json'); | ||
} | ||
//update/overwrite | ||
copy(src_www, dest_www, {overwrite:true}); | ||
copy(src_ogx, dest_ogx, {overwrite:true}); | ||
//if we didn't overwrite, rename bak | ||
if(!overwrite_index){ | ||
fs.renameSync(dest_index_bak, dest_index); | ||
console.log('Restore index.html'); | ||
} | ||
//If we had a differernt index file, remove index.html | ||
if(remove_index){ | ||
fs.unlinkSync(dest_index); | ||
console.log('Delete index.html'); | ||
} | ||
//If app.json was already there, rename bak | ||
if(app_exists){ | ||
fs.renameSync(dest_app_bak, dest_app); | ||
console.log('Restore app.json'); | ||
} |
{ | ||
"name": "@globules-io/ogx.js", | ||
"version": "1.8.7e", | ||
"version": "1.8.7f", | ||
"description": "Javascript framework for webviews", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
757072
264