@witchcraft/nuxt-electron 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.d.mts CHANGED
@@ -29,15 +29,15 @@ interface ModuleOptions {
29
29
  /** Extra cli arguments to launch electron with in dev mode */
30
30
  extraCliArgs: string[];
31
31
  /**
32
- * If set, adds `--user-data-dir ${devUserDataDir}` to the cli arguments in development mode.
32
+ * If set, adds `--dev-user-data-dir ${devUserDataDir}` to the cli arguments in development mode.
33
33
  *
34
- * You will then need to parse this in main.ts, a `useDevDataDir` function is provided for this. This does not do any advanced parsing, just takes the next argument after `--user-data-dir` so the path must not contain spaces.
34
+ * You will then need to parse this in main.ts, a `useDevDataDir` function is provided for this. This does not do any advanced parsing, just takes the next argument after `--dev-user-data-dir` so the path must not contain spaces.
35
35
  * ```ts
36
36
  * const userDataDir = useDevDataDir() ?? app.getPath("userData")
37
37
  *
38
38
  * @default "~~/.user-data-dir"
39
39
  */
40
- devUserDataDir: string;
40
+ devUserDataDir: string | null;
41
41
  /**
42
42
  * The script to run to build/pack the electron app.
43
43
  *
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron",
3
3
  "configKey": "electron",
4
- "version": "0.0.2",
4
+ "version": "0.0.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -10,7 +10,7 @@ import { notBundle } from 'vite-plugin-electron/plugin';
10
10
  import { externalizeDeps } from 'vite-plugin-externalize-deps';
11
11
 
12
12
  const dependencies = {
13
- "@witchcraft/ui": "^0.3.1"};
13
+ "@witchcraft/ui": "^0.3.2"};
14
14
  const pkg = {
15
15
  dependencies: dependencies};
16
16
 
@@ -36,7 +36,7 @@ const module = defineNuxtModule({
36
36
  srcDir: "~~/app-electron",
37
37
  electronBuildDir: "~~/.dist/electron",
38
38
  nonElectronNuxtBuildDir: "~~/.dist/web/.output",
39
- devUserDataDir: "~~/.user-data-dir",
39
+ devUserDataDir: void 0,
40
40
  electronRoute: "/app",
41
41
  autoOpen: process.env.AUTO_OPEN?.includes("electron"),
42
42
  electronBuildPackScript: "npm run build:electron:pack",
@@ -56,6 +56,9 @@ const module = defineNuxtModule({
56
56
  }
57
57
  },
58
58
  async setup(options, nuxt) {
59
+ if (options.devUserDataDir === void 0) {
60
+ options.devUserDataDir = "~~/.user-data-dir";
61
+ }
59
62
  if (!options.enable) {
60
63
  return;
61
64
  }
@@ -1,5 +1,5 @@
1
1
  import { type Component } from "vue";
2
- import type { WindowControlsApi } from "../electron/types.js.js";
2
+ import type { WindowControlsApi } from "../electron/types.js";
3
3
  type __VLS_Props = {
4
4
  borderWidth?: string;
5
5
  buttonSize?: string;
@@ -1,5 +1,5 @@
1
1
  import { type Component } from "vue";
2
- import type { WindowControlsApi } from "../electron/types.js.js";
2
+ import type { WindowControlsApi } from "../electron/types.js";
3
3
  type __VLS_Props = {
4
4
  borderWidth?: string;
5
5
  buttonSize?: string;
@@ -1,5 +1,5 @@
1
1
  import type { IpcRenderer } from "electron";
2
- import type { WindowControlsApi } from "./types.js.js";
2
+ import type { WindowControlsApi } from "./types.js";
3
3
  /**
4
4
  * Creates the apis to control the window from the preload script / client.
5
5
  *
@@ -1,16 +1,16 @@
1
- export * from "./types.js";
2
- export { getPaths } from "./getPaths.js";
3
- export { createNuxtFileProtocolHandler } from "./createNuxtFileProtocolHandler.js";
4
- export { createWindowControlsApi } from "./createWindowControlsApi.js";
5
- export { createWindowControlsApiHandler } from "./createWindowControlsApiHandler.js";
6
- export { useNuxtRuntimeConfig } from "./useNuxtRuntimeConfig.js";
7
- export { STATIC } from "./static.js";
8
- export { apiBuilder } from "./apiBuilder.js";
9
- export { useDevDataDir } from "./useDevDataDir.js";
10
- export { registerDevtoolsShortcuts } from "./registerDevtoolsShortcuts.js";
11
- export { promisifyApi } from "./promisifyApi.js";
12
- export { getPreloadMeta } from "./getPreloadMeta.js";
13
- export { getEventWindow } from "./getEventWindow.js";
14
- export { promisifyReply } from "./promisifyReply.js";
15
- export { createBroadcaster } from "./createBroadcaster.js";
16
- export { createBroadcastHandlers } from "./createBroadcastHandlers.js";
1
+ export * from "./types";
2
+ export { getPaths } from "./getPaths";
3
+ export { createNuxtFileProtocolHandler } from "./createNuxtFileProtocolHandler";
4
+ export { createWindowControlsApi } from "./createWindowControlsApi";
5
+ export { createWindowControlsApiHandler } from "./createWindowControlsApiHandler";
6
+ export { useNuxtRuntimeConfig } from "./useNuxtRuntimeConfig";
7
+ export { STATIC } from "./static";
8
+ export { apiBuilder } from "./apiBuilder";
9
+ export { useDevDataDir } from "./useDevDataDir";
10
+ export { registerDevtoolsShortcuts } from "./registerDevtoolsShortcuts";
11
+ export { promisifyApi } from "./promisifyApi";
12
+ export { getPreloadMeta } from "./getPreloadMeta";
13
+ export { getEventWindow } from "./getEventWindow";
14
+ export { promisifyReply } from "./promisifyReply";
15
+ export { createBroadcaster } from "./createBroadcaster";
16
+ export { createBroadcastHandlers } from "./createBroadcastHandlers";
@@ -1,6 +1,6 @@
1
1
  export function useDevDataDir() {
2
2
  if (import.meta.dev) {
3
- const index = process.argv.findIndex((arg) => arg.startsWith("--user-data-dir")) + 1;
3
+ const index = process.argv.findIndex((arg) => arg.startsWith("--dev-user-data-dir")) + 1;
4
4
  if (index === -1) return void 0;
5
5
  return process.argv[index + 1];
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@witchcraft/nuxt-electron",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Nuxt module for working with electron.",
5
5
  "repository": "witchcraftjs/nuxt-electron",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "genDevDesktop.js"
26
26
  ],
27
27
  "scripts": {
28
- "prepare": "husky && cd playground && pnpm i",
28
+ "prepare": "husky && pnpm nuxt-module-build prepare && pnpm build:only && cd playground && pnpm i --ignore-scripts --ignore-workspace",
29
29
  "build": "nuxt-module-build prepare && nuxt-module-build build && nuxi build playground",
30
30
  "build:only": "nuxt-module-build build",
31
31
  "dev": "nuxi dev playground",
@@ -39,14 +39,14 @@
39
39
  "@alanscodelog/utils": "^6.0.2",
40
40
  "@nuxt/kit": "^4.0.3",
41
41
  "@witchcraft/nuxt-utils": "^0.3.2",
42
- "@witchcraft/ui": "^0.3.1",
42
+ "@witchcraft/ui": "^0.3.2",
43
43
  "defu": "^6.1.4",
44
44
  "es-toolkit": "^1.39.10",
45
45
  "vite-plugin-electron": "^0.29.0",
46
46
  "vite-plugin-externalize-deps": "^0.9.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@witchcraft/ui": "^0.3.1",
49
+ "@witchcraft/ui": "^0.3.2",
50
50
  "unplugin-icons": "^22.1.0"
51
51
  },
52
52
  "peerDependenciesMeta": {
package/src/module.ts CHANGED
@@ -65,15 +65,15 @@ export interface ModuleOptions {
65
65
  /** Extra cli arguments to launch electron with in dev mode */
66
66
  extraCliArgs: string[]
67
67
  /**
68
- * If set, adds `--user-data-dir ${devUserDataDir}` to the cli arguments in development mode.
68
+ * If set, adds `--dev-user-data-dir ${devUserDataDir}` to the cli arguments in development mode.
69
69
  *
70
- * You will then need to parse this in main.ts, a `useDevDataDir` function is provided for this. This does not do any advanced parsing, just takes the next argument after `--user-data-dir` so the path must not contain spaces.
70
+ * You will then need to parse this in main.ts, a `useDevDataDir` function is provided for this. This does not do any advanced parsing, just takes the next argument after `--dev-user-data-dir` so the path must not contain spaces.
71
71
  * ```ts
72
72
  * const userDataDir = useDevDataDir() ?? app.getPath("userData")
73
73
  *
74
74
  * @default "~~/.user-data-dir"
75
75
  */
76
- devUserDataDir: string
76
+ devUserDataDir: string | null
77
77
  /**
78
78
  * The script to run to build/pack the electron app.
79
79
  *
@@ -159,7 +159,7 @@ export default defineNuxtModule<ModuleOptions>({
159
159
  srcDir: "~~/app-electron",
160
160
  electronBuildDir: "~~/.dist/electron",
161
161
  nonElectronNuxtBuildDir: "~~/.dist/web/.output",
162
- devUserDataDir: "~~/.user-data-dir",
162
+ devUserDataDir: undefined,
163
163
  electronRoute: "/app",
164
164
  autoOpen: process.env.AUTO_OPEN?.includes("electron"),
165
165
  electronBuildPackScript: "npm run build:electron:pack",
@@ -179,6 +179,11 @@ export default defineNuxtModule<ModuleOptions>({
179
179
  }
180
180
  },
181
181
  async setup(options, nuxt) {
182
+ // if the user explicitly sets it to null we want it to stay null
183
+ if (options.devUserDataDir === undefined) {
184
+ options.devUserDataDir = "~~/.user-data-dir"
185
+ }
186
+
182
187
  if (!options.enable) { return }
183
188
  const moduleName = "@witchcraft/nuxt-electron"
184
189
  const logger = useLogger(moduleName)
@@ -1,6 +1,6 @@
1
1
  export function useDevDataDir(): string | undefined {
2
2
  if (import.meta.dev) {
3
- const index = process.argv.findIndex(arg => arg.startsWith("--user-data-dir")) + 1
3
+ const index = process.argv.findIndex(arg => arg.startsWith("--dev-user-data-dir")) + 1
4
4
  if (index === -1) return undefined
5
5
  return process.argv[index + 1]
6
6
  }