@vef-framework-react/dev 2.1.2 → 2.1.3

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/cli/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/dev v2.1.2 made by Venus | 2026-03-29T05:32:39.269Z */
1
+ /*! @vef-framework-react/dev v2.1.3 made by Venus | 2026-03-29T13:51:54.632Z */
2
2
  import{resolve as o}from"node:path";import y from"node:process";import c from"chalk";import{program as r}from"commander";import a from"consola";import{execa as m}from"execa";import F from"fs-extra";import w from"ora";import j from"prompts";const{copy:I,exists:u,move:g,readFile:T,readJson:h,readJsonSync:_,writeFile:f,writeJson:k}=F,v=y.cwd(),P={preCommit:"pnpm dlx lint-staged",commitMsg:"pnpm dlx commitlint --edit $1"},J={"*.{js,ts,tsx,json,jsonc,md,mdx,html}":"eslint --fix","*.{css,scss}":"stylelint --fix"};function N(){const e=o(import.meta.dirname,"../../package.json");return _(e,{encoding:"utf-8"}).version}function E(e,t){a.error(`Error during ${e}:`,t),y.exit(1)}function p(...e){return o(v,...e)}async function V(){const e=p(".husky"),t=p(".husky/pre-commit"),n=p(".husky/commit-msg"),i=p("package.json");if(!await u(e)){const{default:S}=await import("husky");S(),a.success("Successfully set up husky")}await u(t)||(await f(t,P.preCommit),a.success("Successfully set up pre-commit hook")),await u(n)||(await f(n,P.commitMsg),a.success("Successfully set up commit-msg hook"));const s=await h(i,{encoding:"utf-8"}),{scripts:l}=s;let d=!1;l.prepare||(l.prepare="vef prepare",d=!0),s["lint-staged"]||(s["lint-staged"]={...J},d=!0),d&&(await k(i,s,{encoding:"utf-8",spaces:2}),a.success("Successfully set up prepare script and lint-staged"))}async function b(){await m({cwd:v,stdio:"inherit"})("pnpm",["update","@vef-framework-react/*"])}async function A(){console.log(c.blue(`Welcome to use the cli tool of VEF Framework
3
3
  `));const e=await j([{type:"text",name:"appName",message:"What is the name of your app?",validate:s=>typeof s=="string"&&s.trim().length>0||"App name is required"},{type:"text",name:"appTitle",message:"What is the title of your app?",validate:s=>typeof s=="string"&&s.trim().length>0||"App title is required"}]),{appName:t,appTitle:n}=e,i=p(t);await C(i),await $(t,i),await z(t,n,i),await M(i),await L(i),U(t)}async function C(e){const t=o(import.meta.dirname,"../template");await I(t,e),a.success("Successfully copied template files"),await g(o(e,"_gitignore"),o(e,".gitignore")),await g(o(e,"_tsconfig.json"),o(e,"tsconfig.json")),await g(o(e,"_package.json"),o(e,"package.json"))}async function $(e,t){const n=o(t,"package.json"),i=await h(n,{encoding:"utf-8"});i.name=e,await k(n,i,{encoding:"utf-8",spaces:2}),a.success("Successfully replaced name and title in package.json")}async function z(e,t,n){const i=o(n,"env/.env"),l=(await T(i,{encoding:"utf-8"})).replace(/APP_NAME=.*$/m,`APP_NAME=${e}`).replace(/APP_TITLE=.*$/m,`APP_TITLE=${t}`);await f(i,l),a.success("Successfully replaced name and title in .env file")}async function M(e){const t=w("Initializing git repository...").start();try{await m`git --version`,await m({cwd:e})`git init`,t.succeed("Successfully initialized git repository")}catch(n){t.fail("Failed to initialize git repository"),E("init",n)}}async function L(e){const t=w("Installing dependencies...").start();try{await m({cwd:e})("pnpm",["install"]),t.succeed("Successfully installed dependencies")}catch(n){t.fail("Failed to install dependencies"),E("init",n)}}function U(e){a.success(c.green(`
4
4
  VEF project created successfully!`)),console.log(c.blue(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vef-framework-react/dev",
3
3
  "type": "module",
4
- "version": "2.1.2",
4
+ "version": "2.1.3",
5
5
  "private": false,
6
6
  "description": "Dev tools for VEF framework",
7
7
  "author": {