@kunver/new 2.12.0 → 2.14.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 +6 -3
- package/dist/index.js +2 -2
- package/dist/templates/wxt-solid/README.md +3 -0
- package/dist/templates/wxt-solid/_gitignore +26 -0
- package/dist/templates/wxt-solid/agents.md +76 -0
- package/dist/templates/wxt-solid/bun.lock +1045 -0
- package/dist/templates/wxt-solid/entrypoints/content/Content.tsx +7 -0
- package/dist/templates/wxt-solid/entrypoints/content/main.tsx +31 -0
- package/dist/templates/wxt-solid/entrypoints/options/App.tsx +8 -0
- package/dist/templates/wxt-solid/entrypoints/options/index.html +13 -0
- package/dist/templates/wxt-solid/entrypoints/options/main.tsx +6 -0
- package/dist/templates/wxt-solid/entrypoints/popup/App.tsx +7 -0
- package/dist/templates/wxt-solid/entrypoints/popup/index.html +13 -0
- package/dist/templates/wxt-solid/entrypoints/popup/main.tsx +6 -0
- package/dist/templates/wxt-solid/manager.cjs +69 -0
- package/dist/templates/wxt-solid/package.json +33 -0
- package/dist/templates/wxt-solid/public/icon/128.png +0 -0
- package/dist/templates/wxt-solid/public/icon/16.png +0 -0
- package/dist/templates/wxt-solid/public/icon/32.png +0 -0
- package/dist/templates/wxt-solid/public/icon/48.png +0 -0
- package/dist/templates/wxt-solid/public/icon/96.png +0 -0
- package/dist/templates/wxt-solid/tsconfig.json +7 -0
- package/dist/templates/wxt-solid/wxt.config.ts +18 -0
- package/dist/templates/wxt-svelte/agents.md +16 -2
- package/dist/templates/wxt-svelte/assets/tailwind.css +1 -0
- package/dist/templates/wxt-svelte/entrypoints/background.ts +3 -0
- package/dist/templates/wxt-svelte/package.json +1 -1
- package/dist/templates/wxt-svelte/wxt.config.ts +1 -2
- package/dist/templates/wxt-vanilla/agents.md +73 -0
- package/dist/templates/wxt-vanilla/package.json +2 -2
- package/dist/templates/wxt-vanilla/wxt.config.ts +1 -0
- package/package.json +42 -42
- /package/dist/templates/{wxt-svelte/src → wxt-solid}/assets/tailwind.css +0 -0
- /package/dist/templates/{wxt-svelte/src → wxt-solid}/entrypoints/background.ts +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/content/App.svelte +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/content/index.ts +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/options/App.svelte +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/options/index.html +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/options/main.ts +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/popup/App.svelte +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/popup/index.html +0 -0
- /package/dist/templates/wxt-svelte/{src/entrypoints → entrypoints}/popup/main.ts +0 -0
package/README.MD
CHANGED
|
@@ -19,6 +19,8 @@ pnpx | npx | bunx @kunver/new
|
|
|
19
19
|
|
|
20
20
|
✅ Wxt + Svelte
|
|
21
21
|
|
|
22
|
+
✅ Wxt + Vanilla
|
|
23
|
+
|
|
22
24
|
✅ Next.js + Prisma
|
|
23
25
|
|
|
24
26
|
✅ Python Jupyter Notebook
|
|
@@ -27,6 +29,7 @@ pnpx | npx | bunx @kunver/new
|
|
|
27
29
|
|
|
28
30
|
### Will be added
|
|
29
31
|
|
|
30
|
-
🟡 Wxt
|
|
31
|
-
|
|
32
|
-
🟡
|
|
32
|
+
🟡 Wxt Solid
|
|
33
|
+
🟡 C++ CMake
|
|
34
|
+
🟡 Rust
|
|
35
|
+
🟡 Rust Tauri
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import J,{readFileSync,constants,promises}from'fs';import S,{dirname,join}from'path';import {input,select}from'@inquirer/prompts';import i from'chalk';import {access,mkdir,writeFile,readFile}from'fs/promises';import {spawn}from'child_process';import O from'ora';import {execa}from'execa';import {fileURLToPath}from'url';async function g(e){let{name:o,cwd:t=process.cwd()}=e,a=join(t,o);try{await access(a,constants.F_OK);}catch{await mkdir(a,{recursive:true});}let r=join(a,"main.ipynb");await writeFile(r,"");}var P=["react-ts-tw","next-ts-prisma","wxt...","electron-svelte","python-notebook","cpp-makefile"],M=["bun","pnpm","npm"],F=["antigravity","no","cursor","code"],E=["svelte","vanilla"];async function m(e,o,t){switch(e){case "pnpm":return await R(o,t);case "bun":return await X(o,t);default:return false}}async function R(e,o){let t=O("Approving builds for "+i.blue(e)).start();try{return new Promise(a=>{let r=spawn("pnpm",["approve-builds"],{cwd:`${o}/${e}`,stdio:["pipe","inherit","inherit"],shell:!0});setTimeout(()=>{r.stdin?.write(`a
|
|
1
|
+
import J,{readFileSync,constants,promises}from'fs';import S,{dirname,join}from'path';import {input,select}from'@inquirer/prompts';import i from'chalk';import {access,mkdir,writeFile,readFile}from'fs/promises';import {spawn}from'child_process';import O from'ora';import {execa}from'execa';import {fileURLToPath}from'url';async function g(e){let{name:o,cwd:t=process.cwd()}=e,a=join(t,o);try{await access(a,constants.F_OK);}catch{await mkdir(a,{recursive:true});}let r=join(a,"main.ipynb");await writeFile(r,"");}var P=["react-ts-tw","next-ts-prisma","wxt...","electron-svelte","python-notebook","cpp-makefile"],M=["bun","pnpm","npm"],F=["antigravity","windsurf","no","cursor","code"],E=["svelte","vanilla","solid"];async function m(e,o,t){switch(e){case "pnpm":return await R(o,t);case "bun":return await X(o,t);default:return false}}async function R(e,o){let t=O("Approving builds for "+i.blue(e)).start();try{return new Promise(a=>{let r=spawn("pnpm",["approve-builds"],{cwd:`${o}/${e}`,stdio:["pipe","inherit","inherit"],shell:!0});setTimeout(()=>{r.stdin?.write(`a
|
|
2
2
|
`),setTimeout(()=>{r.stdin?.write(`y
|
|
3
3
|
`),r.stdin?.end();},1e3);},2e3),r.on("close",n=>{n===0?(t.succeed("Approved builds for "+i.blue(e)),a(!0)):(t.fail("Failed to approve builds for "+i.blue(e)),a(!1));}),r.on("error",n=>{t.fail("Failed to approve builds for "+i.blue(e)),console.error(n),a(!1);});})}catch(a){return t.fail("Failed to approve builds for "+i.blue(e)),console.error(a),false}}async function X(e,o){let t=`cd ${e} && bun pm trust --all`,a=O("Approving builds for "+i.blue(e)).start();try{return await execa(t,{shell:!0,cwd:o}),a.succeed("Approved builds for "+i.blue(e)),!0}catch{return a.fail("Failed to approve builds for "+i.blue(e)),false}}async function u(e,o,t){let a=`cd ${o} && ${e} install`;console.log("Installing dependencies with "+i.cyan(e)+`
|
|
4
4
|
`);try{return await execa(a,{shell:!0,cwd:t,stdout:"inherit",stderr:"inherit"}),!0}catch{return false}}async function w(e,o){let t=O("Copying template folder...").start();try{await promises.cp(e,o,{recursive:!0});let a=S.join(o,"_gitignore"),r=S.join(o,".gitignore");try{await promises.rename(a,r);}catch{}return t.succeed("Copied template folder"),!0}catch{return t.fail("Failed to copy template folder"),false}}async function y(e,o,t){let a=join(t,o,"package.json"),r=await J.promises.readFile(a,"utf-8"),n=JSON.parse(r);e==="bun"?n.scripts.manager=`bun manager.cjs ${e}`:n.scripts.manager=`node manager.cjs ${e}`,await J.promises.writeFile(a,JSON.stringify(n,null,2));}async function b(e,o,t){console.log(i.white("Opening "+i.blue(e)+" in "+i.green(t)));try{return await execa(`${t} ${e}`,{shell:!0,cwd:o}),!0}catch(a){return console.error(i.red("Failed to open project in editor:"),a),false}}async function s(e){let{templateName:o,name:t,packageManager:a,cwd:r=process.cwd(),addManager:n=true,changeName:p=true,approveBuild:l=true,installDependency:A=true}=e,_=join(__dirname,"templates",o);try{if(!await w(_,join(r,t)))throw new Error("Failed to copy template folder");if(A&&!await u(a,t,r))throw new Error("Failed to install dependencies");return n&&await y(a,t,r),l&&await m(a,t,r),p&&await k(join(r,t),t),!0}catch(f){throw console.error("Error creating project:",f),f}}async function k(e,o){try{let t=join(e,"package.json"),a=await readFile(t,"utf-8"),r=JSON.parse(a);return r.name=o.toLowerCase().replace(/\s+/g,"-"),await writeFile(t,JSON.stringify(r,null,2)+`
|
|
5
|
-
`),!0}catch(t){return console.error("Error updating project name:",t),false}}async function T(e){let{name:o,packageManager:t,selectedFramework:a}=e;try{let r=E,n=r.includes("
|
|
5
|
+
`),!0}catch(t){return console.error("Error updating project name:",t),false}}async function T(e){let{name:o,packageManager:t,selectedFramework:a}=e;try{let r=E,n=r.includes("svelte")?"svelte":r[0],p;switch(a&&r.includes(a)?p=a:p=await select({message:i.bold.magenta("Select a framework for WXT"),choices:r.map(l=>({name:l.charAt(0).toUpperCase()+l.slice(1),value:l})),default:n}),p){case "svelte":await s({templateName:"wxt-svelte",name:o,packageManager:t});break;case "solid":await s({templateName:"wxt-solid",name:o,packageManager:t});break;case "vanilla":await s({templateName:"wxt-vanilla",name:o,packageManager:t});break;default:break}}catch(r){console.error(r);}}async function j(e){switch(e.projectType){case "react-ts-tw":await s({templateName:"react-ts-tw",name:e.name,packageManager:e.packageManager});break;case "next-ts-prisma":await s({templateName:"next-ts-prisma",name:e.name,packageManager:e.packageManager});break;case "wxt...":await T({name:e.name,packageManager:e.packageManager});break;case "electron-svelte":await s({templateName:"electron-svelte",name:e.name,packageManager:e.packageManager,installDependency:false,approveBuild:false}),console.log(i.yellow("Dependencies not installed. Please install dependencies manually"));break;case "python-notebook":await g({name:e.name});break;case "cpp-makefile":await s({templateName:"make-cpp",name:e.name,packageManager:"bun",addManager:false,approveBuild:false,installDependency:false});default:console.log(i.red("Project Type Not Implemented"),e.projectType);break}e.openInEditor!=="no"&&await b(e.name,process.cwd(),e.openInEditor);}var le=fileURLToPath(import.meta.url),me=dirname(le),de=join(me,"../package.json"),fe=JSON.parse(readFileSync(de,"utf8")),ge=fe.version;console.log(i.green("Kunver v"+i.bold(ge)+`
|
|
6
6
|
`));var ue=await input({message:i.bold.blue("Enter a project name"),default:i.gray("my-project"),validate:e=>!e||e.trim().length<2?i.red("Project name must be at least 2 characters"):/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)?J.existsSync(S.resolve(process.cwd(),e))?i.red("A folder with that name already exists"):true:i.red("Only lowercase letters, numbers, and single hyphens allowed. No spaces or special characters.")}),$=await select({message:i.bold.yellow("Select a project type"),default:"react-ts-tw",choices:P}),B="bun";$!=="python-notebook"&&(B=await select({message:i.bold.green("Select a package manager"),choices:M,default:"bun"}));var we=await select({message:i.bold.cyan("Open in editor?"),choices:F,default:"no"}),ye={projectType:$,packageManager:B,name:ue,openInEditor:we};await j(ye);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
.output
|
|
12
|
+
stats.html
|
|
13
|
+
stats-*.json
|
|
14
|
+
.wxt
|
|
15
|
+
web-ext.config.ts
|
|
16
|
+
|
|
17
|
+
# Editor directories and files
|
|
18
|
+
.vscode/*
|
|
19
|
+
!.vscode/extensions.json
|
|
20
|
+
.idea
|
|
21
|
+
.DS_Store
|
|
22
|
+
*.suo
|
|
23
|
+
*.ntvs*
|
|
24
|
+
*.njsproj
|
|
25
|
+
*.sln
|
|
26
|
+
*.sw?
|
|
@@ -0,0 +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
|
+
```
|