Skip to content

Commit 5317d8a

Browse files
committed
added console log
1 parent 52015a5 commit 5317d8a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/components/left-sidebar/ComponentTab/ImportComponent.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export default {
104104
const htmlList = []; //array populated with substrings '<div>' '</div>' '<p>' etc.
105105
let compName = data[0].slice(data[0].lastIndexOf('/') + 1).replace(/[^a-z0-9-_.]/gi, '').replace(/.vue/, '');
106106
const vueFile = fs.readFileSync(data[0], "utf8");
107+
107108
108109
for (const key in this.$store.state.componentMap) {
109110
if (this.$store.state.componentMap[key].componentName === compName) {
@@ -138,21 +139,23 @@ export default {
138139
139140
let htmlString = vueFile.substring(vueFile.indexOf('<template >') + 10, vueFile.indexOf('</template>'));
140141
let scriptString = vueFile.substring(vueFile.indexOf(`<script>`) + 8, vueFile.indexOf(`/script>`) - 1)
141-
142+
142143
htmlParser(htmlString);
143144
importObj.props = this.parsingStringToProps(scriptString);
144145
importObj.actions = this.parsingStringToAction(scriptString);
145146
importObj.state = this.parsingStringToState(scriptString);
146147
147148
htmlList.pop(); htmlList.shift(); //OverVue adds a <div></div> wrapper to all components. remove this before importing.
148-
149+
console.log(htmlList)
149150
let groupings = findGroupings(htmlList);
150151
let groupingObj = objectGenerator(groupings);
151152
let groupingArray = [];
152153
for (const key in groupingObj) {
153154
groupingArray.push(groupingObj[key])
154155
}
155156
importObj.htmlList = groupingArray;
157+
console.log('importObj:')
158+
console.log(importObj)
156159
this.createImport(importObj) //send the importObj to CreateComponent.
157160
158161
/**
@@ -214,6 +217,8 @@ export default {
214217
*/
215218
216219
function findGroupings(array) {
220+
console.log("grouping:")
221+
console.log(array)
217222
let count = 0; //tracks where the parent ends
218223
let stopIndexes = []; //an array that will be used to slice out the parent/child relationships
219224
for (let i = 0; i < array.length; i++) {
@@ -251,6 +256,8 @@ export default {
251256
*/
252257
253258
function objectGenerator(array) {
259+
console.log("obj gen:")
260+
console.log(array)
254261
let groupingObj = {};
255262
for (let i = 0; i < array.length; i++) {
256263
for (const key in htmlElementMap) {
@@ -261,16 +268,18 @@ export default {
261268
}
262269
array[i].pop();
263270
array[i].shift();
271+
264272
if (array[i].length > 0) {
265273
const childGroupings = findGroupings(array[i]);
266274
const childrenObj = objectGenerator(childGroupings);
267275
const childrenArray = [];
268276
for (const key in childrenObj) {
269277
childrenArray.push(childrenObj[key])
270278
}
279+
console.log(groupingObj[i])
271280
groupingObj[i].children = childrenArray;
272281
} else {
273-
groupingObj[i].children = [];
282+
// groupingObj[i].children = [];
274283
}
275284
}
276285
return groupingObj;

0 commit comments

Comments
 (0)