Commit 964231cd authored by rockyl's avatar rockyl

打包删除多余数据

parent aa460ade
......@@ -235,18 +235,20 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
let newData = {};
newData.options = data.options;
delete newData.options.tpl;
newData.views = data.views;
newData.assets = data.assets;
newData.dataMapping = data.dataMapping;
newData.processes = data.processes;
delete newData.options.tpl;
deleteUnusedData(newData.processes);
console.log(TAG, 'start');
/*=====START process =====*/
console.log(TAG, 'start process');
let processIDs = [];
findDepPidsBat(processIDs, data.processes);
findDepPidsBat(processIDs, newData.processes);
let builtinProcesses = newData.builtinProcesses = [];
let bProcessIDs = processIDs;
......@@ -264,7 +266,7 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
}
}
for (let process of data.processes) {
for (let process of newData.processes) {
processManager.deal(process);
}
......@@ -343,6 +345,25 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
};
}
const unusedFields = ['design'];
function deleteUnusedData(processes){
for(let process of processes){
if(process.sub){
for(let uuid in process.sub){
let subProcess = process.sub[uuid];
for(let field of unusedFields){
if(subProcess.hasOwnProperty(field)){
delete subProcess[field];
}
}
}
}
if(process.metas && process.metas.length > 0){
deleteUnusedData(process.metas);
}
}
}
function findDepPids(list, process) {
if (process.sub) {
for (let key in process.sub) {
......@@ -369,7 +390,6 @@ async function addBuiltinProcesses(list, ids, getProcesses) {
list.push(process);
findDepPids(newPids, process);
}
//console.log('processes:', data.processes);
}
return newPids;
}
......
This diff is collapsed.
......@@ -241,18 +241,20 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
let newData = {};
newData.options = data.options;
delete newData.options.tpl;
newData.views = data.views;
newData.assets = data.assets;
newData.dataMapping = data.dataMapping;
newData.processes = data.processes;
delete newData.options.tpl;
deleteUnusedData(newData.processes);
console.log(TAG, 'start');
/*=====START process =====*/
console.log(TAG, 'start process');
let processIDs = [];
findDepPidsBat(processIDs, data.processes);
findDepPidsBat(processIDs, newData.processes);
let builtinProcesses = newData.builtinProcesses = [];
let bProcessIDs = processIDs;
......@@ -270,7 +272,7 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
}
}
for (let process of data.processes) {
for (let process of newData.processes) {
processManager.deal(process);
}
......@@ -349,6 +351,25 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
};
}
const unusedFields = ['design'];
function deleteUnusedData(processes){
for(let process of processes){
if(process.sub){
for(let uuid in process.sub){
let subProcess = process.sub[uuid];
for(let field of unusedFields){
if(subProcess.hasOwnProperty(field)){
delete subProcess[field];
}
}
}
}
if(process.metas && process.metas.length > 0){
deleteUnusedData(process.metas);
}
}
}
function findDepPids(list, process) {
if (process.sub) {
for (let key in process.sub) {
......@@ -375,7 +396,6 @@ async function addBuiltinProcesses(list, ids, getProcesses) {
list.push(process);
findDepPids(newPids, process);
}
//console.log('processes:', data.processes);
}
return newPids;
}
......
This diff is collapsed.
......@@ -241,18 +241,20 @@ ${scripts}
let newData = {};
newData.options = data.options;
delete newData.options.tpl;
newData.views = data.views;
newData.assets = data.assets;
newData.dataMapping = data.dataMapping;
newData.processes = data.processes;
delete newData.options.tpl;
deleteUnusedData(newData.processes);
console.log(TAG, 'start');
/*=====START process =====*/
console.log(TAG, 'start process');
let processIDs = [];
findDepPidsBat(processIDs, data.processes);
findDepPidsBat(processIDs, newData.processes);
let builtinProcesses = newData.builtinProcesses = [];
let bProcessIDs = processIDs;
......@@ -270,7 +272,7 @@ ${scripts}
}
}
for (let process of data.processes) {
for (let process of newData.processes) {
processManager.deal(process);
}
......@@ -349,6 +351,25 @@ ${scripts}
};
}
const unusedFields = ['design'];
function deleteUnusedData(processes){
for(let process of processes){
if(process.sub){
for(let uuid in process.sub){
let subProcess = process.sub[uuid];
for(let field of unusedFields){
if(subProcess.hasOwnProperty(field)){
delete subProcess[field];
}
}
}
}
if(process.metas && process.metas.length > 0){
deleteUnusedData(process.metas);
}
}
}
function findDepPids(list, process) {
if (process.sub) {
for (let key in process.sub) {
......@@ -375,7 +396,6 @@ ${scripts}
list.push(process);
findDepPids(newPids, process);
}
//console.log('processes:', data.processes);
}
return newPids;
}
......
This diff is collapsed.
......@@ -38,18 +38,20 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
let newData = {};
newData.options = data.options;
delete newData.options.tpl;
newData.views = data.views;
newData.assets = data.assets;
newData.dataMapping = data.dataMapping;
newData.processes = data.processes;
delete newData.options.tpl;
deleteUnusedData(newData.processes);
console.log(TAG, 'start');
/*=====START process =====*/
console.log(TAG, 'start process');
let processIDs = [];
findDepPidsBat(processIDs, data.processes);
findDepPidsBat(processIDs, newData.processes);
let builtinProcesses = newData.builtinProcesses = [];
let bProcessIDs = processIDs;
......@@ -67,7 +69,7 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
}
}
for (let process of data.processes) {
for (let process of newData.processes) {
processManager.deal(process);
}
......@@ -146,6 +148,25 @@ async function packData(data, {debug, getProcesses, getScripts, getCustoms}) {
};
}
const unusedFields = ['design'];
function deleteUnusedData(processes){
for(let process of processes){
if(process.sub){
for(let uuid in process.sub){
let subProcess = process.sub[uuid];
for(let field of unusedFields){
if(subProcess.hasOwnProperty(field)){
delete subProcess[field];
}
}
}
}
if(process.metas && process.metas.length > 0){
deleteUnusedData(process.metas);
}
}
}
function findDepPids(list, process) {
if (process.sub) {
for (let key in process.sub) {
......@@ -172,7 +193,6 @@ async function addBuiltinProcesses(list, ids, getProcesses) {
list.push(process);
findDepPids(newPids, process);
}
//console.log('processes:', data.processes);
}
return newPids;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment