@kunver/new 1.4.0 → 1.5.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 +3 -91
- package/dist/templates/react-ts-tw/.prettierrc.json +12 -0
- package/dist/templates/react-ts-tw/README.md +1 -0
- package/dist/templates/react-ts-tw/index.html +13 -0
- package/dist/templates/react-ts-tw/manager.cjs +69 -0
- package/dist/templates/react-ts-tw/package.json +31 -0
- package/dist/templates/react-ts-tw/public/vite.svg +1 -0
- package/dist/templates/react-ts-tw/push.sh +30 -0
- package/dist/templates/react-ts-tw/src/App.tsx +9 -0
- package/dist/templates/react-ts-tw/src/index.css +1 -0
- package/dist/templates/react-ts-tw/src/main.tsx +10 -0
- package/dist/templates/react-ts-tw/src/vite-env.d.ts +1 -0
- package/dist/templates/react-ts-tw/tsconfig.app.json +27 -0
- package/dist/templates/react-ts-tw/tsconfig.json +7 -0
- package/dist/templates/react-ts-tw/tsconfig.node.json +25 -0
- package/dist/templates/react-ts-tw/vite.config.ts +8 -0
- package/dist/templates/wxt-svelte/.prettierrc.json +11 -0
- package/dist/templates/wxt-svelte/.vscode/extensions.json +3 -0
- package/dist/templates/wxt-svelte/README.md +3 -0
- package/dist/templates/wxt-svelte/manager.cjs +69 -0
- package/dist/templates/wxt-svelte/package.json +33 -0
- package/dist/templates/wxt-svelte/public/icon/128.png +0 -0
- package/dist/templates/wxt-svelte/public/icon/16.png +0 -0
- package/dist/templates/wxt-svelte/public/icon/32.png +0 -0
- package/dist/templates/wxt-svelte/public/icon/48.png +0 -0
- package/dist/templates/wxt-svelte/public/icon/96.png +0 -0
- package/dist/templates/wxt-svelte/src/assets/tailwind.css +1 -0
- package/dist/templates/wxt-svelte/src/entrypoints/background.ts +3 -0
- package/dist/templates/wxt-svelte/src/entrypoints/content/App.svelte +7 -0
- package/dist/templates/wxt-svelte/src/entrypoints/content/index.ts +25 -0
- package/dist/templates/wxt-svelte/src/entrypoints/popup/App.svelte +7 -0
- package/dist/templates/wxt-svelte/src/entrypoints/popup/index.html +13 -0
- package/dist/templates/wxt-svelte/src/entrypoints/popup/main.ts +9 -0
- package/dist/templates/wxt-svelte/tsconfig.json +6 -0
- package/dist/templates/wxt-svelte/wxt-env.d.ts +1 -0
- package/dist/templates/wxt-svelte/wxt.config.ts +14 -0
- package/package.json +10 -7
package/dist/index.js
CHANGED
|
@@ -1,92 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{input as
|
|
3
|
-
|
|
4
|
-
{
|
|
5
|
-
"semi": false,
|
|
6
|
-
"trailingComma": "all",
|
|
7
|
-
"singleQuote": false,
|
|
8
|
-
"printWidth": 120,
|
|
9
|
-
"tabWidth": 2,
|
|
10
|
-
"useTabs": false,
|
|
11
|
-
"jsxSingleQuote": false,
|
|
12
|
-
"jsxBracketSameLine": false,
|
|
13
|
-
"arrowParens": "avoid"
|
|
14
|
-
}
|
|
15
|
-
`,D=`
|
|
16
|
-
#!/bin/bash
|
|
17
|
-
|
|
18
|
-
# Exit immediately if a command fails
|
|
19
|
-
set -e
|
|
20
|
-
|
|
21
|
-
# Switch to the main branch
|
|
22
|
-
git checkout main
|
|
23
|
-
|
|
24
|
-
# Merge the dev branch into main
|
|
25
|
-
git merge dev
|
|
26
|
-
if [ $? -ne 0 ]; then
|
|
27
|
-
echo "\u274C Merge conflict occurred. Please resolve it manually."
|
|
28
|
-
exit 1
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
# Push changes to GitHub
|
|
32
|
-
git push origin main
|
|
33
|
-
if [ $? -ne 0 ]; then
|
|
34
|
-
echo "\u274C Failed to push changes to GitHub. Please check your network connection and permissions."
|
|
35
|
-
exit 1
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
echo "\u2705 Successfully merged 'dev' into 'main' and pushed to GitHub!"
|
|
39
|
-
|
|
40
|
-
git checkout dev
|
|
41
|
-
if [ $? -ne 0 ]; then
|
|
42
|
-
echo "\u274C Failed to switch back to the 'dev' branch."
|
|
43
|
-
exit 1
|
|
44
|
-
fi
|
|
45
|
-
`;import{writeFile as B,access as ue}from"fs/promises";import{join as $}from"path";import{execSync as fe}from"child_process";import H from"chalk";import ge from"ora";async function u(e,t){let n=$(t,e),r=$(n,"push.sh"),s=ge("Copying config files to "+H.blue(e)).start();try{await ue(n),await Promise.all([B($(n,".prettierrc.json"),O),B(r,D)]);try{fe(`chmod +x "${r}"`)}catch{console.error(H.red("Failed to make push.sh executable"))}s.succeed("Config files copied and push.sh is executable")}catch(a){throw s.fail("Failed to copy config files or set permissions"),console.error(a),a}}import{execa as we}from"execa";import he from"ora";import C from"chalk";async function X(e,t,n){let r;switch(e){case"pnpm":r=`pnpm create vite ${t} --template react-swc-ts`;break;case"npm":r=`npm create vite@latest ${t} -- --template react-swc-ts`;break;case"bun":r=`bun create vite ${t} --template react-swc-ts`;break;default:r=`pnpm create vite ${t} --template react-swc-ts`}let s=he("Creating React project "+C.blue(t)).start();try{return await we(r,{shell:!0,cwd:n}),s.succeed("Created React project at "+C.blue(t)),!0}catch{return s.fail("Failed to create React project at "+C.blue(t)),!1}}import xe from"ora";import d from"chalk";var{spawn:ye}=await import("child_process");async function f(e,t){let n=xe("Approving builds for "+d.blue(e)).start();try{return new Promise(r=>{let s=ye("pnpm",["approve-builds"],{cwd:`${t}/${e}`,stdio:["pipe","inherit","inherit"],shell:!0});setTimeout(()=>{s.stdin?.write(`a
|
|
46
|
-
`),setTimeout(()=>{s.stdin?.write(`y
|
|
47
|
-
`),s.stdin?.end()},1e3)},2e3),s.on("close",a=>{a===0?(n.succeed("Approved builds for "+d.blue(e)),r(!0)):(n.fail("Failed to approve builds for "+d.blue(e)),r(!1))}),s.on("error",a=>{n.fail("Failed to approve builds for "+d.blue(e)),console.error(a),r(!1)})})}catch(r){return n.fail("Failed to approve builds for "+d.blue(e)),console.error(r),!1}}import{execa as be}from"execa";import ve from"ora";import F from"chalk";async function g(e,t){let n=`cd ${e} && bun pm trust --all`,r=ve("Approving builds for "+F.blue(e)).start();try{return await be(n,{shell:!0,cwd:t}),r.succeed("Approved builds for "+F.blue(e)),!0}catch{return r.fail("Failed to approve builds for "+F.blue(e)),!1}}import{writeFile as U,unlink as z,rm as ke,access as J}from"fs/promises";import l from"ora";import{execa as $e}from"execa";async function G(e,t){let n=`${t}/${e}/README.md`,r=l("Editing README.md...").start();try{let s=`# ${e}`;await U(n,s,"utf-8"),r.succeed("Updated README.md")}catch(s){r.fail(`Failed to edit README.md: ${s}`),console.error(s)}}async function Q(e,t){let n=`${t}/${e}/src/assets`,r=l("Deleting assets...").start();try{await ke(n,{recursive:!0,force:!0}),r.succeed("Deleted assets")}catch(s){r.fail(`Failed to delete assets: ${s}`),console.error(s)}}async function L(e,t){let n=`${t}/${e}/src/app.css`,r=l("Deleting app.css...").start();try{await J(n),await z(n),r.succeed("Deleted app.css")}catch(s){s.code==="ENOENT"?r.info("app.css not found (already deleted or doesn't exist)"):(r.fail(`Failed to delete app.css: ${s}`),console.error(s))}}async function V(e,t){let n=`${t}/${e}/src/app.tsx`,r=l("Clearing app.tsx...").start(),s=`
|
|
48
|
-
function App() {
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
<h1 className="text-3xl font-bold underline">Hello</h1>
|
|
52
|
-
</>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default App
|
|
57
|
-
`;try{await U(n,s,"utf-8"),r.succeed("Cleared app.tsx")}catch(a){r.fail(`Failed to clear app.tsx: ${a}`),console.error(a)}}async function _(e,t){let n=`${t}/${e}/eslint.config.js`,r=l("Deleting eslint.config.js...").start();try{await J(n),await z(n),r.succeed("Deleted eslint.config.js")}catch(s){s.code==="ENOENT"?r.info("eslint.config.js not found (already deleted or doesn't exist)"):(r.fail(`Failed to delete eslint.config.js: ${s}`),console.error(s))}}async function q(e,t,n){let r="cd "+e+" && "+t+" remove @eslint/js eslint eslint-plugin-react-hooks eslint-plugin-react-refresh globals typescript-eslint",s=l("Removing packages...").start();try{return await $e(r,{shell:!0,cwd:n}),s.succeed("Removed packages"),!0}catch(a){return s.fail("Failed to remove packages"),console.error(a),!1}}async function K(e,t,n){await Promise.all([L(e,n),Q(e,n),_(e,n),V(e,n),G(e,n),q(e,t,n)])}async function Y(e){let{name:t,packageManager:n,cwd:r=process.cwd()}=e;try{if(!await X(n,t,r))throw new Error("Failed to create React project");if(!await m(n,t,r))throw new Error("Failed to install dependencies");if(await u(t,r),!await W(n,t,r))throw new Error("Failed to install Tailwind");return n==="pnpm"?await f(t,r):n==="bun"&&await g(t,r),await K(t,n,r),!0}catch(s){throw console.error("Error creating React project:",s),s}}import{execa as Ce}from"execa";import Fe from"ora";import T from"chalk";async function Z(e,t,n,r){let s;switch(t){case"pnpm":s=`pnpm dlx wxt@latest init ${n} -t ${e} --pm ${t}`;break;case"npm":s=`npx wxt@latest init ${n} -t ${e} --pm ${t}`;break;case"bun":s=`bunx wxt@latest init ${n} -t ${e} --pm ${t}`;break;default:s=`bun wxt@latest init ${n} -t ${e} --pm ${t}`}let a=Fe("Creating WXT project "+T.blue(n)).start();try{return await Ce(s,{shell:!0,cwd:r}),a.succeed("Created WXT project at "+T.blue(n)),!0}catch{return a.fail("Failed to create WXT project at "+T.blue(n)),!1}}import{select as Ee}from"@inquirer/prompts";import je from"chalk";import{rm as w,mkdir as Te,writeFile as c,readFile as A}from"fs/promises";import{join as i}from"path";import{execa as Ae}from"execa";import Se from"ora";import N from"chalk";async function ee(e,t,n){let r=Se("Finalizing WXT Svelte project setup...").start();try{r.text="Cleaning up default files...",await w(i(t,"src","assets","svelte.svg")),await w(i(t,"src","entrypoints","popup","app.css")),await w(i(t,"src","entrypoints","content.ts")),await w(i(t,"src","lib","Counter.svelte")),r.text="Creating content script files...";let s=i(t,"src","entrypoints","content");await Te(s),await c(i(s,"App.svelte"),`<script lang="ts">
|
|
58
|
-
let message = "Hello World"
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
<h1 class="text-3xl fixed top-20 left-20 z-50">{message}</h1>`),await c(i(s,"index.ts"),`import App from "./App.svelte"
|
|
62
|
-
import { mount, unmount } from "svelte"
|
|
63
|
-
|
|
64
|
-
export default defineContentScript({
|
|
65
|
-
matches: ["<all_urls>"],
|
|
66
|
-
cssInjectionMode: "ui",
|
|
67
|
-
|
|
68
|
-
async main(ctx) {
|
|
69
|
-
const ui = await createShadowRootUi(ctx, {
|
|
70
|
-
name: "extension-ui",
|
|
71
|
-
position: "inline",
|
|
72
|
-
anchor: "body",
|
|
73
|
-
onMount: container => {
|
|
74
|
-
return mount(App, { target: container })
|
|
75
|
-
},
|
|
76
|
-
onRemove: app => {
|
|
77
|
-
unmount(app as any)
|
|
78
|
-
},
|
|
79
|
-
})
|
|
80
|
-
ui.mount()
|
|
81
|
-
},
|
|
82
|
-
})`),r.text="Installing Tailwind CSS...";let y=`${n} install tailwindcss @tailwindcss/vite`;await Ae(y,{shell:!0,cwd:t}),r.text="Configuring Tailwind CSS...",await c(i(t,"src","assets","tailwind.css"),'@import "tailwindcss";');let j=i(t,"wxt.config.ts"),p=await A(j,"utf-8");p='import tailwindcss from "@tailwindcss/vite"'+p,p=p.replace("defineConfig({",`defineConfig({
|
|
83
|
-
vite: () => ({
|
|
84
|
-
plugins: [tailwindcss()]
|
|
85
|
-
}),
|
|
86
|
-
webExt: {
|
|
87
|
-
disabled: true
|
|
88
|
-
},`),await c(j,p),r.text="Updating popup files...";let M=i(t,"src","entrypoints","popup","main.ts"),b=await A(M,"utf-8");b=b.replace("import './app.css'",'import "~/assets/tailwind.css"'),await c(M,b);let ae=i(t,"src","entrypoints","popup","App.svelte");await c(ae,`<script lang="ts">
|
|
89
|
-
let message = "Hello World"
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<h1 class="text-3xl">{message}</h1>`),r.text="Updating package.json...";let P=i(t,"package.json"),R=JSON.parse(await A(P,"utf-8"));return R.name=e,await c(P,JSON.stringify(R,null,2)),r.succeed(N.green("WXT Svelte project setup finished successfully!")),!0}catch(s){return r.fail(N.red(`Error during post-installation setup: ${s.message}`)),!1}}import{join as Me}from"path";var Pe=["react - !not ready","vue - !not ready","svelte","vanilla - !not ready","solid - !not ready"];async function te(e){let{name:t,packageManager:n,cwd:r=process.cwd(),selectedFramework:s}=e;try{let a=s||await Ee({message:je.bold.magenta("Select a framework for WXT"),choices:Pe,default:"svelte"});if(await Z(a,n,t,r)){let y=Me(r,t);await m(n,t,r),await u(t,r),a==="svelte"&&await ee(t,y,n),n==="pnpm"?await f(t,r):n==="bun"&&await g(t,r)}}catch(a){console.error(a)}}import{execa as Re}from"execa";import h from"chalk";async function re(e,t,n){console.log(h.white("Opening "+h.blue(e)+" in "+h.green(n)));try{return await Re(`${n} ${e}`,{shell:!0,cwd:t}),!0}catch(r){return console.error(h.red("Failed to open project in editor:"),r),!1}}var ne=["react-ts-tw","next-ts - !not ready","wxt","cpp-cmake - !not ready"],se=["bun","pnpm","npm"];async function S(e){switch(e.projectType){case"react-ts-tw":await Y({name:e.name,packageManager:e.packageManager});break;case"next-ts - !not ready":console.log("next-ts",e.packageManager,e.name);break;case"wxt":await te({name:e.name,packageManager:e.packageManager});break;case"cpp-cmake - !not ready":console.log("cpp-cmake",e.packageManager,e.name);break;default:console.log("Invalid project type",e.projectType);break}e.openInEditor!=="no"&&await re(e.name,process.cwd(),e.openInEditor)}import o from"chalk";import We from"fs";import Oe from"path";var De=await Ie({message:o.bold.blue("Enter a project name"),default:o.gray("my-project"),validate:e=>!e||e.trim().length<2?o.red("Project name must be at least 2 characters"):/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)?We.existsSync(Oe.resolve(process.cwd(),e))?o.red("A folder with that name already exists"):!0:o.red("Only lowercase letters, numbers, and single hyphens allowed. No spaces or special characters.")}),Be=await E({message:o.bold.green("Select a package manager"),choices:se,default:"bun"}),He=await E({message:o.bold.yellow("Select a project type"),default:"react-ts-tw",choices:ne}),Xe=await E({message:o.bold.cyan("Open in editor?"),choices:["no","windsurf","cursor","code"],default:"no"}),Ue={projectType:He,packageManager:Be,name:De,openInEditor:Xe};await S(Ue);
|
|
2
|
+
import G from"fs";import H from"path";import{input as K,select as y}from"@inquirer/prompts";import c from"chalk";import{join as x}from"path";import{fileURLToPath as B}from"url";import C from"path";import{execa as I}from"execa";import g from"chalk";import $ from"ora";async function i(e,t,a){let r;switch(e){case"pnpm":r=`cd ${t} && pnpm install`;break;case"npm":r=`cd ${t} && npm install`;break;case"bun":r=`cd ${t} && bun install`;break;default:r=`cd ${t} && pnpm install`}let o=$("Installing dependencies with "+g.blue(e)).start();try{return await I(r,{shell:!0,cwd:a}),o.succeed("Installed dependencies for "+g.blue(t)),!0}catch{return o.fail("Failed to install dependencies for "+g.blue(t)),!1}}import E from"fs-extra";import S from"ora";async function p(e,t){let a=S("Copying template folder...").start();try{return await E.copy(e,t),a.succeed("Copied template folder"),!0}catch{return a.fail("Failed to copy template folder"),!1}}import{spawn as O}from"child_process";import k from"ora";import s from"chalk";import{execa as _}from"execa";async function l(e,t){let a=k("Approving builds for "+s.blue(e)).start();try{return new Promise(r=>{let o=O("pnpm",["approve-builds"],{cwd:`${t}/${e}`,stdio:["pipe","inherit","inherit"],shell:!0});setTimeout(()=>{o.stdin?.write(`a
|
|
3
|
+
`),setTimeout(()=>{o.stdin?.write(`y
|
|
4
|
+
`),o.stdin?.end()},1e3)},2e3),o.on("close",n=>{n===0?(a.succeed("Approved builds for "+s.blue(e)),r(!0)):(a.fail("Failed to approve builds for "+s.blue(e)),r(!1))}),o.on("error",n=>{a.fail("Failed to approve builds for "+s.blue(e)),console.error(n),r(!1)})})}catch(r){return a.fail("Failed to approve builds for "+s.blue(e)),console.error(r),!1}}async function m(e,t){let a=`cd ${e} && bun pm trust --all`,r=k("Approving builds for "+s.blue(e)).start();try{return await _(a,{shell:!0,cwd:t}),r.succeed("Approved builds for "+s.blue(e)),!0}catch{return r.fail("Failed to approve builds for "+s.blue(e)),!1}}var D=B(import.meta.url),R=C.dirname(D);async function j(e){let{name:t,packageManager:a,cwd:r=process.cwd()}=e,o=x(R,"templates","react-ts-tw");try{if(!await p(o,x(r,t)))throw new Error("Failed to copy template folder");if(!await i(a,t,r))throw new Error("Failed to install dependencies");return a==="pnpm"?await l(t,r):a==="bun"&&await m(t,r),!0}catch(n){throw console.error("Error creating React project:",n),n}}import{join as d}from"path";import{fileURLToPath as W}from"url";import J from"path";import z from"chalk";import{select as L}from"@inquirer/prompts";import v from"fs";var U=["react - !not ready","vue - !not ready","svelte","vanilla - !not ready","solid - !not ready"],X=W(import.meta.url),M=J.dirname(X);async function T(e){let{name:t,packageManager:a,cwd:r=process.cwd(),selectedFramework:o}=e;try{let n=o||await L({message:z.bold.magenta("Select a framework for WXT"),choices:U,default:"svelte"}),u=d(M,"templates","wxt-svelte");if(n==="svelte"&&(u=d(M,"templates","wxt-svelte")),await p(u,d(r,t))){let b=d(r,t,"package.json"),h=JSON.parse(v.readFileSync(b,"utf-8"));h.scripts.manager=`node manager.cjs ${a}`,v.writeFileSync(b,JSON.stringify(h,null,2)),await i(a,t,r),a==="pnpm"?await l(t,r):a==="bun"&&await m(t,r)}}catch(n){console.error(n)}}import{execa as q}from"execa";import f from"chalk";async function F(e,t,a){console.log(f.white("Opening "+f.blue(e)+" in "+f.green(a)));try{return await q(`${a} ${e}`,{shell:!0,cwd:t}),!0}catch(r){return console.error(f.red("Failed to open project in editor:"),r),!1}}var P=["react-ts-tw","next-ts - !not ready","wxt","cpp-cmake - !not ready"],A=["bun","pnpm","npm"];async function w(e){switch(e.projectType){case"react-ts-tw":await j({name:e.name,packageManager:e.packageManager});break;case"next-ts - !not ready":console.log("next-ts",e.packageManager,e.name);break;case"wxt":await T({name:e.name,packageManager:e.packageManager});break;case"cpp-cmake - !not ready":console.log("cpp-cmake",e.packageManager,e.name);break;default:console.log("Invalid project type",e.projectType);break}e.openInEditor!=="no"&&await F(e.name,process.cwd(),e.openInEditor)}var Q=await K({message:c.bold.blue("Enter a project name"),default:c.gray("my-project"),validate:e=>!e||e.trim().length<2?c.red("Project name must be at least 2 characters"):/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)?G.existsSync(H.resolve(process.cwd(),e))?c.red("A folder with that name already exists"):!0:c.red("Only lowercase letters, numbers, and single hyphens allowed. No spaces or special characters.")}),V=await y({message:c.bold.green("Select a package manager"),choices:A,default:"bun"}),Y=await y({message:c.bold.yellow("Select a project type"),default:"react-ts-tw",choices:P}),Z=await y({message:c.bold.cyan("Open in editor?"),choices:["no","windsurf","cursor","code"],default:"no"}),N={projectType:Y,packageManager:V,name:Q,openInEditor:Z};await w(N);
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
"plugins": ["prettier-plugin-tailwindcss"]
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# {project_name}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>{project_name}</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -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,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{project_name}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"manager": "node manager.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
14
|
+
"react": "^19.1.0",
|
|
15
|
+
"react-dom": "^19.1.0",
|
|
16
|
+
"tailwindcss": "^4.1.11"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/react": "^19.1.8",
|
|
20
|
+
"@types/react-dom": "^19.1.6",
|
|
21
|
+
"@vitejs/plugin-react-swc": "^3.10.2",
|
|
22
|
+
"prettier": "^3.6.2",
|
|
23
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
24
|
+
"typescript": "~5.8.3",
|
|
25
|
+
"vite": "^7.0.4"
|
|
26
|
+
},
|
|
27
|
+
"trustedDependencies": [
|
|
28
|
+
"@swc/core",
|
|
29
|
+
"@tailwindcss/oxide"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
#!/bin/bash
|
|
3
|
+
|
|
4
|
+
# Exit immediately if a command fails
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Switch to the main branch
|
|
8
|
+
git checkout main
|
|
9
|
+
|
|
10
|
+
# Merge the dev branch into main
|
|
11
|
+
git merge dev
|
|
12
|
+
if [ $? -ne 0 ]; then
|
|
13
|
+
echo "❌ Merge conflict occurred. Please resolve it manually."
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Push changes to GitHub
|
|
18
|
+
git push origin main
|
|
19
|
+
if [ $? -ne 0 ]; then
|
|
20
|
+
echo "❌ Failed to push changes to GitHub. Please check your network connection and permissions."
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
echo "✅ Successfully merged 'dev' into 'main' and pushed to GitHub!"
|
|
25
|
+
|
|
26
|
+
git checkout dev
|
|
27
|
+
if [ $? -ne 0 ]; then
|
|
28
|
+
echo "❌ Failed to switch back to the 'dev' branch."
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -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,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wxt-svelte-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
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
15
|
+
"postinstall": "wxt prepare"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
19
|
+
"@tsconfig/svelte": "^5.0.4",
|
|
20
|
+
"@wxt-dev/module-svelte": "^2.0.3",
|
|
21
|
+
"svelte": "^5.28.2",
|
|
22
|
+
"svelte-check": "^4.1.6",
|
|
23
|
+
"tailwindcss": "^4.1.11",
|
|
24
|
+
"tslib": "^2.8.1",
|
|
25
|
+
"typescript": "^5.8.3",
|
|
26
|
+
"wxt": "^0.20.6"
|
|
27
|
+
},
|
|
28
|
+
"trustedDependencies": [
|
|
29
|
+
"@tailwindcss/oxide",
|
|
30
|
+
"esbuild",
|
|
31
|
+
"spawn-sync"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { mount, unmount } from "svelte"
|
|
2
|
+
import App from "./App.svelte"
|
|
3
|
+
import "~/assets/tailwind.css"
|
|
4
|
+
|
|
5
|
+
export default defineContentScript({
|
|
6
|
+
matches: ["<all_urls>"],
|
|
7
|
+
|
|
8
|
+
cssInjectionMode: "ui",
|
|
9
|
+
|
|
10
|
+
async main(ctx) {
|
|
11
|
+
const ui = await createShadowRootUi(ctx, {
|
|
12
|
+
name: "ext-ui",
|
|
13
|
+
position: "inline",
|
|
14
|
+
anchor: "body",
|
|
15
|
+
onMount: container => {
|
|
16
|
+
return mount(App, { target: container })
|
|
17
|
+
},
|
|
18
|
+
onRemove: app => {
|
|
19
|
+
unmount(app as any)
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
ui.mount()
|
|
24
|
+
},
|
|
25
|
+
})
|
|
@@ -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
|
+
/// <reference types="svelte" />
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
srcDir: "src",
|
|
7
|
+
modules: ["@wxt-dev/module-svelte"],
|
|
8
|
+
vite: () => ({
|
|
9
|
+
plugins: [tailwindcss()],
|
|
10
|
+
}),
|
|
11
|
+
webExt: {
|
|
12
|
+
disabled: true,
|
|
13
|
+
},
|
|
14
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kunver/new",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Opiniated project starter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,22 +16,25 @@
|
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"author": "Burak Unver <burakhanunver@gmail.com> (https://kunver.dev)",
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/node": "^24.0.13",
|
|
21
|
-
"tsup": "^8.2.2",
|
|
22
|
-
"typescript": "^5.5.4",
|
|
23
|
-
"vitest": "^3.2.4"
|
|
24
|
-
},
|
|
25
19
|
"dependencies": {
|
|
26
20
|
"@inquirer/prompts": "^7.6.0",
|
|
21
|
+
"@types/fs-extra": "^11.0.4",
|
|
27
22
|
"chalk": "^5.4.1",
|
|
28
23
|
"execa": "^9.6.0",
|
|
24
|
+
"fs-extra": "^11.3.0",
|
|
29
25
|
"ora": "^8.2.0"
|
|
30
26
|
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^24.0.13",
|
|
29
|
+
"tsup": "^8.2.2",
|
|
30
|
+
"typescript": "^5.5.4",
|
|
31
|
+
"vitest": "^3.2.4"
|
|
32
|
+
},
|
|
31
33
|
"scripts": {
|
|
32
34
|
"build": "tsup",
|
|
33
35
|
"start": "pnpm run build && node dist/index.js",
|
|
34
36
|
"local": "pnpm link --global",
|
|
37
|
+
"manager": "node manager.cjs pnpm",
|
|
35
38
|
"test": "vitest run"
|
|
36
39
|
}
|
|
37
40
|
}
|