@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.
- package/README.MD +26 -18
- package/dist/index.js +16 -10
- package/dist/templates/cmake-cpp/.clang-format +1 -0
- package/dist/templates/cmake-cpp/CMakeLists.txt +14 -0
- package/dist/templates/cmake-cpp/README.md +32 -0
- package/dist/templates/cmake-cpp/_clang-format +1 -0
- package/dist/templates/cmake-cpp/_gitignore +9 -0
- package/dist/templates/cmake-cpp/agents.md +8 -0
- package/dist/templates/{make-cpp → cmake-cpp}/include/example.hpp +1 -1
- package/dist/templates/cmake-cpp/manager.ts +276 -0
- package/dist/templates/{make-cpp → cmake-cpp}/src/main.cpp +1 -1
- package/dist/templates/electron-svelte/.vscode/launch.json +39 -39
- package/dist/templates/electron-svelte/.vscode/settings.json +15 -15
- package/dist/templates/next-prisma/README.md +11 -11
- package/dist/templates/next-prisma/_prettierrc.json +12 -0
- package/dist/templates/next-prisma/app/globals.css +1 -1
- package/dist/templates/next-prisma/app/layout.tsx +21 -21
- package/dist/templates/next-prisma/app/page.tsx +7 -7
- package/dist/templates/next-prisma/lib/prisma.ts +11 -11
- package/dist/templates/next-prisma/manager.cjs +71 -69
- package/dist/templates/next-prisma/next.config.ts +7 -7
- package/dist/templates/next-prisma/package.json +33 -33
- package/dist/templates/next-prisma/postcss.config.mjs +5 -5
- package/dist/templates/next-prisma/tsconfig.json +27 -27
- package/dist/templates/react-ts-tw/README.md +1 -1
- package/dist/templates/react-ts-tw/_prettierrc.json +12 -0
- package/dist/templates/react-ts-tw/index.html +13 -13
- package/dist/templates/react-ts-tw/manager.cjs +71 -69
- package/dist/templates/react-ts-tw/package.json +30 -30
- package/dist/templates/react-ts-tw/src/App.tsx +9 -9
- package/dist/templates/react-ts-tw/src/index.css +1 -1
- package/dist/templates/react-ts-tw/src/main.tsx +10 -10
- package/dist/templates/react-ts-tw/src/vite-env.d.ts +1 -1
- package/dist/templates/react-ts-tw/tsconfig.app.json +27 -27
- package/dist/templates/react-ts-tw/tsconfig.json +4 -7
- package/dist/templates/react-ts-tw/tsconfig.node.json +25 -25
- package/dist/templates/react-ts-tw/vite.config.ts +8 -8
- package/dist/templates/wxt-solid/README.md +3 -3
- package/dist/templates/wxt-solid/_prettierrc.json +11 -0
- package/dist/templates/wxt-solid/agents.md +76 -76
- package/dist/templates/wxt-solid/assets/tailwind.css +1 -1
- package/dist/templates/wxt-solid/entrypoints/background.ts +3 -3
- package/dist/templates/wxt-solid/entrypoints/content/Content.tsx +7 -7
- package/dist/templates/wxt-solid/entrypoints/content/main.tsx +31 -31
- package/dist/templates/wxt-solid/entrypoints/options/{App.tsx → Options.tsx} +0 -1
- package/dist/templates/wxt-solid/entrypoints/options/index.html +13 -13
- package/dist/templates/wxt-solid/entrypoints/options/main.tsx +2 -2
- package/dist/templates/wxt-solid/entrypoints/popup/index.html +13 -13
- package/dist/templates/wxt-solid/entrypoints/popup/main.tsx +2 -2
- package/dist/templates/wxt-solid/manager.cjs +71 -69
- package/dist/templates/wxt-solid/package.json +33 -33
- package/dist/templates/wxt-solid/tsconfig.json +7 -7
- package/dist/templates/wxt-solid/wxt.config.ts +18 -18
- package/dist/templates/wxt-svelte/.vscode/extensions.json +3 -3
- package/dist/templates/wxt-svelte/README.md +3 -3
- package/dist/templates/wxt-svelte/_prettierrc.json +11 -0
- package/dist/templates/wxt-svelte/agents.md +77 -77
- package/dist/templates/wxt-svelte/assets/tailwind.css +1 -1
- package/dist/templates/wxt-svelte/entrypoints/background.ts +3 -3
- package/dist/templates/wxt-svelte/entrypoints/content/index.ts +4 -4
- package/dist/templates/wxt-svelte/entrypoints/options/index.html +13 -13
- package/dist/templates/wxt-svelte/entrypoints/options/main.ts +2 -2
- package/dist/templates/wxt-svelte/entrypoints/popup/index.html +13 -13
- package/dist/templates/wxt-svelte/entrypoints/popup/main.ts +2 -2
- package/dist/templates/wxt-svelte/manager.cjs +71 -69
- package/dist/templates/wxt-svelte/package.json +36 -36
- package/dist/templates/wxt-svelte/tsconfig.json +6 -6
- package/dist/templates/wxt-svelte/wxt-env.d.ts +1 -1
- package/dist/templates/wxt-svelte/wxt.config.ts +18 -18
- package/dist/templates/wxt-vanilla/README.md +3 -3
- package/dist/templates/wxt-vanilla/_prettierrc.json +11 -0
- package/dist/templates/wxt-vanilla/agents.md +73 -73
- package/dist/templates/wxt-vanilla/entrypoints/background.ts +3 -3
- package/dist/templates/wxt-vanilla/entrypoints/content.ts +6 -6
- package/dist/templates/wxt-vanilla/entrypoints/popup/index.html +13 -13
- package/dist/templates/wxt-vanilla/entrypoints/popup/main.ts +1 -1
- package/dist/templates/wxt-vanilla/manager.cjs +71 -69
- package/dist/templates/wxt-vanilla/package.json +25 -25
- package/dist/templates/wxt-vanilla/tsconfig.json +3 -3
- package/dist/templates/wxt-vanilla/wxt.config.ts +13 -13
- package/package.json +18 -5
- package/dist/templates/electron-svelte/README.md +0 -3
- package/dist/templates/electron-svelte/_gitignore +0 -6
- package/dist/templates/electron-svelte/build/entitlements.mac.plist +0 -12
- package/dist/templates/electron-svelte/build/icon.icns +0 -0
- package/dist/templates/electron-svelte/build/icon.ico +0 -0
- package/dist/templates/electron-svelte/build/icon.png +0 -0
- package/dist/templates/electron-svelte/bun.lock +0 -1154
- package/dist/templates/electron-svelte/electron-builder.yml +0 -44
- package/dist/templates/electron-svelte/electron.vite.config.ts +0 -15
- package/dist/templates/electron-svelte/manager.cjs +0 -69
- package/dist/templates/electron-svelte/package.json +0 -44
- package/dist/templates/electron-svelte/resources/icon.png +0 -0
- package/dist/templates/electron-svelte/src/main/index.ts +0 -62
- package/dist/templates/electron-svelte/src/preload/index.d.ts +0 -8
- package/dist/templates/electron-svelte/src/preload/index.ts +0 -22
- package/dist/templates/electron-svelte/src/renderer/index.html +0 -16
- package/dist/templates/electron-svelte/src/renderer/src/App.svelte +0 -8
- package/dist/templates/electron-svelte/src/renderer/src/assets/main.css +0 -1
- package/dist/templates/electron-svelte/src/renderer/src/env.d.ts +0 -2
- package/dist/templates/electron-svelte/src/renderer/src/main.ts +0 -11
- package/dist/templates/electron-svelte/svelte.config.mjs +0 -7
- package/dist/templates/electron-svelte/tsconfig.json +0 -4
- package/dist/templates/electron-svelte/tsconfig.node.json +0 -11
- package/dist/templates/electron-svelte/tsconfig.web.json +0 -17
- package/dist/templates/make-cpp/Makefile +0 -44
- package/dist/templates/make-cpp/README.md +0 -15
- /package/dist/templates/{make-cpp → cmake-cpp}/src/example.cpp +0 -0
- /package/dist/templates/wxt-solid/entrypoints/popup/{App.tsx → Popup.tsx} +0 -0
- /package/dist/templates/wxt-svelte/entrypoints/content/{App.svelte → Content.svelte} +0 -0
- /package/dist/templates/wxt-svelte/entrypoints/options/{App.svelte → Options.svelte} +0 -0
- /package/dist/templates/wxt-svelte/entrypoints/popup/{App.svelte → Popup.svelte} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { StrictMode } from
|
|
2
|
-
import { createRoot } from
|
|
3
|
-
import
|
|
4
|
-
import App from
|
|
5
|
-
|
|
6
|
-
createRoot(document.getElementById(
|
|
7
|
-
<StrictMode>
|
|
8
|
-
<App />
|
|
9
|
-
</StrictMode>,
|
|
10
|
-
)
|
|
1
|
+
import { StrictMode } from "react"
|
|
2
|
+
import { createRoot } from "react-dom/client"
|
|
3
|
+
import "./index.css"
|
|
4
|
+
import App from "./App.tsx"
|
|
5
|
+
|
|
6
|
+
createRoot(document.getElementById("root")!).render(
|
|
7
|
+
<StrictMode>
|
|
8
|
+
<App />
|
|
9
|
+
</StrictMode>,
|
|
10
|
+
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
-
"target": "ES2022",
|
|
5
|
-
"useDefineForClassFields": true,
|
|
6
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
-
"module": "ESNext",
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
|
|
10
|
-
/* Bundler mode */
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"allowImportingTsExtensions": true,
|
|
13
|
-
"verbatimModuleSyntax": true,
|
|
14
|
-
"moduleDetection": "force",
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"jsx": "react-jsx",
|
|
17
|
-
|
|
18
|
-
/* Linting */
|
|
19
|
-
"strict": true,
|
|
20
|
-
"noUnusedLocals": true,
|
|
21
|
-
"noUnusedParameters": true,
|
|
22
|
-
"erasableSyntaxOnly": true,
|
|
23
|
-
"noFallthroughCasesInSwitch": true,
|
|
24
|
-
"noUncheckedSideEffectImports": true
|
|
25
|
-
},
|
|
26
|
-
"include": ["src"]
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
|
|
18
|
+
/* Linting */
|
|
19
|
+
"strict": true,
|
|
20
|
+
"noUnusedLocals": true,
|
|
21
|
+
"noUnusedParameters": true,
|
|
22
|
+
"erasableSyntaxOnly": true,
|
|
23
|
+
"noFallthroughCasesInSwitch": true,
|
|
24
|
+
"noUncheckedSideEffectImports": true
|
|
25
|
+
},
|
|
26
|
+
"include": ["src"]
|
|
27
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
-
"target": "ES2023",
|
|
5
|
-
"lib": ["ES2023"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
"moduleDetection": "force",
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
|
|
16
|
-
/* Linting */
|
|
17
|
-
"strict": true,
|
|
18
|
-
"noUnusedLocals": true,
|
|
19
|
-
"noUnusedParameters": true,
|
|
20
|
-
"erasableSyntaxOnly": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
|
22
|
-
"noUncheckedSideEffectImports": true
|
|
23
|
-
},
|
|
24
|
-
"include": ["vite.config.ts"]
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"erasableSyntaxOnly": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["vite.config.ts"]
|
|
25
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import tailwindcss from "@tailwindcss/vite"
|
|
2
|
-
import { defineConfig } from
|
|
3
|
-
import react from
|
|
4
|
-
|
|
5
|
-
// https://vite.dev/config/
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [react(), tailwindcss()],
|
|
8
|
-
})
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite"
|
|
2
|
+
import { defineConfig } from "vite"
|
|
3
|
+
import react from "@vitejs/plugin-react-swc"
|
|
4
|
+
|
|
5
|
+
// https://vite.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react(), tailwindcss()],
|
|
8
|
+
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# WXT + SolidJS
|
|
2
|
-
|
|
3
|
-
This template should help get you started developing with SolidJS in WXT.
|
|
1
|
+
# WXT + SolidJS
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with SolidJS in WXT.
|
|
@@ -1,76 +1,76 @@
|
|
|
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 SolidJS 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
|
-
- I should have a .prettierrc.json file in the root directory. please also follow rules on that.
|
|
34
|
-
|
|
35
|
-
- entrypoints are in src/entrypoints directory
|
|
36
|
-
|
|
37
|
-
## Storage
|
|
38
|
-
|
|
39
|
-
- When we need storage we should use WXT Storage, you should import it from "#imports".
|
|
40
|
-
- Please check project if I already defined a store
|
|
41
|
-
- use "local:" prefix when storing data locally
|
|
42
|
-
|
|
43
|
-
## Storage
|
|
44
|
-
|
|
45
|
-
- When we need storage we should use WXT Storage, you should import it from "#imports".
|
|
46
|
-
- Please check project if I already defined a store
|
|
47
|
-
- use "local:" prefix when storing data locally
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
// utils/storage.ts
|
|
51
|
-
import { storage } from "#imports"
|
|
52
|
-
const showChangelogOnUpdate = storage.defineItem<boolean>("local:showChangelogOnUpdate", {
|
|
53
|
-
fallback: true,
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
// usage
|
|
57
|
-
await showChangelogOnUpdate.getValue()
|
|
58
|
-
await showChangelogOnUpdate.setValue(false)
|
|
59
|
-
await showChangelogOnUpdate.removeValue()
|
|
60
|
-
const unwatch = showChangelogOnUpdate.watch(newValue => {
|
|
61
|
-
// ...
|
|
62
|
-
})
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## i18n usage
|
|
66
|
-
|
|
67
|
-
- when needed, use @wxt-dev/i18n, and import from "#i18n"
|
|
68
|
-
- translations will be in <srcDir>/locales/ directory, and will be yml files.
|
|
69
|
-
|
|
70
|
-
- usage example
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
import { i18n } from "#i18n"
|
|
74
|
-
|
|
75
|
-
i18n.t("helloWorld") // "Hello world!"
|
|
76
|
-
```
|
|
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 SolidJS 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
|
+
- I should have a .prettierrc.json file in the root directory. please also follow rules on that.
|
|
34
|
+
|
|
35
|
+
- entrypoints are in src/entrypoints directory
|
|
36
|
+
|
|
37
|
+
## Storage
|
|
38
|
+
|
|
39
|
+
- When we need storage we should use WXT Storage, you should import it from "#imports".
|
|
40
|
+
- Please check project if I already defined a store
|
|
41
|
+
- use "local:" prefix when storing data locally
|
|
42
|
+
|
|
43
|
+
## Storage
|
|
44
|
+
|
|
45
|
+
- When we need storage we should use WXT Storage, you should import it from "#imports".
|
|
46
|
+
- Please check project if I already defined a store
|
|
47
|
+
- use "local:" prefix when storing data locally
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// utils/storage.ts
|
|
51
|
+
import { storage } from "#imports"
|
|
52
|
+
const showChangelogOnUpdate = storage.defineItem<boolean>("local:showChangelogOnUpdate", {
|
|
53
|
+
fallback: true,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// usage
|
|
57
|
+
await showChangelogOnUpdate.getValue()
|
|
58
|
+
await showChangelogOnUpdate.setValue(false)
|
|
59
|
+
await showChangelogOnUpdate.removeValue()
|
|
60
|
+
const unwatch = showChangelogOnUpdate.watch(newValue => {
|
|
61
|
+
// ...
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## i18n usage
|
|
66
|
+
|
|
67
|
+
- when needed, use @wxt-dev/i18n, and import from "#i18n"
|
|
68
|
+
- translations will be in <srcDir>/locales/ directory, and will be yml files.
|
|
69
|
+
|
|
70
|
+
- usage example
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { i18n } from "#i18n"
|
|
74
|
+
|
|
75
|
+
i18n.t("helloWorld") // "Hello world!"
|
|
76
|
+
```
|
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
export default function Content() {
|
|
2
|
-
return (
|
|
3
|
-
<div style={{ padding: "20px", "font-family": "sans-serif" }}>
|
|
4
|
-
|
|
5
|
-
</div>
|
|
6
|
-
)
|
|
7
|
-
}
|
|
1
|
+
export default function Content() {
|
|
2
|
+
return (
|
|
3
|
+
<div style={{ padding: "20px", "font-family": "sans-serif" }}>
|
|
4
|
+
<h1>Hello, Content!</h1>
|
|
5
|
+
</div>
|
|
6
|
+
)
|
|
7
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
// 1. Import the style
|
|
2
|
-
import "~/assets/tailwind.css"
|
|
3
|
-
import { render } from "solid-js/web"
|
|
4
|
-
import Content from "./Content"
|
|
5
|
-
|
|
6
|
-
export default defineContentScript({
|
|
7
|
-
matches: ["<all_urls>"],
|
|
8
|
-
// 2. Set cssInjectionMode
|
|
9
|
-
cssInjectionMode: "ui",
|
|
10
|
-
|
|
11
|
-
async main(ctx) {
|
|
12
|
-
// 3. Define your UI
|
|
13
|
-
const ui = await createShadowRootUi(ctx, {
|
|
14
|
-
name: "example-ui",
|
|
15
|
-
position: "inline",
|
|
16
|
-
anchor: "body",
|
|
17
|
-
onMount: container => {
|
|
18
|
-
// Render your app to the UI container
|
|
19
|
-
const unmount = render(() => <Content />, container)
|
|
20
|
-
return unmount
|
|
21
|
-
},
|
|
22
|
-
onRemove: unmount => {
|
|
23
|
-
// Unmount the app when the UI is removed
|
|
24
|
-
unmount?.()
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
// 4. Mount the UI
|
|
29
|
-
ui.mount()
|
|
30
|
-
},
|
|
31
|
-
})
|
|
1
|
+
// 1. Import the style
|
|
2
|
+
import "~/assets/tailwind.css"
|
|
3
|
+
import { render } from "solid-js/web"
|
|
4
|
+
import Content from "./Content"
|
|
5
|
+
|
|
6
|
+
export default defineContentScript({
|
|
7
|
+
matches: ["<all_urls>"],
|
|
8
|
+
// 2. Set cssInjectionMode
|
|
9
|
+
cssInjectionMode: "ui",
|
|
10
|
+
|
|
11
|
+
async main(ctx) {
|
|
12
|
+
// 3. Define your UI
|
|
13
|
+
const ui = await createShadowRootUi(ctx, {
|
|
14
|
+
name: "example-ui",
|
|
15
|
+
position: "inline",
|
|
16
|
+
anchor: "body",
|
|
17
|
+
onMount: container => {
|
|
18
|
+
// Render your app to the UI container
|
|
19
|
+
const unmount = render(() => <Content />, container)
|
|
20
|
+
return unmount
|
|
21
|
+
},
|
|
22
|
+
onRemove: unmount => {
|
|
23
|
+
// Unmount the app when the UI is removed
|
|
24
|
+
unmount?.()
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
// 4. Mount the UI
|
|
29
|
+
ui.mount()
|
|
30
|
+
},
|
|
31
|
+
})
|
|
@@ -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>Options</title>
|
|
7
|
-
<meta name="manifest.open_in_tab" content="true" />
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="./main.tsx"></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>Options</title>
|
|
7
|
+
<meta name="manifest.open_in_tab" content="true" />
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="./main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -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>Default Popup Title</title>
|
|
7
|
-
<meta name="manifest.type" content="browser_action" />
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="./main.tsx"></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>Default Popup Title</title>
|
|
7
|
+
<meta name="manifest.type" content="browser_action" />
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="./main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
const { exec } = require("child_process")
|
|
2
|
-
|
|
3
|
-
function runCommand(command) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function publishAndPushOperations(packageManager, command) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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)
|