Skip to content

Commit a253ad5

Browse files
committed
quick typo fixes
1 parent 0c0a6ff commit a253ad5

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src-electron/electron-main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ ipcMain.handle("exportProject", async (event, options) => {
104104
return { filePath };
105105
});
106106

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+
107116
ipcMain.handle('writeFile', async (event, filePath, content) => { //possibly merge this with 'writeJSON' handle
108117
// console.log('writeFile filePath:', filePath, '\n content:', content);
109118
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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const showExportProjectDialog = () => {
8585
.catch((err: Error) => console.log(err));
8686
};
8787
88-
const writeFile = async(filePath: any, content: any) => {
88+
export const writeFile = async(filePath: any, content: any) => {
8989
if (!filePath) {
9090
console.error('filePath is undefined');
9191
return;
@@ -94,18 +94,18 @@ const writeFile = async(filePath: any, content: any) => {
9494
.catch((error:any) => console.error(error));
9595
}
9696
97-
async function checkFileExists(path:string) {
97+
export async function checkFileExists(path:string) {
9898
const fileExistBool = await ipcRenderer.invoke('check-file-exists', path);
9999
return fileExistBool.status;
100100
};
101101
102-
const mkdirSync = async (...args:string[]) => {
102+
export const mkdirSync = async (...args:string[]) => {
103103
await ipcRenderer.invoke('mkdirSync', [...args ])
104104
105105
.catch((error:any) => console.error(error));
106106
}
107107
108-
const pathJoin = (...args:string[]) => {
108+
export const pathJoin = (...args:string[]) => {
109109
if (args.some(arg => arg === undefined)) { //undefined handler for if any args are undefined
110110
console.error('arguments are undefined)');
111111
return;
@@ -1157,7 +1157,7 @@ const createTSDeclaration = async(location: string) => {
11571157
};
11581158
11591159
const createStore = async(location: string) => {
1160-
let str = `import { createStore } from 'vuex';\n`;
1160+
let str = `import { createStore } from 'pinia';\n`;
11611161
str += `\nconst store = createStore({`;
11621162
str += `\n\tstate () {`;
11631163
str += `\n\t\treturn {`;
@@ -1238,6 +1238,7 @@ const createPackage = async(location: string) => {
12381238
str += `\n\t"dependencies": {`;
12391239
str += `\n\t\t"vue": "^3.4.21",`;
12401240
str += `\n\t\t"vue-router": "^4.0.12",`;
1241+
str += `\n\t\t"pinia": "^2.1.7"`;
12411242
str += `\n\t\t"vuex": "^4.0.2"`;
12421243
str += `,\n\t\t"element-plus": "^2.2.16"`;
12431244

0 commit comments

Comments
 (0)