softleader-nuxt-core 1.0.6 → 1.0.8

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/README.md CHANGED
@@ -1,27 +1,68 @@
1
- # Nuxt Core Layer
1
+ # Nuxt Core Layer (`softleader-nuxt-core`)
2
2
 
3
- 這是 Nuxt 3 Core Layer,提供可重用的基礎架構、元件和工具。
3
+ 這是 Nuxt 3 Core Layer,提供可重用的基礎架構、元件和工具,協助開發團隊快速建立一致且高品質的 Nuxt 3 應用。
4
4
 
5
5
  ## 包含內容
6
6
 
7
- - 設計系統元件(Button、Card)
8
- - 基礎 Layout
7
+ - 設計系統元件
8
+ - 基礎 Layout 與路由設定
9
9
  - 全域樣式與設計 Tokens
10
- - 共用 Composables
11
- - 統一的開發工具配置(ESLint、Prettier、TypeScript)
10
+ - 共用 Composables 與 Utils
11
+ - 統一的開發工具配置(搭配 Nuxt 3 Eslint 等)
12
12
 
13
- ## 使用方式
13
+ ## 使用情境一:在既有專案中使用 (Layer 繼承)
14
14
 
15
- 在你的 Nuxt 應用中擴展此 Layer
15
+ 如果你已經有一個 Nuxt 3 專案,你可以直接將此 Layer 擴展進你的專案中,藉此享有所有組件、功能和設定。
16
16
 
17
- ```typescript
18
- // nuxt.config.ts
19
- export default defineNuxtConfig({
20
- extends: ['@org/nuxt-core']
21
- })
22
- ```
17
+ 1. **安裝依賴**
18
+
19
+ ```bash
20
+ npm install softleader-nuxt-core
21
+ ```
22
+
23
+ 2. **配置 `nuxt.config.ts`**
24
+
25
+ ```typescript
26
+ export default defineNuxtConfig({
27
+ extends: ["softleader-nuxt-core"],
28
+ // ... 其他你的專案設定
29
+ });
30
+ ```
31
+
32
+ 3. **啟用 ESLint / Prettier (選用)**
33
+ 由於此專案依賴 `@nuxt/eslint-config`,建議你的專案也在根目錄設定對應的 Eslint 配置:
34
+ ```bash
35
+ npm i -D @nuxt/eslint-config eslint
36
+ ```
37
+ 並在你的 `eslint.config.mjs` 中繼承 Nuxt 預設配置。
38
+
39
+ ---
40
+
41
+ ## 使用情境二:快速建立全新專案 (Scaffolding CLI)
42
+
43
+ 如果你想在一個新的(或空的)資料夾內建立完整包含 `softleader-nuxt-core` 的專案,我們提供了一個內建的命令列工具。
23
44
 
24
- ## 開發
45
+ 1. **透過 npx 執行初始化腳本**
46
+ 你可以直接使用 `npx` 搭配套件名稱,並指定你的專案名稱(例如 `my-new-app`):
47
+
48
+ ```bash
49
+ npx softleader-nuxt-core init my-new-app
50
+ ```
51
+
52
+ 2. **進入專案並啟動**
53
+ 指令執行完成後,請進入生成的專案資料夾並啟動開發伺服器:
54
+ ```bash
55
+ cd my-new-app
56
+ npm install # 若 CLI 尚未安裝完畢
57
+ npm run dev
58
+ ```
59
+ 這會自動生成 `package.json`、`app.vue`、`nuxt.config.ts` 等必要檔案,並且已經預先設定好 `extends: ['softleader-nuxt-core']`。
60
+
61
+ ---
62
+
63
+ ## 開發 Core Layer 說明
64
+
65
+ 若你是 `softleader-nuxt-core` 的開發者:
25
66
 
26
67
  ```bash
27
68
  # 安裝依賴
@@ -33,3 +74,18 @@ npm run lint
33
74
  # 型別檢查
34
75
  npm run typecheck
35
76
  ```
77
+
78
+ ### 發布至 npm
79
+
80
+ 為了讓其他開發者能透過 `npx` 使用此腳本或載入此 Layer,您必須將本專案發布到 npm registry。
81
+
82
+ 1. **更新版本號**:確保 `package.json` 中的 `version` 已更新。
83
+ 2. **登入 npm** (若尚未登入):
84
+ ```bash
85
+ npm login
86
+ ```
87
+ 3. **發布套件**:
88
+ ```bash
89
+ npm publish
90
+ ```
91
+ _(若是發布到公司私有 registry,請確認 `.npmrc` 中有設定正確的 registry url)_