@kunver/new 3.1.1 → 3.3.0

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.
Files changed (112) hide show
  1. package/README.MD +26 -18
  2. package/dist/index.js +16 -10
  3. package/dist/templates/cmake-cpp/.clang-format +1 -0
  4. package/dist/templates/cmake-cpp/CMakeLists.txt +14 -0
  5. package/dist/templates/cmake-cpp/README.md +32 -0
  6. package/dist/templates/cmake-cpp/_clang-format +1 -0
  7. package/dist/templates/cmake-cpp/_gitignore +9 -0
  8. package/dist/templates/cmake-cpp/agents.md +8 -0
  9. package/dist/templates/{make-cpp → cmake-cpp}/include/example.hpp +1 -1
  10. package/dist/templates/cmake-cpp/manager.ts +276 -0
  11. package/dist/templates/{make-cpp → cmake-cpp}/src/main.cpp +1 -1
  12. package/dist/templates/electron-svelte/.vscode/launch.json +39 -39
  13. package/dist/templates/electron-svelte/.vscode/settings.json +15 -15
  14. package/dist/templates/next-prisma/README.md +11 -11
  15. package/dist/templates/next-prisma/_prettierrc.json +12 -0
  16. package/dist/templates/next-prisma/app/globals.css +1 -1
  17. package/dist/templates/next-prisma/app/layout.tsx +21 -21
  18. package/dist/templates/next-prisma/app/page.tsx +7 -7
  19. package/dist/templates/next-prisma/lib/prisma.ts +11 -11
  20. package/dist/templates/next-prisma/manager.cjs +71 -69
  21. package/dist/templates/next-prisma/next.config.ts +7 -7
  22. package/dist/templates/next-prisma/package.json +33 -33
  23. package/dist/templates/next-prisma/postcss.config.mjs +5 -5
  24. package/dist/templates/next-prisma/tsconfig.json +27 -27
  25. package/dist/templates/react-ts-tw/README.md +1 -1
  26. package/dist/templates/react-ts-tw/_prettierrc.json +12 -0
  27. package/dist/templates/react-ts-tw/index.html +13 -13
  28. package/dist/templates/react-ts-tw/manager.cjs +71 -69
  29. package/dist/templates/react-ts-tw/package.json +30 -30
  30. package/dist/templates/react-ts-tw/src/App.tsx +9 -9
  31. package/dist/templates/react-ts-tw/src/index.css +1 -1
  32. package/dist/templates/react-ts-tw/src/main.tsx +10 -10
  33. package/dist/templates/react-ts-tw/src/vite-env.d.ts +1 -1
  34. package/dist/templates/react-ts-tw/tsconfig.app.json +27 -27
  35. package/dist/templates/react-ts-tw/tsconfig.json +4 -7
  36. package/dist/templates/react-ts-tw/tsconfig.node.json +25 -25
  37. package/dist/templates/react-ts-tw/vite.config.ts +8 -8
  38. package/dist/templates/wxt-solid/README.md +3 -3
  39. package/dist/templates/wxt-solid/_prettierrc.json +11 -0
  40. package/dist/templates/wxt-solid/agents.md +76 -76
  41. package/dist/templates/wxt-solid/assets/tailwind.css +1 -1
  42. package/dist/templates/wxt-solid/entrypoints/background.ts +3 -3
  43. package/dist/templates/wxt-solid/entrypoints/content/Content.tsx +7 -7
  44. package/dist/templates/wxt-solid/entrypoints/content/main.tsx +31 -31
  45. package/dist/templates/wxt-solid/entrypoints/options/{App.tsx → Options.tsx} +0 -1
  46. package/dist/templates/wxt-solid/entrypoints/options/index.html +13 -13
  47. package/dist/templates/wxt-solid/entrypoints/options/main.tsx +2 -2
  48. package/dist/templates/wxt-solid/entrypoints/popup/index.html +13 -13
  49. package/dist/templates/wxt-solid/entrypoints/popup/main.tsx +2 -2
  50. package/dist/templates/wxt-solid/manager.cjs +71 -69
  51. package/dist/templates/wxt-solid/package.json +33 -33
  52. package/dist/templates/wxt-solid/tsconfig.json +7 -7
  53. package/dist/templates/wxt-solid/wxt.config.ts +18 -18
  54. package/dist/templates/wxt-svelte/.vscode/extensions.json +3 -3
  55. package/dist/templates/wxt-svelte/README.md +3 -3
  56. package/dist/templates/wxt-svelte/_prettierrc.json +11 -0
  57. package/dist/templates/wxt-svelte/agents.md +77 -77
  58. package/dist/templates/wxt-svelte/assets/tailwind.css +1 -1
  59. package/dist/templates/wxt-svelte/entrypoints/background.ts +3 -3
  60. package/dist/templates/wxt-svelte/entrypoints/content/index.ts +4 -4
  61. package/dist/templates/wxt-svelte/entrypoints/options/index.html +13 -13
  62. package/dist/templates/wxt-svelte/entrypoints/options/main.ts +2 -2
  63. package/dist/templates/wxt-svelte/entrypoints/popup/index.html +13 -13
  64. package/dist/templates/wxt-svelte/entrypoints/popup/main.ts +2 -2
  65. package/dist/templates/wxt-svelte/manager.cjs +71 -69
  66. package/dist/templates/wxt-svelte/package.json +36 -36
  67. package/dist/templates/wxt-svelte/tsconfig.json +6 -6
  68. package/dist/templates/wxt-svelte/wxt-env.d.ts +1 -1
  69. package/dist/templates/wxt-svelte/wxt.config.ts +18 -18
  70. package/dist/templates/wxt-vanilla/README.md +3 -3
  71. package/dist/templates/wxt-vanilla/_prettierrc.json +11 -0
  72. package/dist/templates/wxt-vanilla/agents.md +73 -73
  73. package/dist/templates/wxt-vanilla/entrypoints/background.ts +3 -3
  74. package/dist/templates/wxt-vanilla/entrypoints/content.ts +6 -6
  75. package/dist/templates/wxt-vanilla/entrypoints/popup/index.html +13 -13
  76. package/dist/templates/wxt-vanilla/entrypoints/popup/main.ts +1 -1
  77. package/dist/templates/wxt-vanilla/manager.cjs +71 -69
  78. package/dist/templates/wxt-vanilla/package.json +25 -25
  79. package/dist/templates/wxt-vanilla/tsconfig.json +3 -3
  80. package/dist/templates/wxt-vanilla/wxt.config.ts +13 -13
  81. package/package.json +18 -5
  82. package/dist/templates/electron-svelte/README.md +0 -3
  83. package/dist/templates/electron-svelte/_gitignore +0 -6
  84. package/dist/templates/electron-svelte/build/entitlements.mac.plist +0 -12
  85. package/dist/templates/electron-svelte/build/icon.icns +0 -0
  86. package/dist/templates/electron-svelte/build/icon.ico +0 -0
  87. package/dist/templates/electron-svelte/build/icon.png +0 -0
  88. package/dist/templates/electron-svelte/bun.lock +0 -1154
  89. package/dist/templates/electron-svelte/electron-builder.yml +0 -44
  90. package/dist/templates/electron-svelte/electron.vite.config.ts +0 -15
  91. package/dist/templates/electron-svelte/manager.cjs +0 -69
  92. package/dist/templates/electron-svelte/package.json +0 -44
  93. package/dist/templates/electron-svelte/resources/icon.png +0 -0
  94. package/dist/templates/electron-svelte/src/main/index.ts +0 -62
  95. package/dist/templates/electron-svelte/src/preload/index.d.ts +0 -8
  96. package/dist/templates/electron-svelte/src/preload/index.ts +0 -22
  97. package/dist/templates/electron-svelte/src/renderer/index.html +0 -16
  98. package/dist/templates/electron-svelte/src/renderer/src/App.svelte +0 -8
  99. package/dist/templates/electron-svelte/src/renderer/src/assets/main.css +0 -1
  100. package/dist/templates/electron-svelte/src/renderer/src/env.d.ts +0 -2
  101. package/dist/templates/electron-svelte/src/renderer/src/main.ts +0 -11
  102. package/dist/templates/electron-svelte/svelte.config.mjs +0 -7
  103. package/dist/templates/electron-svelte/tsconfig.json +0 -4
  104. package/dist/templates/electron-svelte/tsconfig.node.json +0 -11
  105. package/dist/templates/electron-svelte/tsconfig.web.json +0 -17
  106. package/dist/templates/make-cpp/Makefile +0 -44
  107. package/dist/templates/make-cpp/README.md +0 -15
  108. /package/dist/templates/{make-cpp → cmake-cpp}/src/example.cpp +0 -0
  109. /package/dist/templates/wxt-solid/entrypoints/popup/{App.tsx → Popup.tsx} +0 -0
  110. /package/dist/templates/wxt-svelte/entrypoints/content/{App.svelte → Content.svelte} +0 -0
  111. /package/dist/templates/wxt-svelte/entrypoints/options/{App.svelte → Options.svelte} +0 -0
  112. /package/dist/templates/wxt-svelte/entrypoints/popup/{App.svelte → Popup.svelte} +0 -0
