Skip to content

Commit 1ef2760

Browse files
authored
Merge pull request #9 from oslabs-beta/chris/typescript
Chris/typescript
2 parents 3b162b0 + 9d3ea6a commit 1ef2760

Some content is hidden

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

51 files changed

+2416
-553
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: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [Changelog 5.0](#changelog-50)
2121
- [Changelog 6.0](#changelog-60)
2222
- [Changelog 7.0](#changelog-70)
23+
- [Changelog 8.0](#changelog-80)
2324
- [How to use](#how-to-use)
2425
- [Installation](#installation)
2526
- [WSL Installation](#wsl-installation)
@@ -60,11 +61,15 @@
6061
- Adding notes functionality <sub><sup>(v6.0)</sup></sub>
6162
- Enhanced component tree hierarchy display <sub><sup>(v6.0)</sup></sub>
6263
- Added drag and drop of HTML elements <sub><sup>(v7.0)</sup></sub>
63-
- Added color customization of compoents <sub><sup>(v7.0)</sup></sub>
64+
- Added color customization of components <sub><sup>(v7.0)</sup></sub>
6465
- More attribute options, class and v-model <sub><sup>(v7.0)</sup></sub>
6566
- Added scoped style tags for components <sub><sup>(v7.0)</sup></sub>
6667
- Size and position specification of HTML elements <sub><sup>(v7.0)</sup></sub>
67-
<br>
68+
- Added component snap to grid functionality <sub><sup>(v8.0)</sup></sub>
69+
- Ability to import vue component from Element Plus component library <sub><sup>(v8.0)</sup></sub>
70+
- Child component grid area CSS styling <sub><sup>(v8.0)</sup></sub>
71+
- Export project component hierarchy and enhanced boilerplate code <sub><sup>(v8.0)</sup></sub>
72+
6873
[↥Back to top](#table-of-contents)
6974

7075
### Changelog 2.0
@@ -188,8 +193,30 @@
188193
<h4><strong>Bug Fixes</strong></h4>
189194
<li>Fixed undo and redo capabilities </li>
190195
<li>Fixed badge number not rendering for nested HTML tags</li>
191-
<li></li>
196+
</ul>
197+
</details>
192198

199+
### Changelog 8.0
200+
201+
<details><summary>OverVue 8.0</summary>
202+
<ul>
203+
<li>Added component snap to grid functionality with additional grid density drop down menu feature</li>
204+
<li>Code snippet reflects CSS grid area styling of components </li>
205+
<li>Ability to import components from Element Plus library</li>
206+
<li>Exported project template code now more accurately reflects component placement in app</li>
207+
<li>Improved canvas drag and deselect</li>
208+
<li>Improved WSL developer installation instructions</li>
209+
<li>Added TypeScipt to application</li>
210+
<li>Implemented component search bar feature</li>
211+
<br>
212+
<h4><strong>Bug Fixes</strong></h4>
213+
<li>Fixed routing components in project exports </li>
214+
<li>Fixed component hierarchy in project exports </li>
215+
<li>Fixed import statements of route child components</li>
216+
<li>Fixed edge case HTML element bugs in project exports </li>
217+
<li>Fixed in app component movement bugs which caused position to not update correctly </li>
218+
<li>Fixed drag and drop HTML element on click bug</li>
219+
<li>Eliminated code redundancy by implementing mixins</li>
193220
</ul>
194221
</details>
195222
<br/>
@@ -278,8 +305,19 @@ npm run build
278305
**The ability to load the application and/or devtools requires a tool/application to run a linux display as WSL does not have any display drivers since it is based off of just a CLI.
279306
I recommend X410 (https://x410.dev/), althought it does cost \$15, for ease of use. There are free options such as VcXsrv(https://sourceforge.net/projects/vcxsrv/) that you can get, but requires more set up.**
280307

308+
If you choose to use VcXsrv, you will need to select a couple options:
309+
310+
<ul>
311+
<li>Launch XLaunch</li>
312+
<li>Select multiple windows and display number=0.</li>
313+
<li>Select no client.</li>
314+
<li>Select Clipboard, Primary Selection, Native opengl, and disable access control.</li>
315+
<li>If Windows firewall pops up - select Public for this server to work.</li>
316+
</ul>
317+
281318
If you choose to use x410, you will need to set the environment DISPLAY variable on each console:
282319

320+
283321
So, to open either the Vue devtools or OverVue in dev mode, first start your X Server then enter into the terminal:
284322
For WSL 1 :
285323

@@ -293,19 +331,34 @@ For WSL 2 :
293331
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
294332
export LIBGL_ALWAYS_INDIRECT=1
295333
```
334+
Then run the following command to run both OverVue and Vue developer tools.
335+
```
336+
npm run dev
337+
```
296338

297-
followed by the command for the s or devmode. If you want both open, enter commands above followed by starting the devtools:
339+
To launch the Vue devloper tool, use the following command.
298340

299341
```
300342
./node_modules/.bin/vue-devtools
301343
```
302344

303-
Then open a new terminal instance, set the DISPLAY value again (re-enter above command for DISPLAY), and start OverVue in dev mode:
345+
Then to start only OverVue in developer mode, open a new terminal instance and set the DISPLAY value again (re-enter above command for DISPLAY):
304346

305347
```
306348
quasar dev -m electron
307349
```
308-
**NOTE** Electron-deeplink currently does not work on our WSL2 computers and output an error during installing the dependency which prevented the application to open in dev mode. Go to /src-electron/electron-main.js and comment out line 3/import line to bypass error. The developers did not find any impacts on application so far.
350+
**NOTE**:
351+
<ul>
352+
<li>Electron-deeplink currently does not work on our WSL2 computers and output an error during installing the dependency which prevented the application to open in dev mode. Go to /src-electron/electron-main.js and comment out line 3/import line to bypass error. The developers did not find any impacts on application so far.</li>
353+
<li>There might be an npm install error despite all instructions. Try the following command below:</li>
354+
</ul>
355+
356+
```
357+
sudo apt install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev
358+
```
359+
360+
361+
309362

310363
## Running the Docker Image
311364

@@ -423,7 +476,6 @@ Here are some features we're thinking about adding:
423476

424477

425478
- Ability to place child components into HTML elements
426-
- More semantic HTML tag options
427479
- Ability to export Vuex store boilerplate
428480
- Ability to add two-way binding to input elements
429481
- More granular typing options for TypeScript mode
@@ -468,10 +520,14 @@ Johnny Chan @jchan444
468520
Jace Crowe @JaceCrowe
469521
Keyla Koizumi Nishimura @keylakoizumin
470522
Katherine Kim @katherinek123
523+
Chris Wong @Koregano73
524+
Honghao(Michael) Sun @sunhonghaoparis
525+
Alex Law @alexlaw528
526+
Emma Genesen @EGenesen
471527
```
472528

473529
Inspired by [PreVue](https://github.com/open-source-labs/PreVue)
474530

475531
<br/>
476532

477-
[↥Back to top](#table-of-contents)
533+
[↥Back to top](#table-of-contents)

extractor.js

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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+
console.log(getVueFiles());
84+
85+
//work with documentation for parse vue to work out how to use this
86+
function parseVueFile(path) {
87+
const fileContents = fs.readFileSync(path).toString();
88+
const parsedFile = parseComponent(fileContents);
89+
return parsedFile
90+
}
91+
92+
console.log(parseVueFile(getVueFiles()[0]))
93+
94+
function generateImportObjs(pathList) { // or something
95+
// iterate through paths
96+
// parse each file
97+
// extract necessary html / js stuff for importObj
98+
//necessary info:
99+
// component name
100+
// boilerplate properties for each component upon creation
101+
// const component = {
102+
// x: 0,
103+
// y: 20,
104+
// z: 0,
105+
// w: 200,
106+
// h: 200,
107+
// htmlList: this.selectedElementList, //htmlList ask Alex
108+
// noteList: [],
109+
// children: [],
110+
// actions: [],
111+
// props: [],
112+
// state: [],
113+
// parent: {},
114+
// isActive: false,
115+
// idDrag: '',
116+
// idDrop: '',
117+
// color: "#ffffff85",
118+
// htmlAttributes: {
119+
// class: "",
120+
// id: ""
121+
// }
122+
// };
123+
// return an array of importObjs with default settings, names, etc
124+
}
125+
126+
// might need to shift away from component name to unique id
127+
128+
// call parseVueFile on every file
129+
// const html = parseHTML(parsedFile);
130+
// const js = parseJS(parsedFile);
131+
132+
// return vueFilePathList;

0 commit comments

Comments
 (0)