Skip to content

Commit 1c40508

Browse files
committed
resolved merge conflicts
Co-authored-by: Daniel Garan <[email protected]> Co-authored-by: Kevin Can <[email protected]> Co-authored-by: Anthony Herrera <[email protected]> Co-authored-by: Rob Sinzieri <[email protected]> Co-authored-by: Roderick de Leon <[email protected]>
2 parents 549eb6a + a253ad5 commit 1c40508

File tree

5 files changed

+146
-124
lines changed

5 files changed

+146
-124
lines changed

src-electron/electron-main.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ function createWindow() {
1818
height: 600,
1919
useContentSize: true,
2020
webPreferences: {
21-
// JAIME: i tried adding these two below to make window.require('fs') work
22-
// nodeIntegration: true,
23-
// contextIsolation: false,
21+
nodeIntegration: false,
2422
contextIsolation: true,
23+
allowRunningInsecureContent: false,
2524
// More info: https://v2.quasar.dev/quasar-cli-webpack/developing-electron-apps/electron-preload-script
2625
preload: path.resolve(__dirname, process.env.QUASAR_ELECTRON_PRELOAD),
2726
},
@@ -105,6 +104,15 @@ ipcMain.handle("exportProject", async (event, options) => {
105104
return { filePath };
106105
});
107106

107+
ipcMain.handle("exportComponent", async (event, options) => {
108+
const { dialog } = require("electron");
109+
const { filePath } = await dialog.showSaveDialog(options);
110+
if (filePath === "") {
111+
throw new Error("No file path selected");
112+
}
113+
return { filePath };
114+
});
115+
108116
ipcMain.handle('writeFile', async (event, filePath, content) => { //possibly merge this with 'writeJSON' handle
109117
// console.log('writeFile filePath:', filePath, '\n content:', content);
110118
console.log("writeFile filePath:", filePath);

src/components/composables/useExportComponent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { openHtmlElementMap } from "src/store/state/htmlElementMap";
22
import { useStore } from "src/store/main";
3+
import { writeFile, checkFileExists, mkdirSync, pathJoin } from '../nav-buttons/ExportMenu.vue'
34
export function useExportComponent() {
45
// OVERVUE 8.0: export active component
56
/**
@@ -32,7 +33,7 @@ export function useExportComponent() {
3233
*/
3334

3435
const createComponentCode = (componentLocation, componentName, children) => {
35-
fs.writeFileSync(
36+
writeFile(
3637
componentLocation + ".vue",
3738
// writeComments(componentName) +
3839
writeTemplate(componentName, children) +

src/components/nav-buttons/ExportMenu.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {
4343
} from "../../../types";
4444
import { useExportComponent } from "../composables/useExportComponent";
4545
import { createBoilerOptions, createBoilerComposition } from "../right-sidebar/createBoilerFuncs"
46+
import { createBoilerOptions, createBoilerComposition } from "../right-sidebar/createBoilerFuncs"
4647
// import * as fs from "fs"
4748
// import { fs } from "electron";
4849
// import { path } from 'path';
@@ -85,7 +86,7 @@ const showExportProjectDialog = () => {
8586
.catch((err: Error) => console.log(err));
8687
};
8788
88-
const writeFile = async(filePath: any, content: any) => {
89+
export const writeFile = async(filePath: any, content: any) => {
8990
if (!filePath) {
9091
console.error('filePath is undefined');
9192
return;
@@ -94,18 +95,18 @@ const writeFile = async(filePath: any, content: any) => {
9495
.catch((error:any) => console.error(error));
9596
}
9697
97-
async function checkFileExists(path:string) {
98+
export async function checkFileExists(path:string) {
9899
const fileExistBool = await ipcRenderer.invoke('check-file-exists', path);
99100
return fileExistBool.status;
100101
};
101102
102-
const mkdirSync = async (...args:string[]) => {
103+
export const mkdirSync = async (...args:string[]) => {
103104
await ipcRenderer.invoke('mkdirSync', [...args ])
104-
.then((response: any) => console.log('mkdirSync response is', response))
105+
105106
.catch((error:any) => console.error(error));
106107
}
107108
108-
const pathJoin = (...args:string[]) => {
109+
export const pathJoin = (...args:string[]) => {
109110
if (args.some(arg => arg === undefined)) { //undefined handler for if any args are undefined
110111
console.error('arguments are undefined)');
111112
return;
@@ -252,9 +253,10 @@ const createComponentCode = async(
252253
await writeFile(
253254
componentLocation + ".vue",
254255
await writeTemplate(componentName, children, routes.value) +
255-
await writeStyle(componentName)
256+
await writeStyle(componentName)
256257
);
257258
console.log('finished write createComponent code')
259+
// fs.writeFileSync() console.log('about to write createComponent code for not App')
258260
} else {
259261
if (store.composition === false) {
260262
// fs.writeFileSync(
@@ -1005,7 +1007,7 @@ const createTSDeclaration = async(location: string) => {
10051007
};
10061008
10071009
const createStore = async(location: string) => {
1008-
let str = `import { createStore } from 'vuex';\n`;
1010+
let str = `import { createStore } from 'pinia';\n`;
10091011
str += `\nconst store = createStore({`;
10101012
str += `\n\tstate () {`;
10111013
str += `\n\t\treturn {`;
@@ -1086,6 +1088,7 @@ const createPackage = async(location: string) => {
10861088
str += `\n\t"dependencies": {`;
10871089
str += `\n\t\t"vue": "^3.4.21",`;
10881090
str += `\n\t\t"vue-router": "^4.0.12",`;
1091+
str += `\n\t\t"pinia": "^2.1.7"`;
10891092
str += `\n\t\t"vuex": "^4.0.2"`;
10901093
str += `,\n\t\t"element-plus": "^2.2.16"`;
10911094

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
LOCATION IN APP:
33
[right sidebar] COMPONENT DETAILS > Code Preview
44
@@ -9,7 +9,7 @@
99

1010
<template>
1111
<div class="codesnippet-container">
12-
<div class="top-p-container">
12+
<div class="top-p-container">
1313
<div class="top-p" v-if="activeComponent !== ''">
1414
{{ `${activeRoute} / ${activeComponent}.vue` }}
1515
</div>
@@ -45,8 +45,8 @@ import {
4545
onMounted,
4646
onBeforeUnmount,
4747
nextTick,
48-
Ref,
49-
defineEmits
48+
Ref,
49+
defineEmits
5050
} from "vue";
5151
import { PrismEditor } from "vue-prism-editor";
5252
import { highlight, languages } from "prismjs/components/prism-core";
@@ -219,7 +219,7 @@ const writeTemplateTag = (componentName: string, activeComponent: string) => {
219219
</div> \n\t </VDialog>`,
220220
],
221221
VDrawer: [
222-
`<VDrawer transition="slide-right" bg-transition="fade">
222+
`<VDrawer transition="slide-right" bg-transition="fade">
223223
<template #toggle="{ bind, on }">
224224
<button v-bind="bind" v-on="on">
225225
Toggle Drawer

0 commit comments

Comments
 (0)