@@ -1,33 +1,33 @@
1
- {
2
- "name": "wxt-solid-starter",
3
- "description": "manifest.json description",
4
- "private": true,
5
- "version": "0.0.0",
6
- "type": "module",
7
- "scripts": {
8
- "dev": "wxt",
9
- "dev:firefox": "wxt -b firefox",
10
- "build": "wxt build",
11
- "build:firefox": "wxt build -b firefox",
12
- "zip": "wxt zip",
13
- "zip:all": "bun --parallel zip zip:firefox",
14
- "zip:firefox": "wxt zip -b firefox",
15
- "compile": "tsc --noEmit",
16
- "postinstall": "wxt prepare",
17
- "resize": "bunx @kunver/resize",
18
- "manager": "bun manager.cjs bun"
19
- },
20
- "dependencies": {
21
- "solid-js": "^1.9.11"
22
- },
23
- "devDependencies": {
24
- "tailwindcss": "^4.2.1",
25
- "@tailwindcss/vite": "^4.2.1",
26
- "@wxt-dev/module-solid": "^1.1.4",
27
- "typescript": "^5.9.3",
28
- "wxt": "^0.20.18"
29
- },
30
- "trustedDependencies": [
31
- "spawn-sync"
32
- ]
33
- }
1
+ {
2
+ "name": "wxt-solid-starter",
3
+ "description": "manifest.json description",
4
+ "private": true,
5
+ "version": "0.0.0",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "wxt",
9
+ "dev:firefox": "wxt -b firefox",
10
+ "build": "wxt build",
11
+ "build:firefox": "wxt build -b firefox",
12
+ "zip": "wxt zip",
13
+ "zip:all": "bun --parallel zip zip:firefox",
14
+ "zip:firefox": "wxt zip -b firefox",
15
+ "compile": "tsc --noEmit",
16
+ "postinstall": "wxt prepare",
17
+ "resize": "bunx @kunver/resize",
18
+ "manager": "bun manager.cjs bun"
19
+ },
20
+ "dependencies": {
21
+ "solid-js": "^1.9.11"
22
+ },
23
+ "devDependencies": {
24
+ "tailwindcss": "^4.2.1",
25
+ "@tailwindcss/vite": "^4.2.1",
26
+ "@wxt-dev/module-solid": "^1.1.4",
27
+ "typescript": "^5.9.3",
28
+ "wxt": "^0.20.18"
29
+ },
30
+ "trustedDependencies": [
31
+ "spawn-sync"
32
+ ]
33
+ }
@@ -1,7 +1,7 @@
1
- {
2
- "extends": "./.wxt/tsconfig.json",
3
- "compilerOptions": {
4
- "jsx": "preserve",
5
- "jsxImportSource": "solid-js"
6
- }
7
- }
1
+ {
2
+ "extends": "./.wxt/tsconfig.json",
3
+ "compilerOptions": {
4
+ "jsx": "preserve",
5
+ "jsxImportSource": "solid-js"
6
+ }
7
+ }
@@ -1,18 +1,18 @@
1
- import { defineConfig } from "wxt"
2
- import tailwindcss from "@tailwindcss/vite"
3
-
4
- // See https://wxt.dev/api/config.html
5
- export default defineConfig({
6
- manifest: {
7
- name: "wxt-solid-starter",
8
- description: "manifest.json description",
9
- //permissions: ["storage"],
10
- },
11
- modules: ["@wxt-dev/module-solid"],
12
- vite: () => ({
13
- plugins: [tailwindcss()],
14
- }),
15
- webExt: {
16
- disabled: true,
17
- },
18
- })
1
+ import { defineConfig } from "wxt"
2
+ import tailwindcss from "@tailwindcss/vite"
3
+
4
+ // See https://wxt.dev/api/config.html
5
+ export default defineConfig({
6
+ manifest: {
7
+ name: "wxt-solid-starter",
8
+ description: "manifest.json description",
9
+ //permissions: ["storage"],
10
+ },
11
+ modules: ["@wxt-dev/module-solid"],
12
+ vite: () => ({
13
+ plugins: [tailwindcss()],
14
+ }),
15
+ webExt: {
16
+ disabled: true,
17
+ },
18
+ })
@@ -1,3 +1,3 @@
1
- {
2
- "recommendations": ["svelte.svelte-vscode"]
3
- }
1
+ {
2
+ "recommendations": ["svelte.svelte-vscode"]
3
+ }
@@ -1,3 +1,3 @@
1
- # Wxt + Svelte + Tailwind + Typescript
2
-
3
- Web extension starter
1
+ # Wxt + Svelte + Tailwind + Typescript
2
+
3
+ Web extension starter
@@ -0,0 +1,11 @@
1
+ {
2
+ "semi": false,
3
+ "trailingComma": "all",
4
+ "singleQuote": false,
5
+ "printWidth": 120,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "jsxSingleQuote": false,
9
+ "jsxBracketSameLine": false,
10
+ "arrowParens": "avoid"
11
+ }
@@ -1,77 +1,77 @@
1
- - This is a Web Extension Project
2
- - Goal : <goal>
3
-
4
- - This project uses wxt framework for development. wxt is a extension development framework.
5
- - website to framework is : https://wxt.dev/
6
- - you can find docs on these websites :
7
-
8
- 1. https://wxt.dev//knowledge/docs.txt
9
- 2. https://wxt.dev//knowledge/api-reference.txt
10
-
11
- - use browser super global whenever you want to use chrome global. wxt uses browser global for development
12
- for example:
13
- browser.runtime.getURL() instead of chrome.runtime.getURL()
14
-
15
- ## Manifest :
16
-
17
- In WXT, there is no manifest.json file in your source code. Instead, WXT generates the manifest from multiple sources:
18
-
19
- Global options defined in wxt.config.ts file
20
- Entrypoint-specific options defined in your entrypoints
21
- WXT Modules added to your project can modify your manifest
22
- Hooks defined in your project can modify your manifest
23
- Your extension's manifest.json will be output to .output/{target}/manifest.json when running wxt build.
24
-
25
- - this extension should work <url>
26
- - this project uses svelte 5 for frontend.
27
- - this extension aims manifest v3
28
- - this project uses tailwindcss v4 for styling.
29
- - this project uses typescript for development.
30
- - this project uses prettier for code formatting.
31
- - this project uses vite.
32
- - this project uses bun package manager, not npm.
33
- - when using svelte, use modern latest svelte 5 runes syntax.
34
- - I should have a .prettierrc.json file in the root directory. please also follow rules on that.
35
-
36
- - entrypoints are in src/entrypoints directory
37
-
38
- ## Storage
39
-
40
- - When we need storage we should use WXT Storage, you should import it from "#imports".
41
- - Please check project if I already defined a store
42
- - use "local:" prefix when storing data locally
43
-
44
- ## Storage
45
-
46
- - When we need storage we should use WXT Storage, you should import it from "#imports".
47
- - Please check project if I already defined a store
48
- - use "local:" prefix when storing data locally
49
-
50
- ```ts
51
- // utils/storage.ts
52
- import { storage } from "#imports"
53
- const showChangelogOnUpdate = storage.defineItem<boolean>("local:showChangelogOnUpdate", {
54
- fallback: true,
55
- })
56
-
57
- // usage
58
- await showChangelogOnUpdate.getValue()
59
- await showChangelogOnUpdate.setValue(false)
60
- await showChangelogOnUpdate.removeValue()
61
- const unwatch = showChangelogOnUpdate.watch(newValue => {
62
- // ...
63
- })
64
- ```
65
-
66
- ## i18n usage
67
-
68
- - when needed, use @wxt-dev/i18n, and import from "#i18n"
69
- - translations will be in <srcDir>/locales/ directory, and will be yml files.
70
-
71
- - usage example
72
-
73
- ```ts
74
- import { i18n } from "#i18n"
75
-
76
- i18n.t("helloWorld") // "Hello world!"
77
- ```
1
+ - This is a Web Extension Project
2
+ - Goal : <goal>
3
+
4
+ - This project uses wxt framework for development. wxt is a extension development framework.
5
+ - website to framework is : https://wxt.dev/
6
+ - you can find docs on these websites :
7
+
8
+ 1. https://wxt.dev//knowledge/docs.txt
9
+ 2. https://wxt.dev//knowledge/api-reference.txt
10
+
11
+ - use browser super global whenever you want to use chrome global. wxt uses browser global for development
12
+ for example:
13
+ browser.runtime.getURL() instead of chrome.runtime.getURL()
14
+
15
+ ## Manifest :
16
+
17
+ In WXT, there is no manifest.json file in your source code. Instead, WXT generates the manifest from multiple sources:
18
+
19
+ Global options defined in wxt.config.ts file
20
+ Entrypoint-specific options defined in your entrypoints
21
+ WXT Modules added to your project can modify your manifest
22
+ Hooks defined in your project can modify your manifest
23
+ Your extension's manifest.json will be output to .output/{target}/manifest.json when running wxt build.
24
+
25
+ - this extension should work <url>
26
+ - this project uses svelte 5 for frontend.
27
+ - this extension aims manifest v3
28
+ - this project uses tailwindcss v4 for styling.
29
+ - this project uses typescript for development.
30
+ - this project uses prettier for code formatting.
31
+ - this project uses vite.
32
+ - this project uses bun package manager, not npm.
33
+ - when using svelte, use modern latest svelte 5 runes syntax.
34
+ - I should have a .prettierrc.json file in the root directory. please also follow rules on that.
35
+
36
+ - entrypoints are in src/entrypoints directory
37
+
38
+ ## Storage
39
+
40
+ - When we need storage we should use WXT Storage, you should import it from "#imports".
41
+ - Please check project if I already defined a store
42
+ - use "local:" prefix when storing data locally
43
+
44
+ ## Storage
45
+
46
+ - When we need storage we should use WXT Storage, you should import it from "#imports".
47
+ - Please check project if I already defined a store
48
+ - use "local:" prefix when storing data locally
49
+
50
+ ```ts
51
+ // utils/storage.ts
52
+ import { storage } from "#imports"
53
+ const showChangelogOnUpdate = storage.defineItem<boolean>("local:showChangelogOnUpdate", {
54
+ fallback: true,
55
+ })
56
+
57
+ // usage
58
+ await showChangelogOnUpdate.getValue()
59
+ await showChangelogOnUpdate.setValue(false)
60
+ await showChangelogOnUpdate.removeValue()
61
+ const unwatch = showChangelogOnUpdate.watch(newValue => {
62
+ // ...
63
+ })
64
+ ```
65
+
66
+ ## i18n usage
67
+
68
+ - when needed, use @wxt-dev/i18n, and import from "#i18n"
69
+ - translations will be in <srcDir>/locales/ directory, and will be yml files.
70
+
71
+ - usage example
72
+
73
+ ```ts
74
+ import { i18n } from "#i18n"
75
+
76
+ i18n.t("helloWorld") // "Hello world!"
77
+ ```
@@ -1 +1 @@
1
- @import "tailwindcss";
1
+ @import "tailwindcss";
@@ -1,3 +1,3 @@
1
- export default defineBackground(() => {
2
- console.log("Hello background!", { id: browser.runtime.id })
3
- })
1
+ export default defineBackground(() => {
2
+ console.log("Hello background!", { id: browser.runtime.id })
3
+ })
@@ -1,5 +1,5 @@
1
1
  import { mount, unmount } from "svelte"
