vue-cli-plugin-electron-haunv 1.0.11 → 1.0.13

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/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # vue-cli-plugin-electron-haunv
2
+ build electron in vue cli
@@ -57,34 +57,34 @@ module.exports = (api) => {
57
57
 
58
58
  setTimeout(() => {
59
59
  if (!fs.existsSync(configPath)) {
60
- console.log("⚠️ vue.config.js not found, skip inject")
60
+ console.log("⚠️ vue.config.js not found")
61
61
  return
62
62
  }
63
63
 
64
64
  let content = fs.readFileSync(configPath, "utf-8")
65
65
 
66
66
  if (content.includes("publicPath")) {
67
- console.log("ℹ️ publicPath already exists")
67
+ console.log("ℹ️ already has publicPath")
68
68
  return
69
69
  }
70
70
 
71
- if (content.includes("module.exports")) {
72
- content = content.replace(
73
- /module\.exports\s*=\s*{/,
74
- `module.exports = {\n publicPath: "./",`
75
- )
76
- } else if (content.includes("export default")) {
77
- content = content.replace(
78
- /export\s+default\s*{/,
79
- `export default {\n publicPath: "./",`
80
- )
81
- } else {
82
- console.log("❌ Cannot detect vue.config.js format")
71
+ // 👉 tìm dấu } cuối cùng
72
+ const lastIndex = content.lastIndexOf("}")
73
+
74
+ if (lastIndex === -1) {
75
+ console.log("❌ cannot find end of config")
83
76
  return
84
77
  }
85
78
 
86
- fs.writeFileSync(configPath, content)
87
- console.log("✅ Injected publicPath into vue.config.js")
88
- }, 500) // ⬅️ delay cực kỳ quan trọng
79
+ // 👉 chèn trước dấu }
80
+ content =
81
+ content.slice(0, lastIndex) +
82
+ `,\n publicPath: "./"\n` +
83
+ content.slice(lastIndex)
84
+
85
+ fs.writeFileSync(configPath, content, "utf-8")
86
+
87
+ console.log("✅ Inject success REAL")
88
+ }, 500)
89
89
  })
90
90
  }
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "vue-cli-plugin-electron-haunv",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "vue-cli-plugin"
8
8
  ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/haunv0609/vue-cli-plugin-electron-haunv.git"
12
+ },
9
13
  "files": [
10
14
  "generator",
11
15
  "bin",