@kunver/new 1.3.1 → 1.4.1
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 -92
- 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.js +64 -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/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -1,93 +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
|
-
`,O=`
|
|
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}from"fs/promises";import{join as k}from"path";import{execSync as gt}from"child_process";import D from"chalk";import wt from"ora";async function g(s,t){let i=k(t,s),e=k(i,"push.sh"),n=wt("Copying config files to "+D.blue(s)).start();n.color="blue";try{await Promise.all([B(k(i,".prettierrc.json"),I),B(e,O)]);try{gt(`chmod +x "${e}"`)}catch{console.error(D.red("Failed to make push.sh executable"))}n.succeed("Config files copied and push.sh is executable")}catch(r){n.fail("Failed to copy config files or set permissions"),console.error(r)}}import{spawn as ht}from"child_process";import bt from"ora";import $ from"chalk";function H(s,t,i){let e;switch(s){case"pnpm":e=`pnpm create vite ${t} --template react-swc-ts`;break;case"npm":e=`npm create vite@latest ${t} -- --template react-swc-ts`;break;case"bun":e=`bun create vite ${t} --template react-swc-ts`;break;default:e=`pnpm create vite ${t} --template react-swc-ts`}return new Promise(n=>{let r=ht(e,{shell:!0,cwd:i}),o=bt("Creating React project "+$.blue(t)).start();o.color="blue",r.on("close",a=>{a===0?(o.succeed("Created React project at "+$.blue(t)),n(!0)):(o.fail("Failed to create React project at "+$.blue(t)),n(!1))})})}import{spawn as xt}from"child_process";import yt from"ora";async function w(s,t){return new Promise((i,e)=>{let n="cd "+s+" && pnpm approve-builds",r=xt(n,{shell:!0,cwd:t}),o=yt("Approving builds").start();r.stdout.pipe(process.stdout),r.stderr.pipe(process.stderr),setTimeout(()=>{r.stdin.write(`a
|
|
46
|
-
`),setTimeout(()=>{r.stdin.write(`y
|
|
47
|
-
`),r.stdin.end()},500)},500),r.on("close",a=>{a===0?(o.succeed("Builds approved."),i(!0)):(o.fail("Failed to approve builds."),e(new Error(`Process exited with code ${a}`)))}),r.on("error",a=>{o.fail(`Failed to start process. Error: ${a.message}`),e(a)})})}import{spawn as vt}from"child_process";import kt from"ora";import C from"chalk";async function h(s,t){return new Promise(i=>{let e=`cd ${s} && bun pm trust --all`,n=vt(e,{shell:!0,cwd:t}),r=kt("Approving builds for "+C.blue(s)).start();r.color="blue",n.on("close",o=>{o===0?(r.succeed("Approved builds for "+C.blue(s)),i(!0)):(r.fail("Failed to approve builds for "+C.blue(s)),i(!1))})})}import{writeFile as X,unlink as U,rm as $t}from"fs/promises";import d from"ora";import{spawn as Ct}from"child_process";async function z(s,t){let i=`${t}/${s}/README.md`,e=d("Editing README.md...").start();e.color="white";try{let n=`# ${s}`;await X(i,n,"utf-8"),e.succeed("Updated README.md")}catch(n){e.fail(`Failed to edit README.md: ${n}`),console.error(n)}}async function J(s,t){let i=`${t}/${s}/src/assets`,e=d("Deleting assets...").start();e.color="white";try{await $t(i,{recursive:!0,force:!0}),e.succeed("Deleted assets")}catch(n){e.fail(`Failed to delete assets: ${n}`),console.error(n)}}async function G(s,t){let i=`${t}/${s}/src/app.css`,e=d("Deleting app.css...").start();e.color="white";try{await U(i),e.succeed("Deleted app.css")}catch(n){e.fail(`Failed to delete app.css: ${n}`),console.error(n)}}async function Q(s,t){let i=`${t}/${s}/src/app.tsx`,e=d("Clearing app.tsx...").start();e.color="white";let n=`
|
|
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 X(i,n,"utf-8"),e.succeed("Cleared app.tsx")}catch(r){e.fail(`Failed to clear app.tsx: ${r}`),console.error(r)}}async function L(s,t){let i=`${t}/${s}/eslint.config.js`,e=d("Deleting eslint.config.js...").start();e.color="white";try{await U(i),e.succeed("Deleted eslint.config.js")}catch(n){e.fail(`Failed to delete eslint.config.js: ${n}`),console.error(n)}}async function V(s,t,i){let e="cd "+s+" && "+t+" remove @eslint/js eslint eslint-plugin-react-hooks eslint-plugin-react-refresh globals typescript-eslint";return new Promise(n=>{let r=Ct(e,{shell:!0,cwd:i}),o=d("Removing packages...").start();o.color="white",o.start(),r.on("close",a=>{a===0?(o.succeed("Removed packages"),n(!0)):(o.fail("Failed to remove packages"),n(!1))})})}async function _(s,t,i){await Promise.all([G(s,i),J(s,i),L(s,i),Q(s,i),z(s,i),V(s,t,i)])}async function q(s){let{name:t,packageManager:i,cwd:e=process.cwd()}=s;try{await H(i,t,e)&&(await f(i,t,e),await g(t,e),await W(i,t,e),i==="pnpm"?await w(t,e):i==="bun"&&await h(t,e),await _(t,i,e))}catch(n){console.error(n)}}import{spawn as Ft}from"child_process";import Pt from"ora";import F from"chalk";async function K(s,t,i,e){let n;switch(t){case"pnpm":n=`pnpm dlx wxt@latest init ${i} -t ${s} --pm ${t}`;break;case"npm":n=`npx wxt@latest init ${i} -t ${s} --pm ${t}`;break;case"bun":n=`bunx wxt@latest init ${i} -t ${s} --pm ${t}`;break;default:n=`bun wxt@latest init ${i} -t ${s} --pm ${t}`}return new Promise(r=>{let o=Ft(n,{shell:!0,cwd:e}),a=Pt("Creating WXT project "+F.blue(i)).start();a.color="blue",o.on("close",u=>{u===0?(a.succeed("Created WXT project at "+F.blue(i)),r(!0)):(a.fail("Failed to create WXT project at "+F.blue(i)),r(!1))})})}import{select as Et}from"@inquirer/prompts";import jt from"chalk";import{rm as b,mkdir as St,writeFile as p,readFile as P}from"fs/promises";import{join as c}from"path";import{spawn as At}from"child_process";import Tt from"ora";import Y from"chalk";async function Z(s,t,i){let e=Tt("Finalizing WXT Svelte project setup...").start();try{e.text="Cleaning up default files...",await b(c(t,"src","assets","svelte.svg")),await b(c(t,"src","entrypoints","popup","app.css")),await b(c(t,"src","entrypoints","content.ts")),await b(c(t,"src","lib","Counter.svelte")),e.text="Creating content script files...";let n=c(t,"src","entrypoints","content");await St(n),await p(c(n,"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 p(c(n,"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)
|
|
78
|
-
},
|
|
79
|
-
})
|
|
80
|
-
ui.mount()
|
|
81
|
-
},
|
|
82
|
-
})`),e.text="Installing Tailwind CSS...",await new Promise((it,rt)=>{let ot=`${i} install tailwindcss @tailwindcss/vite`;At(ot,{shell:!0,cwd:t}).on("close",at=>{at===0?it():rt(new Error("Failed to install Tailwind CSS"))})}),e.text="Configuring Tailwind CSS...",await p(c(t,"src","assets","tailwind.css"),'@import "tailwindcss";');let u=c(t,"wxt.config.ts"),m=await P(u,"utf-8");m=`import tailwindcss from '@tailwindcss/vite'
|
|
83
|
-
`+m,m=m.replace("defineConfig({",`defineConfig({
|
|
84
|
-
vite: () => ({
|
|
85
|
-
plugins: [tailwindcss()]
|
|
86
|
-
}),
|
|
87
|
-
webExt: {
|
|
88
|
-
disabled: true
|
|
89
|
-
},`),await p(u,m),e.text="Updating popup files...";let E=c(t,"src","entrypoints","popup","main.ts"),x=await P(E,"utf-8");x=x.replace("import './app.css'",'import "~/assets/tailwind.css"'),await p(E,x);let nt=c(t,"src","entrypoints","popup","App.svelte");await p(nt,`<script lang="ts">
|
|
90
|
-
let message = "Hello World"
|
|
91
|
-
</script>
|
|
92
|
-
|
|
93
|
-
<h1 class="text-3xl">{message}</h1>`),e.text="Updating package.json...";let j=c(t,"package.json"),M=JSON.parse(await P(j,"utf-8"));return M.name=s,await p(j,JSON.stringify(M,null,2)),e.succeed(Y.green("WXT Svelte project setup finished successfully!")),!0}catch(n){return e.fail(Y.red(`Error during post-installation setup: ${n.message}`)),!1}}import{join as Mt}from"path";var Rt=["react - !not ready","vue - !not ready","svelte","vanilla - !not ready","solid - !not ready"];async function N(s){let{name:t,packageManager:i,cwd:e=process.cwd()}=s;try{let n=await Et({message:jt.bold.magenta("Select a framework for WXT"),choices:Rt,default:"svelte"});if(await K(n,i,t,e)){let o=Mt(e,t);await f(i,t,e),await g(t,e),n==="svelte"&&await Z(t,o,i),i==="pnpm"?await w(t,e):i==="bun"&&await h(t,e)}}catch(n){console.error(n)}}import{spawn as Wt}from"child_process";import S from"chalk";async function tt(s,t,i){return console.log(S.white("Opening "+S.blue(s)+" in "+S.green(i))),new Promise(e=>{Wt(`${i} ${s}`,{shell:!0,cwd:t}).on("close",()=>e(!0))})}var et=["react-ts-tw","next-ts - !not ready","wxt","cpp-cmake - !not ready"],st=["bun","pnpm","npm"];async function A(s){switch(s.projectType){case"react-ts-tw":await q({name:s.name,packageManager:s.packageManager});break;case"next-ts - !not ready":console.log("next-ts",s.packageManager,s.name);break;case"wxt":await N({name:s.name,packageManager:s.packageManager});break;case"cpp-cmake - !not ready":console.log("cpp-cmake",s.packageManager,s.name);break;default:console.log("Invalid project type",s.projectType);break}s.openInEditor!=="no"&&await tt(s.name,process.cwd(),s.openInEditor)}import l from"chalk";import Ot from"fs";import Bt from"path";var Dt=await It({message:l.bold.blue("Enter a project name"),default:l.gray("my-project"),validate:s=>!s||s.trim().length<2?l.red("Project name must be at least 2 characters"):/^[a-z0-9]+(-[a-z0-9]+)*$/.test(s)?Ot.existsSync(Bt.resolve(process.cwd(),s))?l.red("A folder with that name already exists"):!0:l.red("Only lowercase letters, numbers, and single hyphens allowed. No spaces or special characters.")}),Ht=await T({message:l.bold.green("Select a package manager"),choices:st,default:"bun"}),Xt=await T({message:l.bold.yellow("Select a project type"),default:"react-ts-tw",choices:et}),Ut=await T({message:l.bold.cyan("Open in editor?"),choices:["no","windsurf","cursor","code"],default:"no"}),zt={projectType:Xt,packageManager:Ht,name:Dt,openInEditor:Ut};await A(zt);
|
|
2
|
+
import{input as _,select as u}from"@inquirer/prompts";import{execa as v}from"execa";import d from"chalk";import T 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=T("Installing dependencies with "+d.blue(e)).start();try{return await v(r,{shell:!0,cwd:a}),o.succeed("Installed dependencies for "+d.blue(t)),!0}catch{return o.fail("Failed to install dependencies for "+d.blue(t)),!1}}import F from"fs-extra";import A from"ora";async function g(e,t){let a=A("Copying template folder...").start();try{return await F.copy(e,t),a.succeed("Copied template folder"),!0}catch{return a.fail("Failed to copy template folder"),!1}}import w from"ora";import s from"chalk";import{execa as I}from"execa";import{spawn as E}from"child_process";async function p(e,t){let a=w("Approving builds for "+s.blue(e)).start();try{return new Promise(r=>{let o=E("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 l(e,t){let a=`cd ${e} && bun pm trust --all`,r=w("Approving builds for "+s.blue(e)).start();try{return await I(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}}import{join as b}from"path";import{fileURLToPath as $}from"url";import P from"path";var O=$(import.meta.url),B=P.dirname(O);async function y(e){let{name:t,packageManager:a,cwd:r=process.cwd()}=e,o=b(B,"templates","react-ts-tw");try{if(!await g(o,b(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 p(t,r):a==="bun"&&await l(t,r),!0}catch(n){throw console.error("Error creating React project:",n),n}}import{select as C}from"@inquirer/prompts";import D from"chalk";import{join as S}from"path";var W=["react - !not ready","vue - !not ready","svelte","vanilla - !not ready","solid - !not ready"];async function h(e){let{name:t,packageManager:a,cwd:r=process.cwd(),selectedFramework:o}=e;try{let n=o||await C({message:D.bold.magenta("Select a framework for WXT"),choices:W,default:"svelte"});if(!1){let J=S(r,t);await i(a,t,r),a==="pnpm"?await p(t,r):a==="bun"&&await l(t,r)}}catch(n){console.error(n)}}import{execa as R}from"execa";import m from"chalk";async function k(e,t,a){console.log(m.white("Opening "+m.blue(e)+" in "+m.green(a)));try{return await R(`${a} ${e}`,{shell:!0,cwd:t}),!0}catch(r){return console.error(m.red("Failed to open project in editor:"),r),!1}}var x=["react-ts-tw","next-ts - !not ready","wxt","cpp-cmake - !not ready"],j=["bun","pnpm","npm"];async function f(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 h({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 k(e.name,process.cwd(),e.openInEditor)}import c from"chalk";import z from"fs";import L from"path";var U=await _({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)?z.existsSync(L.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.")}),X=await u({message:c.bold.green("Select a package manager"),choices:j,default:"bun"}),q=await u({message:c.bold.yellow("Select a project type"),default:"react-ts-tw",choices:x}),G=await u({message:c.bold.cyan("Open in editor?"),choices:["no","windsurf","cursor","code"],default:"no"}),H={projectType:q,packageManager:X,name:U,openInEditor:G};await f(H);
|
|
@@ -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,64 @@
|
|
|
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(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 (pnpm publish)...")
|
|
43
|
+
if (!await runCommand("pnpm publish")) {
|
|
44
|
+
console.log("❌ pnpm 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 commandArg = process.argv[2]
|
|
59
|
+
|
|
60
|
+
if (commandArg === "push" || commandArg === "publish") {
|
|
61
|
+
publishAndPushOperations(commandArg)
|
|
62
|
+
} else {
|
|
63
|
+
console.log(`Invalid or missing command: '${commandArg || ""}'. Usage: node manager.js [push|publish]`)
|
|
64
|
+
}
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kunver/new",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Opiniated project starter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,13 +24,17 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@inquirer/prompts": "^7.6.0",
|
|
27
|
+
"@types/fs-extra": "^11.0.4",
|
|
27
28
|
"chalk": "^5.4.1",
|
|
29
|
+
"execa": "^9.6.0",
|
|
30
|
+
"fs-extra": "^11.3.0",
|
|
28
31
|
"ora": "^8.2.0"
|
|
29
32
|
},
|
|
30
33
|
"scripts": {
|
|
31
34
|
"build": "tsup",
|
|
32
35
|
"start": "pnpm run build && node dist/index.js",
|
|
33
36
|
"local": "pnpm link --global",
|
|
37
|
+
"manager": "node manager.cjs",
|
|
34
38
|
"test": "vitest run"
|
|
35
39
|
}
|
|
36
40
|
}
|