2
- import App from "./App.svelte"
2
+ import Content from "./Content.svelte"
3
3
  import "~/assets/tailwind.css"
4
4
 
5
5
  export default defineContentScript({
@@ -13,10 +13,10 @@ export default defineContentScript({
13
13
  position: "inline",
14
14
  anchor: "body",
15
15
  onMount: container => {
16
- return mount(App, { target: container })
16
+ return mount(Content, { target: container })
17
17
  },
18
- onRemove: app => {
19
- unmount(app as any)
18
+ onRemove: content => {
19
+ unmount(content as any)
20
20
  },
21
21
  })
22
22
 
@@ -1,13 +1,13 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta name="manifest.open_in_tab" content="true" />
7
- <title>Options</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="./main.ts"></script>
12
- </body>
13
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="manifest.open_in_tab" content="true" />
7
+ <title>Options</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="./main.ts"></script>
12
+ </body>
13
+ </html>
@@ -1,8 +1,8 @@
1
1
  import { mount } from "svelte"
2
- import App from "./App.svelte"
2
+ import Options from "./Options.svelte"
3
3
  import "~/assets/tailwind.css"
4
4
 
5
- const app = mount(App, {
5
+ const app = mount(Options, {
6
6
  target: document.getElementById("app")!,
7
7
  })
8
8
 
@@ -1,13 +1,13 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Popup</title>
7
- <meta name="manifest.type" content="browser_action" />
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="./main.ts"></script>
12
- </body>
13
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Popup</title>
7
+ <meta name="manifest.type" content="browser_action" />
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="./main.ts"></script>
12
+ </body>
13
+ </html>
@@ -1,8 +1,8 @@
1
1
  import { mount } from "svelte"
2
- import App from "./App.svelte"
2
+ import Popup from "./Popup.svelte"
3
3
  import "~/assets/tailwind.css"
4
4
 
5
- const app = mount(App, {
5
+ const app = mount(Popup, {
6
6
  target: document.getElementById("app")!,
7
7
  })
8
8
 
@@ -1,69 +1,71 @@
1
- const { exec } = require("child_process")
2
-
3
- function runCommand(command) {
4
- return new Promise((resolve, reject) => {
5
- exec(command, { shell: true }, (error, stdout, stderr) => {
6
- if (error) {
7
- console.log(`❌ Error occurred: ${error.message}`)
8
- if (stderr) {
9
- console.log(`Standard Error: ${stderr.trim()}`)
10
- }
11
- return resolve(false)
12
- }
13
- if (stdout) {
14
- console.log(stdout.trim())
15
- }
16
- resolve(true)
17
- })
18
- })
19
- }
20
-
21
- async function publishAndPushOperations(packageManager, command) {
22
- console.log("Switching to main branch...")
23
- if (!await runCommand("git checkout main")) {
24
- process.exit(1)
25
- }
26
-
27
- console.log("Merging dev branch into main...")
28
- if (!await runCommand("git merge dev")) {
29
- console.log("❌ Merge conflict occurred. Please resolve it manually.")
30
- process.exit(1)
31
- }
32
-
33
- console.log("Pushing changes to GitHub...")
34
- if (!await runCommand("git push origin main")) {
35
- console.log("❌ Failed to push changes to GitHub. Please check your network connection and permissions.")
36
- process.exit(1)
37
- }
38
-
39
- console.log("✅ Successfully merged 'dev' into 'main' and pushed to GitHub!")
40
-
41
- if (command === "publish") {
42
- console.log(`Publishing package (${packageManager} publish)...`)
43
- if (!await runCommand(`${packageManager} publish`)) {
44
- console.log(`❌ ${packageManager} publish command failed.`)
45
- process.exit(1)
46
- }
47
- }
48
-
49
- console.log("Switching back to dev branch...")
50
- if (!await runCommand("git checkout dev")) {
51
- console.log("❌ Failed to switch back to the 'dev' branch.")
52
- process.exit(1)
53
- }
54
-
55
- console.log("✅ All operations completed.")
56
- }
57
-
58
- const packageManagerArg = process.argv[2]
59
- const commandArg = process.argv[3]
60
-
61
- const validManagers = ["pnpm", "npm", "yarn", "bun"]
62
- const validCommands = ["push", "publish"]
63
-
64
- if (!validManagers.includes(packageManagerArg) || !validCommands.includes(commandArg)) {
65
- console.log(`Invalid or missing arguments. Usage: node manager.cjs <package-manager> <push|publish>\nValid package managers: ${validManagers.join(", ")}`)
66
- process.exit(1)
67
- }
68
-
69
- publishAndPushOperations(packageManagerArg, commandArg)
1
+ const { exec } = require("child_process")
2
+
3
+ function runCommand(command) {
4
+ return new Promise((resolve, reject) => {
5
+ exec(command, { shell: true }, (error, stdout, stderr) => {
6
+ if (error) {
7
+ console.log(`❌ Error occurred: ${error.message}`)
8
+ if (stderr) {
9
+ console.log(`Standard Error: ${stderr.trim()}`)
10
+ }
11
+ return resolve(false)
12
+ }
13
+ if (stdout) {
14
+ console.log(stdout.trim())
15
+ }
16
+ resolve(true)
17
+ })
18
+ })
19
+ }
20
+
21
+ async function publishAndPushOperations(packageManager, command) {
22
+ console.log("Switching to main branch...")
23
+ if (!(await runCommand("git checkout main"))) {
24
+ process.exit(1)
25
+ }
26
+
27
+ console.log("Merging dev branch into main...")
28
+ if (!(await runCommand("git merge dev"))) {
29
+ console.log("❌ Merge conflict occurred. Please resolve it manually.")
30
+ process.exit(1)
31
+ }
32
+
33
+ console.log("Pushing changes to GitHub...")
34
+ if (!(await runCommand("git push origin main"))) {
35
+ console.log("❌ Failed to push changes to GitHub. Please check your network connection and permissions.")
36
+ process.exit(1)
37
+ }
38
+
39
+ console.log("✅ Successfully merged 'dev' into 'main' and pushed to GitHub!")
40
+
41
+ if (command === "publish") {
42
+ console.log(`Publishing package (${packageManager} publish)...`)
43
+ if (!(await runCommand(`${packageManager} publish`))) {
44
+ console.log(`❌ ${packageManager} publish command failed.`)
45
+ process.exit(1)
46
+ }
47
+ }
48
+
49
+ console.log("Switching back to dev branch...")
50
+ if (!(await runCommand("git checkout dev"))) {
51
+ console.log("❌ Failed to switch back to the 'dev' branch.")
52
+ process.exit(1)
53
+ }
54
+
55
+ console.log("✅ All operations completed.")
56
+ }
57
+
58
+ const packageManagerArg = process.argv[2]
59
+ const commandArg = process.argv[3]
60
+
61
+ const validManagers = ["pnpm", "npm", "yarn", "bun"]
62
+ const validCommands = ["push", "publish"]
63
+
64
+ if (!validManagers.includes(packageManagerArg) || !validCommands.includes(commandArg)) {
65
+ console.log(
66
+ `Invalid or missing arguments. Usage: node manager.cjs <package-manager> <push|publish>\nValid package managers: ${validManagers.join(", ")}`,
67
+ )
68
+ process.exit(1)
69
+ }
70
+
71
+ publishAndPushOperations(packageManagerArg, commandArg)
@@ -1,36 +1,36 @@
1
- {
2
- "name": "test1",
3
- "description": "manifest.json description",
4
- "private": false,
5
- "version": "0.0.0",
6
- "type": "module",
7
- "scripts": {
8
- "dev": "wxt",
9
- "dev:firefox": "wxt -b firefox",
10
- "build": "wxt build",
11
- "build:firefox": "wxt build -b firefox",
12
- "zip": "wxt zip",
13
- "zip:all": "bun --parallel zip zip:firefox",
14
- "zip:firefox": "wxt zip -b firefox",
15
- "check": "svelte-check --tsconfig ./tsconfig.json",
16
- "postinstall": "wxt prepare",
17
- "resize": "bunx @kunver/resize",
18
- "manager": "bun manager.cjs bun"
19
- },
20
- "devDependencies": {
21
- "@tailwindcss/vite": "^4.1.18",
22
- "@tsconfig/svelte": "^5.0.8",
23
- "@wxt-dev/module-svelte": "^2.0.4",
24
- "svelte": "^5.51.3",
25
- "svelte-check": "^4.4.0",
26
- "tailwindcss": "^4.1.18",
27
- "tslib": "^2.8.1",
28
- "typescript": "^5.9.3",
29
- "wxt": "^0.20.17"
30
- },
31
- "trustedDependencies": [
32
- "@tailwindcss/oxide",
33
- "esbuild",
34
- "spawn-sync"
35
- ]
36
- }
1
+ {
2
+ "name": "test1",
3
+ "description": "manifest.json description",
4
+ "private": false,
5
+ "version": "0.0.0",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "wxt",
9
+ "dev:firefox": "wxt -b firefox",
10
+ "build": "wxt build",
11
+ "build:firefox": "wxt build -b firefox",
12
+ "zip": "wxt zip",
13
+ "zip:all": "bun --parallel zip zip:firefox",
14
+ "zip:firefox": "wxt zip -b firefox",
15
+ "check": "svelte-check --tsconfig ./tsconfig.json",
16
+ "postinstall": "wxt prepare",
17
+ "resize": "bunx @kunver/resize",
18
+ "manager": "bun manager.cjs bun"
19
+ },
20
+ "devDependencies": {
21
+ "@tailwindcss/vite": "^4.1.18",
22
+ "@tsconfig/svelte": "^5.0.8",
23
+ "@wxt-dev/module-svelte": "^2.0.4",
24
+ "svelte": "^5.51.3",
25
+ "svelte-check": "^4.4.0",
26
+ "tailwindcss": "^4.1.18",
27
+ "tslib": "^2.8.1",
28
+ "typescript": "^5.9.3",
29
+ "wxt": "^0.20.17"
30
+ },
31
+ "trustedDependencies": [
32
+ "@tailwindcss/oxide",
33
+ "esbuild",
34
+ "spawn-sync"
35
+ ]
36
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "./.wxt/tsconfig.json",
3
- "compilerOptions": {
4
- "useDefineForClassFields": true
5
- }
6
- }
1
+ {
2
+ "extends": "./.wxt/tsconfig.json",
3
+ "compilerOptions": {
4
+ "useDefineForClassFields": true
5
+ }
6
+ }
@@ -1 +1 @@
1
- /// <reference types="svelte" />
1
+ /// <reference types="svelte" />