Skip to content

Commit 1037c95

Browse files
authored
Merge pull request #168 from open-source-labs/dev
Final merge to incorporate OverVue 8.0
2 parents 3b162b0 + be99aed commit 1037c95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3714
-1128
lines changed

.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
SLACK_CLIENT_SECRET = "6a6206cc93da2e49243ee9683f958438"
2-
SLACK_CLIENT_ID = "2696943977700.2696948669268"
3-
SLACK_REDIRECT_URI = "overvue://slack"
1+
SLACK_CLIENT_SECRET = "f58eea5761562d05dfa266207726f2aa"
2+
SLACK_CLIENT_ID = "4070788123922.4067827840757"
3+
SLACK_REDIRECT_URI = "https://app.slack.com/client/T0422P63MT4/C041W53TYBG?redir=%2Fapi%2Fapps%3Fnew_app%3D1"
44

55
# SLACK_CLIENT_ID = 2863575808677.2851894215719
66
# SLACK_CLIENT_SECRET = "f2298f5fbb83d842616711d19c829a45"
7-
# SLACK_REDIRECT_URI = "overvue://slack"
7+
# SLACK_REDIRECT_URI = "overvue://slack"

.env.development

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
SLACK_CLIENT_SECRET = "6a6206cc93da2e49243ee9683f958438"
2-
SLACK_CLIENT_ID = "2696943977700.2696948669268"
3-
SLACK_REDIRECT_URI = "overvuedev://test"
1+
SLACK_CLIENT_SECRET = "f58eea5761562d05dfa266207726f2aa"
2+
SLACK_CLIENT_ID = "4070788123922.4067827840757"
3+
SLACK_REDIRECT_URI = "https://app.slack.com/client/T0422P63MT4/C041W53TYBG?redir=%2Fapi%2Fapps%3Fnew_app%3D1"
44

55
# SLACK_CLIENT_ID = "2863575808677.2851894215719"
66
# SLACK_CLIENT_SECRET = "f2298f5fbb83d842616711d19c829a45"
7-
# SLACK_REDIRECT_URI = "overvuedev://test"
7+
# SLACK_REDIRECT_URI = "overvuedev://test"

.eslintrc.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ module.exports = {
88
'vue/no-deprecated-slot-attribute': 'off',
99
},
1010

11+
"parser": "vue-eslint-parser",
1112
parserOptions: {
12-
parser: '@babel/eslint-parser',
1313
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
14+
parser: { //attempt to speed up runtime using TS when coding
15+
"ts":'@typescript-eslint/parser',
16+
"<template>": "espree"
17+
},
18+
requireConfigFile: false,
1419
sourceType: 'module', // Allows for the use of imports
15-
requireConfigFile: false
1620
},
1721

1822
env: {
@@ -68,4 +72,4 @@ module.exports = {
6872
// allow debugger during development only
6973
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
7074
}
71-
}
75+
};

README.md

Lines changed: 246 additions & 235 deletions
Large diffs are not rendered by default.

