@@ -18,17 +18,15 @@ Description:
18
18
</q-btn >
19
19
</template >
20
20
21
- <script lang="ts">
22
- import * as types from " types" ;
21
+ <script >
23
22
import { useExportComponent } from " ../composables/useExportComponent.js" ;
24
23
import { mapState } from " vuex" ;
25
- import { defineComponent } from " vue" ;
26
24
const { fs , ipcRenderer } = window ;
27
25
28
26
import writeNested from " ../../mixins/writeNested" ;
29
27
30
28
31
- export default defineComponent ( {
29
+ export default {
32
30
name: " ExportProjectComponent" ,
33
31
mixins: [writeNested],
34
32
methods: {
@@ -42,11 +40,11 @@ export default defineComponent({
42
40
message: " Choose location to save folder in" ,
43
41
nameFieldLabel: " Application Name" ,
44
42
})
45
- .then ((result : any ) => {
43
+ .then ((result ) => {
46
44
this .exportFile (result .filePath )
47
45
alert (' Successfully Exported' )
48
46
})
49
- .catch ((err : string ) => console .log (err ));
47
+ .catch ((err ) => console .log (err));
50
48
},
51
49
exportProject : function () {
52
50
@@ -58,7 +56,7 @@ export default defineComponent({
58
56
* invokes: createRouterImports(this.componentMap['App'].children),
59
57
* createExport(this.componentMap['App'].children)
60
58
* */
61
- createRouter(location : string ) {
59
+ createRouter (location ) {
62
60
if (this .exportAsTypescript === " on" ) {
63
61
fs .writeFileSync (
64
62
path .join (location, " src" , " router" , " index.ts" ),
@@ -77,8 +75,8 @@ export default defineComponent({
77
75
* @description import routed components from the /views/ dir
78
76
* @argument : this.componentMap['App'].children
79
77
*/
80
- createRouterImports(routes ): string {
81
- let str: string = " import { createRouter, createWebHistory } from 'vue-router';\n " ;
78
+ createRouterImports (routes ) {
79
+ let str = " import { createRouter, createWebHistory } from 'vue-router';\n " ;
82
80
for (let view in routes) {
83
81
str += ` import ${ view} from '../views/${ view} .vue';\n ` ;
84
82
}
@@ -87,8 +85,8 @@ export default defineComponent({
87
85
/**
88
86
* @description creates the `export default` code in <script>
89
87
*/
90
- createExport(routes ): string {
91
- let str: string = " export default createRouter({\n\t history: createWebHistory(import.meta.env.BASE_URL),\n\t routes: [\n " ;
88
+ createExport (routes ) {
89
+ let str = " export default createRouter({\n\t history: createWebHistory(import.meta.env.BASE_URL),\n\t routes: [\n " ;
92
90
for (let view in routes) {
93
91
// HomeView route is initialized to "localhost:3000/" url
94
92
if (view === " HomeView" ) {
@@ -107,7 +105,7 @@ export default defineComponent({
107
105
* @description : creates component code <template>, <script>, <style>
108
106
* invokes writeTemplate, writeScript, writeStyle
109
107
*/
110
- createComponentCode(componentLocation , componentName , children , routes ): void {
108
+ createComponentCode (componentLocation , componentName , children , routes ) {
111
109
if (componentName === " App" ) {
112
110
fs .writeFileSync (
113
111
componentLocation + " .vue" ,
@@ -125,14 +123,14 @@ export default defineComponent({
125
123
}
126
124
},
127
125
// creates assets folder
128
- createAssetFile(targetLocation : string , assetLocation ): void {
126
+ createAssetFile (targetLocation , assetLocation ) {
129
127
let saved = remote .nativeImage .createFromPath (assetLocation);
130
128
let urlData = saved .toPNG ();
131
129
fs .writeFileSync (targetLocation + " .png" , urlData);
132
130
},
133
- writeTemplateTag(componentName : string ) : string {
131
+ writeTemplateTag (componentName ) {
134
132
// create reference object - replace later
135
- const htmlElementMap: types . HtmlElementMap = {
133
+ const htmlElementMap = {
136
134
div: [" <div" , " </div>" ],
137
135
button: [" <button" , " </button>" ],
138
136
form: [" <form" , " </form>" ],
@@ -270,7 +268,7 @@ export default defineComponent({
270
268
/**
271
269
* @description imports child components into <script>
272
270
*/
273
- writeScript(componentName : string , children ) {
271
+ writeScript (componentName , children ) {
274
272
// add import mapstate and mapactions if they exist
275
273
const currentComponent = this .componentMap [componentName];
276
274
const routes = Object .keys (this .routes );
@@ -401,7 +399,7 @@ export default defineComponent({
401
399
*/
402
400
/* UPDATE THIS TO GRAB INFORMATION FROM this.componentMap NOT this.routes*/
403
401
/* this.componentMap does not have x-y positioning stored */
404
- writeStyle(componentName : string ) {
402
+ writeStyle (componentName ) {
405
403
let htmlArray = this .componentMap [componentName].htmlList ;
406
404
let styleString = " " ;
407
405
console .log (componentName);
@@ -512,7 +510,7 @@ export default defineComponent({
512
510
}
513
511
},
514
512
createESLintRC (location ) {
515
- let str: string ;
513
+ let str;
516
514
if (this .exportAsTypescript === " on" ) {
517
515
str += ` require("@rushstack/eslint-patch/modern-module-resolution");\n\n ` ;
518
516
}
@@ -550,14 +548,14 @@ export default defineComponent({
550
548
},
551
549
createTSDeclaration (location ) {
552
550
if (this .exportAsTypescript === " on" ) {
553
- let str: string = ` /// <reference types="vite/client" /> ` ;
551
+ let str = ` /// <reference types="vite/client" />` ;
554
552
fs .writeFileSync (path .join (location, " env.d.ts" ), str);
555
553
} else {
556
554
return ;
557
555
}
558
556
},
559
557
createStore (location ) {
560
- let str: string = ` import { createStore } from 'vuex';\n ` ;
558
+ let str = ` import { createStore } from 'vuex';\n ` ;
561
559
str += ` \n const store = createStore({` ;
562
560
str += ` \n\t state () {` ;
563
561
str += ` \n\t\t return {` ;
@@ -602,7 +600,7 @@ export default defineComponent({
602
600
},
603
601
// create package.json file
604
602
createPackage (location ) {
605
- let str: string = ` { ` ;
603
+ let str = ` {` ;
606
604
str += ` \n\t "name": "My-OverVue-Project",` ;
607
605
str += ` \n\t "version": "0.0.0",` ;
608
606
str += ` \n\t "scripts": {` ;
@@ -717,7 +715,7 @@ export default defineComponent({
717
715
" containerH"
718
716
]),
719
717
},
720
- }) ;
718
+ };
721
719
< / script>
722
720
723
721
< style scoped>
0 commit comments