@kunver/new 2.2.0 → 2.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/dist/index.js +2 -2
- package/dist/templates/wxt-vanilla/.prettierrc.json +11 -0
- package/dist/templates/wxt-vanilla/entrypoints/background.ts +3 -0
- package/dist/templates/wxt-vanilla/entrypoints/content.ts +6 -0
- package/dist/templates/wxt-vanilla/entrypoints/popup/index.html +13 -0
- package/dist/templates/wxt-vanilla/entrypoints/popup/main.ts +1 -0
- package/dist/templates/wxt-vanilla/entrypoints/popup/style.css +0 -0
- package/dist/templates/wxt-vanilla/manager.cjs +69 -0
- package/dist/templates/wxt-vanilla/package.json +21 -0
- package/dist/templates/wxt-vanilla/public/icon/128.png +0 -0
- package/dist/templates/wxt-vanilla/public/icon/16.png +0 -0
- package/dist/templates/wxt-vanilla/public/icon/32.png +0 -0
- package/dist/templates/wxt-vanilla/public/icon/48.png +0 -0
- package/dist/templates/wxt-vanilla/public/icon/96.png +0 -0
- package/dist/templates/wxt-vanilla/tsconfig.json +3 -0
- package/dist/templates/wxt-vanilla/wxt.config.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import ae from"fs";import oe from"path";import{input as ne,select as
|
|
2
|
+
import ae from"fs";import oe from"path";import{input as ne,select as k}from"@inquirer/prompts";import p from"chalk";import U,{join as j}from"path";import{fileURLToPath as z}from"url";import{execa as B}from"execa";import w from"chalk";import C from"ora";async function s(e,r,a){let t;switch(e){case"pnpm":t=`cd ${r} && pnpm install`;break;case"npm":t=`cd ${r} && npm install`;break;case"bun":t=`cd ${r} && bun install`;break;default:t=`cd ${r} && pnpm install`}let o=C("Installing dependencies with "+w.blue(e)).start();try{return await B(t,{shell:!0,cwd:a}),o.succeed("Installed dependencies for "+w.blue(r)),!0}catch{return o.fail("Failed to install dependencies for "+w.blue(r)),!1}}import D from"fs-extra";import R from"ora";async function c(e,r){let a=R("Copying template folder...").start();try{return await D.copy(e,r),a.succeed("Copied template folder"),!0}catch{return a.fail("Failed to copy template folder"),!1}}import{spawn as W}from"child_process";import T from"ora";import i from"chalk";import{execa as J}from"execa";async function l(e,r){let a=T("Approving builds for "+i.blue(e)).start();try{return new Promise(t=>{let o=W("pnpm",["approve-builds"],{cwd:`${r}/${e}`,stdio:["pipe","inherit","inherit"],shell:!0});setTimeout(()=>{o.stdin?.write(`a
|
|
3
3
|
`),setTimeout(()=>{o.stdin?.write(`y
|
|
4
|
-
`),o.stdin?.end()},1e3)},2e3),o.on("close",n=>{n===0?(a.succeed("Approved builds for "+i.blue(e)),t(!0)):(a.fail("Failed to approve builds for "+i.blue(e)),t(!1))}),o.on("error",n=>{a.fail("Failed to approve builds for "+i.blue(e)),console.error(n),t(!1)})})}catch(t){return a.fail("Failed to approve builds for "+i.blue(e)),console.error(t),!1}}async function m(e,r){let a=`cd ${e} && bun pm trust --all`,t=
|
|
4
|
+
`),o.stdin?.end()},1e3)},2e3),o.on("close",n=>{n===0?(a.succeed("Approved builds for "+i.blue(e)),t(!0)):(a.fail("Failed to approve builds for "+i.blue(e)),t(!1))}),o.on("error",n=>{a.fail("Failed to approve builds for "+i.blue(e)),console.error(n),t(!1)})})}catch(t){return a.fail("Failed to approve builds for "+i.blue(e)),console.error(t),!1}}async function m(e,r){let a=`cd ${e} && bun pm trust --all`,t=T("Approving builds for "+i.blue(e)).start();try{return await J(a,{shell:!0,cwd:r}),t.succeed("Approved builds for "+i.blue(e)),!0}catch{return t.fail("Failed to approve builds for "+i.blue(e)),!1}}import{join as L}from"path";import x from"fs";async function d(e,r,a){let t=L(a,r,"package.json"),o=JSON.parse(x.readFileSync(t,"utf-8"));e==="bun"?o.scripts.manager=`bun manager.cjs ${e}`:o.scripts.manager=`node manager.cjs ${e}`,x.writeFileSync(t,JSON.stringify(o,null,2))}var N=z(import.meta.url),X=U.dirname(N);async function M(e){let{name:r,packageManager:a,cwd:t=process.cwd()}=e,o=j(X,"templates","react-ts-tw");try{if(!await c(o,j(t,r)))throw new Error("Failed to copy template folder");if(!await s(a,r,t))throw new Error("Failed to install dependencies");return await d(a,r,t),a==="pnpm"?await l(r,t):a==="bun"&&await m(r,t),!0}catch(n){throw console.error("Error creating React project:",n),n}}import q,{join as v}from"path";import{fileURLToPath as G}from"url";var H=G(import.meta.url),K=q.dirname(H);async function P(e){let{name:r,packageManager:a,cwd:t=process.cwd()}=e,o=v(K,"templates","next-prisma");try{if(!await c(o,v(t,r)))throw new Error("Failed to copy template folder");if(!await s(a,r,t))throw new Error("Failed to install dependencies");return await d(a,r,t),a==="pnpm"?await l(r,t):a==="bun"&&await m(r,t),!0}catch(n){throw console.error("Error creating Next project:",n),n}}import Q,{join as u}from"path";import{fileURLToPath as V}from"url";import Y from"chalk";import{select as Z}from"@inquirer/prompts";var ee=["react - !not ready","vue - !not ready","svelte","vanilla"],te=V(import.meta.url),y=Q.dirname(te);async function F(e){let{name:r,packageManager:a,cwd:t=process.cwd(),selectedFramework:o}=e;try{let n=o||await Z({message:Y.bold.magenta("Select a framework for WXT"),choices:ee,default:"svelte"}),f=u(y,"templates","wxt-svelte");n==="svelte"?f=u(y,"templates","wxt-svelte"):n==="vanilla"&&(f=u(y,"templates","wxt-vanilla")),await c(f,u(t,r))&&(await d(a,r,t),await s(a,r,t),a==="pnpm"?await l(r,t):a==="bun"&&await m(r,t))}catch(n){console.error(n)}}import{join as S}from"path";import b from"fs";async function A(e){let{name:r,cwd:a=process.cwd()}=e,t=S(a,r);b.existsSync(t)||b.mkdirSync(t);let o=S(t,"main.ipynb");b.writeFileSync(o,"")}import{execa as re}from"execa";import g from"chalk";async function E(e,r,a){console.log(g.white("Opening "+g.blue(e)+" in "+g.green(a)));try{return await re(`${a} ${e}`,{shell:!0,cwd:r}),!0}catch(t){return console.error(g.red("Failed to open project in editor:"),t),!1}}var I=["react-ts-tw","next-ts-prisma","wxt","python-notebook","cpp-makefile"],O=["bun","pnpm","npm"];async function h(e){switch(e.projectType){case"react-ts-tw":await M({name:e.name,packageManager:e.packageManager});break;case"next-ts-prisma":await P({name:e.name,packageManager:e.packageManager});break;case"wxt":await F({name:e.name,packageManager:e.packageManager});break;case"python-notebook":await A({name:e.name});break;default:console.log("Project Type Not Implemented",e.projectType);break}e.openInEditor!=="no"&&await E(e.name,process.cwd(),e.openInEditor)}var ie=await ne({message:p.bold.blue("Enter a project name"),default:p.gray("my-project"),validate:e=>!e||e.trim().length<2?p.red("Project name must be at least 2 characters"):/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)?ae.existsSync(oe.resolve(process.cwd(),e))?p.red("A folder with that name already exists"):!0:p.red("Only lowercase letters, numbers, and single hyphens allowed. No spaces or special characters.")}),_=await k({message:p.bold.yellow("Select a project type"),default:"react-ts-tw",choices:I}),$;_!=="python-notebook"&&($=await k({message:p.bold.green("Select a package manager"),choices:O,default:"bun"}));var pe=await k({message:p.bold.cyan("Open in editor?"),choices:["no","windsurf","cursor","code"],default:"no"}),se={projectType:_,packageManager:$,name:ie,openInEditor:pe};await h(se);
|
|
@@ -0,0 +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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style.css'
|
|
File without changes
|
|
@@ -0,0 +1,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(`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)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wxt-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:firefox": "wxt zip -b firefox",
|
|
14
|
+
"compile": "tsc --noEmit",
|
|
15
|
+
"postinstall": "wxt prepare"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.8.3",
|
|
19
|
+
"wxt": "^0.20.6"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|