extractor.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// This file defines extractor functionality that targets the files of an imported component library, generates an array of file paths to each vue component, and parses each component to generate an import object compatible with createComponent
2+
3+
// parsing implementation in progress
4+
5+
6+
// importing parseComponent from npm package
7+
const { parseComponent } = require("vue-sfc-parser");
8+
// https://www.npmjs.com/package/vue-sfc-parser
9+
const fs = require("fs");
10+
const path = require("path");
11+
12+
// generate an array of file objects that are either files or directories (folders) with files
13+
// input: root directory of component library, empty result arr
14+
// output: arr of objects (tree data structure)
15+
16+
const getFullDirectory = function(dir, result = []) {
17+
// list files in component library directory and loop through
18+
fs.readdirSync(dir).forEach((file) => {
19+
// builds full path of file
20+
const fPath = path.resolve(dir, file);
21+
22+
// prepare stats obj
23+
const fileStats = { file, path: fPath };
24+
25+
// is the file a directory ?
26+
// if yes, traverse it also, if no just add it to the result
27+
if (fs.statSync(fPath).isDirectory()) {
28+
fileStats.type = "dir";
29+
fileStats.files = [];
30+
result.push(fileStats);
31+
return getFullDirectory(fPath, fileStats.files);
32+
}
33+
34+
fileStats.type = "file";
35+
result.push(fileStats);
36+
});
37+
// returns an array of file objects that are either files, or directories with files inside
38+
return result;
39+
};
40+
41+
42+
// collect all file paths nested in full directory tree that end with extension .vue
43+
44+
// const extractFilePaths = ({ dirArray = [], collection = [], target = ".vue" }) => {
45+
// for (let i = 0; i < dirArray.length; i++) {
46+
// if (dirArray[i].type === "dir") {
47+
// extractFilePaths({ dirArray: dirArray[i].files, collection, target });
48+
// } else if (dirArray[i].file.endsWith(target)) {
49+
// collection.push(dirArray[i].path);
50+
// }
51+
// }
52+
// return collection;
53+
// }
54+
55+
const getFilePathsByExtension = (dirArray, collection = [], extension = ".vue") => {
56+
for (let i = 0; i < dirArray.length; i++) {
57+
if (dirArray[i].type === "dir") {
58+
getFilePathsByExtension(dirArray[i].files, collection, extension);
59+
} else if (dirArray[i].file.endsWith(extension)) {
60+
collection.push(dirArray[i].path);
61+
}
62+
}
63+
64+
//return arr of strings representing file path names
65+
return collection;
66+
};
67+
68+
// returns [ 'users/emma/yadda/yadda/button.vue', 'users/emma/yadda/yadda/button.vue' ]
69+
70+
// parseVueFile => parse the view file
71+
// generateImportObj => call parseVueFile on every string in collection
72+
// NOTE: if want to expand logic here to allow for other libraries, change package name to name of that libary; look at for stretch goal
73+
74+
const getVueFiles = (package = "iview") => {
75+
const rootDir = path.join(__dirname, "node_modules", package);
76+
//invoke getFullDirectory with root directory of package
77+
const fullDirectory = getFullDirectory(rootDir);
78+
//invoke getFilePathsByExtension with fullDirectory
79+
const vueFilePathList = getFilePathsByExtension(fullDirectory);
80+
return vueFilePathList;
81+
};
82+
83+
84+
//work with documentation for parse vue to work out how to use this
85+
function parseVueFile(path) {
86+
const fileContents = fs.readFileSync(path).toString();
87+
const parsedFile = parseComponent(fileContents);
88+
return parsedFile
89+
}
90+
91+
92+
93+
function generateImportObjs(pathList) { // or something
94+
// iterate through paths
95+
// parse each file
96+
// extract necessary html / js stuff for importObj
97+
//necessary info:
98+
// component name
99+
// boilerplate properties for each component upon creation
100+
// const component = {
101+
// x: 0,
102+
// y: 20,
103+
// z: 0,
104+
// w: 200,
105+
// h: 200,
106+
// htmlList: this.selectedElementList, //htmlList ask Alex
107+
// noteList: [],
108+
// children: [],
109+
// actions: [],
110+
// props: [],
111+
// state: [],
112+
// parent: {},
113+
// isActive: false,
114+
// idDrag: '',
115+
// idDrop: '',
116+
// color: "#ffffff85",
117+
// htmlAttributes: {
118+
// class: "",
119+
// id: ""
120+
// }
121+
// };
122+
// return an array of importObjs with default settings, names, etc
123+
}
124+
125+
// might need to shift away from component name to unique id
126+
127+
// call parseVueFile on every file
128+
// const html = parseHTML(parsedFile);
129+
// const js = parseJS(parsedFile);
130+
131+
// return vueFilePathList;

0 commit comments

Comments
 (0)