From 5c1a45e5d39f3922d9a0781513d777f868004659 Mon Sep 17 00:00:00 2001 From: cihandeniz Date: Mon, 17 Nov 2025 10:08:39 +0300 Subject: [PATCH 1/2] init `issue/cross-var` - remove `cross-env` and migrate to `npx cross-var` - migrate windows scripts to `make.cmd` - update `build-and-run` for the windows - remove redundant `"default"` in `app.vue` - fix directory setup demonstration in `migrations.md` to be a code snippet --- .theme/app/app.vue | 4 ++-- .theme/package.json | 7 +++---- Makefile | 17 +++++------------ build-and-run.md | 12 +++++------- build.bat | 17 ----------------- make.cmd | 46 +++++++++++++++++++++++++++++++++++++++++++++ migrations.md | 2 ++ run.bat | 17 ----------------- 8 files changed, 63 insertions(+), 59 deletions(-) delete mode 100644 build.bat create mode 100644 make.cmd delete mode 100644 run.bat diff --git a/.theme/app/app.vue b/.theme/app/app.vue index 294d1aea2..7056dcd08 100644 --- a/.theme/app/app.vue +++ b/.theme/app/app.vue @@ -1,5 +1,5 @@ @@ -17,4 +17,4 @@ useHead({ } ] }); - \ No newline at end of file + diff --git a/.theme/package.json b/.theme/package.json index 694da5909..0b1320c0f 100644 --- a/.theme/package.json +++ b/.theme/package.json @@ -2,12 +2,12 @@ "type": "module", "scripts": { "lint": "eslint .", - "setup": "npm run lint && cross-env-shell node -r dotenv/config prebuild dotenv_config_path=.env.$npm_config_env", + "setup": "npm run lint && npx cross-var node -r dotenv/config prebuild dotenv_config_path=.env.$npm_config_env", "predev": "npm run setup --env=local", "dev": "nuxi dev --dotenv .env.local", "build": "nuxi build", - "pregenerate": "cross-env-shell npm run setup --env=$npm_config_env", - "generate": "cross-env-shell nuxi generate --dotenv .env.$npm_config_env", + "pregenerate": "npx cross-var npm run setup --env=$npm_config_env", + "generate": "npx cross-var nuxi generate --dotenv .env.$npm_config_env", "generate:local": "npm run generate --env=local", "generate:production": "npm run generate --env=production", "postinstall": "nuxi prepare", @@ -22,7 +22,6 @@ "@nuxtjs/i18n": "10.1.0", "@pinia/nuxt": "0.11.2", "@primevue/nuxt-module": "4.3.9", - "cross-env": "10.0.0", "log-symbols": "7.0.1", "nuxt": "4.1.2" }, diff --git a/Makefile b/Makefile index 576be32ed..ab5b84e69 100644 --- a/Makefile +++ b/Makefile @@ -3,20 +3,13 @@ install: @(cd .theme && npm i && npm ci) run: - @echo "(1) Development" - @echo "(2) Local" + @echo "(1) dev" + @echo "(2) local" @read -p "Please select 1-2: " app ; \ case $$app in \ - 1) (cd .theme && npm run -s dev && cd ..) ;; \ - 2) (cd .theme && npm run -s local && cd ..) ;; \ + 1) (cd .theme && npm run -s dev) ;; \ + 2) (cd .theme && npm run -s local) ;; \ *) echo "Invalid option" ;; \ esac build: - @echo "(1) Production" - @echo "(2) Local" - @read -p "Please select 1-2: " app ; \ - case $$app in \ - 1) (cd .theme && npm run -s generate:production && cd ..) ;; \ - 2) (cd .theme && npm run -s generate:local && cd ..) ;; \ - *) echo "Invalid option" ;; \ - esac + @(cd .theme && npm run -s generate:local) diff --git a/build-and-run.md b/build-and-run.md index 162d14f24..46db7499c 100644 --- a/build-and-run.md +++ b/build-and-run.md @@ -7,19 +7,17 @@ position: 101 To create a static site we use `nuxi generate`, to run the project in development mode we use `nuxi dev`. -For unix-like systems use `Makefile`; +To build and run use below commands in a terminal window; ```bash make build make run ``` -For Windows systems use `build.bat`; - -```bash -.\build.bat -.\run.bat -``` +> [!NOTE] +> +> This syntax works for all systems. It uses `Makefile` for unix-like systems +> and `make.cmd` for Windows systems. ## Process diff --git a/build.bat b/build.bat deleted file mode 100644 index d9c8daf20..000000000 --- a/build.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -:BEGIN -echo (1) Production -echo (2) Local -CHOICE /N /C:12 /M "Pick mode" -IF ERRORLEVEL == 2 GOTO Local -IF ERRORLEVEL == 1 GOTO Production -GOTO END -:Production -cd .theme -npm run generate:production -cd .. -:Local -cd .theme -npm run generate:local -cd .. -END: \ No newline at end of file diff --git a/make.cmd b/make.cmd new file mode 100644 index 000000000..9f5e01cfb --- /dev/null +++ b/make.cmd @@ -0,0 +1,46 @@ +@REM Generated By GPT +@REM Modified By CD +@echo off +setlocal enabledelayedexpansion + +if "%1"=="" ( + echo Usage: %0 ^ + echo. + echo Available commands: install, run, build + exit /b 1 +) + +set CMD=%1 + +if /i "%CMD%"=="install" goto install +if /i "%CMD%"=="run" goto run +if /i "%CMD%"=="build" goto build + +echo Invalid command: %CMD% +exit /b 1 + +:install +cd .theme && npm i && cd .. +goto end + +:run +echo (1) dev +echo (2) local +set /p choice="Please select 1-2: " + +if "%choice%"=="1" goto dev +if "%choice%"=="2" goto local + +:dev +cd ui && npm run dev && cd .. +goto end + +:local +cd ui && npm run local && cd .. +goto end + +:build +cd .theme && npm run generate:local && cd .. +goto end + +:end diff --git a/migrations.md b/migrations.md index 1fd68c938..b56186f1a 100644 --- a/migrations.md +++ b/migrations.md @@ -54,6 +54,7 @@ Move this folder and components to under `/app` directory final result must be look like this +```bash my-nuxt-app/ ├─ app/ │ ├─ assets/ @@ -72,6 +73,7 @@ my-nuxt-app/ ├─ shared/ ├─ server/ └─ nuxt.config.ts +``` ### Editing `tsconfig.ts` diff --git a/run.bat b/run.bat deleted file mode 100644 index d45b9695a..000000000 --- a/run.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -:BEGIN -echo (1) Dev -echo (2) Local -CHOICE /N /C:12 /M "Pick mode" -IF ERRORLEVEL == 2 GOTO Local -IF ERRORLEVEL == 1 GOTO Dev -GOTO END -:Dev -cd .theme -npm run dev -cd .. -:Local -cd .theme -npm run local -cd .. -END: From 2d83ebfc33d7245fdcc13a460063868baf254d80 Mon Sep 17 00:00:00 2001 From: cihandeniz Date: Mon, 17 Nov 2025 12:24:47 +0300 Subject: [PATCH 2/2] fix `make.cmd` paths --- make.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make.cmd b/make.cmd index 9f5e01cfb..8cd44c7c0 100644 --- a/make.cmd +++ b/make.cmd @@ -32,11 +32,11 @@ if "%choice%"=="1" goto dev if "%choice%"=="2" goto local :dev -cd ui && npm run dev && cd .. +cd .theme && npm run dev && cd .. goto end :local -cd ui && npm run local && cd .. +cd .theme && npm run local && cd .. goto end :build