@undp/create-app 0.2.21 → 0.2.23
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 +8 -8
- package/bin/templates/next/auth/README.md +5 -6
- package/bin/templates/next/basic/README.md +5 -6
- package/bin/templates/vite/basic/README.md +5 -6
- package/bin/templates/vite/query/README.md +5 -6
- package/bin/templates/vite/query+router/README.md +5 -6
- package/bin/templates/vite/router/README.md +5 -6
- package/bin/templates/viteWithLanguage/basic/README.md +17 -6
- package/bin/templates/viteWithLanguage/query/README.md +17 -6
- package/bin/templates/viteWithLanguage/query+router/README.md +19 -6
- package/bin/templates/viteWithLanguage/router/README.md +19 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🏗️ UNDP Create App CLI 
|
|
2
2
|
|
|
3
|
-
**`@undp/create-app`** is UNDP’s official **project scaffolding tool** for quickly bootstrapping frontend applications using **React**, and **TypeScript** — complete with sensible defaults for
|
|
3
|
+
**`@undp/create-app`** is UNDP’s official **project scaffolding tool** for quickly bootstrapping frontend applications using **React**, and **TypeScript** — complete with sensible defaults for Biome.
|
|
4
4
|
|
|
5
5
|
[NPM Package](https://www.npmjs.com/package/@undp/create-app)
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- 🎨 Preconfigured for **UNDP’s Design System**
|
|
17
17
|
- ⚡️ Optional integration with **Tanstack query** for data fetching
|
|
18
18
|
- 📊 Optional integration with **@undp/data-viz** for interactive data visualization
|
|
19
|
-
-
|
|
19
|
+
- 🔣 Optional integration with **i18next** for internationalization
|
|
20
20
|
- ✨ **Biome** preconfigured for consistent code style
|
|
21
21
|
|
|
22
22
|
---
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
|
|
26
26
|
All setups include **Tailwind CSS** for styling and **Zustand** for state management.
|
|
27
27
|
|
|
28
|
-
| Framework | Variants | Description |
|
|
29
|
-
|
|
30
|
-
| **Vite** | Basic | Minimal React + TypeScript setup |
|
|
31
|
-
| **Vite** | + Router | Adds TanStack Router for routing |
|
|
32
|
-
| **Next.js** | Basic | SSR and file-based routing |
|
|
33
|
-
| **Next.js** | + Auth | Includes authentication via Better Auth |
|
|
28
|
+
| Framework | Variants | Description | Internationalization Available |
|
|
29
|
+
|------------|-----------|-------------|-------------|
|
|
30
|
+
| **Vite** | Basic | Minimal React + TypeScript setup | ✅ |
|
|
31
|
+
| **Vite** | + Router | Adds TanStack Router for routing | ✅ |
|
|
32
|
+
| **Next.js** | Basic | SSR and file-based routing | ❌ |
|
|
33
|
+
| **Next.js** | + Auth | Includes authentication via Better Auth | ❌ |
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
@@ -5,7 +5,7 @@ It includes:
|
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* Authentication with [Better Auth](https://www.better-auth.com/)
|
|
7
7
|
* TailwindCSS
|
|
8
|
-
* Code linting and formatting via
|
|
8
|
+
* Code linting and formatting via Biome
|
|
9
9
|
|
|
10
10
|
## 🧩 Installation
|
|
11
11
|
|
|
@@ -33,19 +33,18 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
33
33
|
- `npm run build`: Executes `next build` and builds the app for production and deployment.
|
|
34
34
|
- `npm run preview`: Executes `next start` and serves the static build output locally.
|
|
35
35
|
- `npm run clean`: Executes `rimraf node_modules && rimraf .next && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
36
|
-
- `npm run lint`: Executes `
|
|
36
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
37
37
|
|
|
38
38
|
## 🧰 Tooling Setup
|
|
39
39
|
|
|
40
|
-
This project uses
|
|
40
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
41
41
|
|
|
42
42
|
If you’re using Visual Studio Code, install:
|
|
43
|
-
* [
|
|
44
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
43
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
45
44
|
|
|
46
45
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
47
46
|
|
|
48
|
-
More info: [
|
|
47
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
49
48
|
|
|
50
49
|
## 🎨 Styling
|
|
51
50
|
|
|
@@ -4,7 +4,7 @@ It includes:
|
|
|
4
4
|
* Next 16.x with React compiler
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* TailwindCSS
|
|
7
|
-
* Code linting and formatting via
|
|
7
|
+
* Code linting and formatting via Biome
|
|
8
8
|
|
|
9
9
|
## 🧩 Installation
|
|
10
10
|
|
|
@@ -32,19 +32,18 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
32
32
|
- `npm run build`: Executes `next build` and builds the app for production and deployment.
|
|
33
33
|
- `npm run preview`: Executes `next start` and serves the static build output locally.
|
|
34
34
|
- `npm run clean`: Executes `rimraf node_modules && rimraf .next && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
35
|
-
- `npm run lint`: Executes `
|
|
35
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
36
36
|
|
|
37
37
|
## 🧰 Tooling Setup
|
|
38
38
|
|
|
39
|
-
This project uses
|
|
39
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
40
40
|
|
|
41
41
|
If you’re using Visual Studio Code, install:
|
|
42
|
-
* [
|
|
43
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
42
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
44
43
|
|
|
45
44
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
46
45
|
|
|
47
|
-
More info: [
|
|
46
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
48
47
|
|
|
49
48
|
## 🎨 Styling
|
|
50
49
|
|
|
@@ -4,7 +4,7 @@ It includes:
|
|
|
4
4
|
* React 19.x with React compiler
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* TailwindCSS
|
|
7
|
-
* Code linting and formatting via
|
|
7
|
+
* Code linting and formatting via Biome
|
|
8
8
|
|
|
9
9
|
## 🧩 Installation
|
|
10
10
|
|
|
@@ -32,19 +32,18 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
32
32
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
33
33
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
34
34
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
35
|
-
- `npm run lint`: Executes `
|
|
35
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
36
36
|
|
|
37
37
|
## 🧰 Tooling Setup
|
|
38
38
|
|
|
39
|
-
This project uses
|
|
39
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
40
40
|
|
|
41
41
|
If you’re using Visual Studio Code, install:
|
|
42
|
-
* [
|
|
43
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
42
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
44
43
|
|
|
45
44
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
46
45
|
|
|
47
|
-
More info: [
|
|
46
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
48
47
|
|
|
49
48
|
## 🎨 Styling
|
|
50
49
|
|
|
@@ -5,7 +5,7 @@ It includes:
|
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* Data fetching with [TanStack Query](https://tanstack.com/query)
|
|
7
7
|
* TailwindCSS
|
|
8
|
-
* Code linting and formatting via
|
|
8
|
+
* Code linting and formatting via Biome
|
|
9
9
|
|
|
10
10
|
## 🧩 Installation
|
|
11
11
|
|
|
@@ -33,19 +33,18 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
33
33
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
34
34
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
35
35
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
36
|
-
- `npm run lint`: Executes `
|
|
36
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
37
37
|
|
|
38
38
|
## 🧰 Tooling Setup
|
|
39
39
|
|
|
40
|
-
This project uses
|
|
40
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
41
41
|
|
|
42
42
|
If you’re using Visual Studio Code, install:
|
|
43
|
-
* [
|
|
44
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
43
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
45
44
|
|
|
46
45
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
47
46
|
|
|
48
|
-
More info: [
|
|
47
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
49
48
|
|
|
50
49
|
## 🎨 Styling
|
|
51
50
|
|
|
@@ -6,7 +6,7 @@ It includes:
|
|
|
6
6
|
* Routing with [TanStack Router](https://tanstack.com/router)
|
|
7
7
|
* Data fetching with [TanStack Query](https://tanstack.com/query)
|
|
8
8
|
* TailwindCSS
|
|
9
|
-
* Code linting and formatting via
|
|
9
|
+
* Code linting and formatting via Biome
|
|
10
10
|
|
|
11
11
|
## 🧩 Installation
|
|
12
12
|
|
|
@@ -34,19 +34,18 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
34
34
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
35
35
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
36
36
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
37
|
-
- `npm run lint`: Executes `
|
|
37
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
38
38
|
|
|
39
39
|
## 🧰 Tooling Setup
|
|
40
40
|
|
|
41
|
-
This project uses
|
|
41
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
42
42
|
|
|
43
43
|
If you’re using Visual Studio Code, install:
|
|
44
|
-
* [
|
|
45
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
44
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
46
45
|
|
|
47
46
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
48
47
|
|
|
49
|
-
More info: [
|
|
48
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
50
49
|
|
|
51
50
|
## 🎨 Styling
|
|
52
51
|
|
|
@@ -5,7 +5,7 @@ It includes:
|
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* Routing with [TanStack Router](https://tanstack.com/router)
|
|
7
7
|
* TailwindCSS
|
|
8
|
-
* Code linting and formatting via
|
|
8
|
+
* Code linting and formatting via Biome
|
|
9
9
|
|
|
10
10
|
## 🧩 Installation
|
|
11
11
|
|
|
@@ -33,19 +33,18 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
33
33
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
34
34
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
35
35
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
36
|
-
- `npm run lint`: Executes `
|
|
36
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
37
37
|
|
|
38
38
|
## 🧰 Tooling Setup
|
|
39
39
|
|
|
40
|
-
This project uses
|
|
40
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
41
41
|
|
|
42
42
|
If you’re using Visual Studio Code, install:
|
|
43
|
-
* [
|
|
44
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
43
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
45
44
|
|
|
46
45
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
47
46
|
|
|
48
|
-
More info: [
|
|
47
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
49
48
|
|
|
50
49
|
## 🎨 Styling
|
|
51
50
|
|
|
@@ -4,7 +4,7 @@ It includes:
|
|
|
4
4
|
* React 19.x with React compiler
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* TailwindCSS
|
|
7
|
-
* Code linting and formatting via
|
|
7
|
+
* Code linting and formatting via Biome
|
|
8
8
|
|
|
9
9
|
## 🧩 Installation
|
|
10
10
|
|
|
@@ -32,24 +32,35 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
32
32
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
33
33
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
34
34
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
35
|
-
- `npm run lint`: Executes `
|
|
35
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
36
36
|
|
|
37
37
|
## 🧰 Tooling Setup
|
|
38
38
|
|
|
39
|
-
This project uses
|
|
39
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
40
40
|
|
|
41
41
|
If you’re using Visual Studio Code, install:
|
|
42
|
-
* [
|
|
43
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
42
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
44
43
|
|
|
45
44
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
46
45
|
|
|
47
|
-
More info: [
|
|
46
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
47
|
+
|
|
48
|
+
__Recommendation__
|
|
49
|
+
|
|
50
|
+
On Visual Studio Code, you can also use the [i18n Ally](https://github.com/lokalise/i18n-ally/wiki) extension for a better translation workflow. It provides features such as translation key autocomplete, inline translation previews, missing key detection, and quick navigation between translation files.
|
|
48
51
|
|
|
49
52
|
## 🎨 Styling
|
|
50
53
|
|
|
51
54
|
This project uses [Tailwind CSS](https://tailwindcss.com/) for styling and and includes pre-configured design tokens from the UNDP Design System.
|
|
52
55
|
|
|
56
|
+
## 🔣 Adding a new language
|
|
57
|
+
|
|
58
|
+
1. Create a new translation file (e.g. `src/locales/<language code>/common.json`) containing all translated keys.
|
|
59
|
+
2. Import and register the language in your i18next `src/i18n.ts`.
|
|
60
|
+
3. Add the new language in `LANGUAGE` variable in `src/constants.ts`.
|
|
61
|
+
4. Add the language code to your language selector or supported languages list.
|
|
62
|
+
5. Switch languages using `i18n.changeLanguage('fr')` and i18next will load the corresponding translations.
|
|
63
|
+
|
|
53
64
|
## 🌐 Embedding the Visualization
|
|
54
65
|
|
|
55
66
|
To embed the visualization on an external page, include:
|
|
@@ -5,7 +5,7 @@ It includes:
|
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* Data fetching with [TanStack Query](https://tanstack.com/query)
|
|
7
7
|
* TailwindCSS
|
|
8
|
-
* Code linting and formatting via
|
|
8
|
+
* Code linting and formatting via Biome
|
|
9
9
|
|
|
10
10
|
## 🧩 Installation
|
|
11
11
|
|
|
@@ -33,24 +33,35 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
33
33
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
34
34
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
35
35
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
36
|
-
- `npm run lint`: Executes `
|
|
36
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
37
37
|
|
|
38
38
|
## 🧰 Tooling Setup
|
|
39
39
|
|
|
40
|
-
This project uses
|
|
40
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
41
41
|
|
|
42
42
|
If you’re using Visual Studio Code, install:
|
|
43
|
-
* [
|
|
44
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
43
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
45
44
|
|
|
46
45
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
47
46
|
|
|
48
|
-
More info: [
|
|
47
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
48
|
+
|
|
49
|
+
__Recommendation__
|
|
50
|
+
|
|
51
|
+
On Visual Studio Code, you can also use the [i18n Ally](https://github.com/lokalise/i18n-ally/wiki) extension for a better translation workflow. It provides features such as translation key autocomplete, inline translation previews, missing key detection, and quick navigation between translation files.
|
|
49
52
|
|
|
50
53
|
## 🎨 Styling
|
|
51
54
|
|
|
52
55
|
This project uses [Tailwind CSS](https://tailwindcss.com/) for styling and and includes pre-configured design tokens from the UNDP Design System.
|
|
53
56
|
|
|
57
|
+
## 🔣 Adding a new language
|
|
58
|
+
|
|
59
|
+
1. Create a new translation file (e.g. `src/locales/<language code>/common.json`) containing all translated keys.
|
|
60
|
+
2. Import and register the language in your i18next `src/i18n.ts`.
|
|
61
|
+
3. Add the new language in `LANGUAGE` variable in `src/constants.ts`.
|
|
62
|
+
4. Add the language code to your language selector or supported languages list.
|
|
63
|
+
5. Switch languages using `i18n.changeLanguage('fr')` and i18next will load the corresponding translations.
|
|
64
|
+
|
|
54
65
|
## 🔍 Data Fetching
|
|
55
66
|
|
|
56
67
|
Data fetching is powered by [TanStack Query](https://tanstack.com/query) for efficient, declarative data fetching and caching.
|
|
@@ -6,7 +6,7 @@ It includes:
|
|
|
6
6
|
* Routing with [TanStack Router](https://tanstack.com/router)
|
|
7
7
|
* Data fetching with [TanStack Query](https://tanstack.com/query)
|
|
8
8
|
* TailwindCSS
|
|
9
|
-
* Code linting and formatting via
|
|
9
|
+
* Code linting and formatting via Biome
|
|
10
10
|
|
|
11
11
|
## 🧩 Installation
|
|
12
12
|
|
|
@@ -34,24 +34,35 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
34
34
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
35
35
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
36
36
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
37
|
-
- `npm run lint`: Executes `
|
|
37
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
38
38
|
|
|
39
39
|
## 🧰 Tooling Setup
|
|
40
40
|
|
|
41
|
-
This project uses
|
|
41
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
42
42
|
|
|
43
43
|
If you’re using Visual Studio Code, install:
|
|
44
|
-
* [
|
|
45
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
44
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
46
45
|
|
|
47
46
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
48
47
|
|
|
49
|
-
More info: [
|
|
48
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
49
|
+
|
|
50
|
+
__Recommendation__
|
|
51
|
+
|
|
52
|
+
On Visual Studio Code, you can also use the [i18n Ally](https://github.com/lokalise/i18n-ally/wiki) extension for a better translation workflow. It provides features such as translation key autocomplete, inline translation previews, missing key detection, and quick navigation between translation files.
|
|
50
53
|
|
|
51
54
|
## 🎨 Styling
|
|
52
55
|
|
|
53
56
|
This project uses [Tailwind CSS](https://tailwindcss.com/) for styling and and includes pre-configured design tokens from the UNDP Design System.
|
|
54
57
|
|
|
58
|
+
## 🔣 Adding a new language
|
|
59
|
+
|
|
60
|
+
1. Create a new translation file (e.g. `src/locales/<language code>/common.json`) containing all translated keys.
|
|
61
|
+
2. Import and register the language in your i18next `src/i18n.ts`.
|
|
62
|
+
3. Add the new language in `LANGUAGE` variable in `src/constants.ts`.
|
|
63
|
+
4. Add the language code to your language selector or supported languages list.
|
|
64
|
+
5. Switch languages using `i18n.changeLanguage('fr')` and i18next will load the corresponding translations.
|
|
65
|
+
|
|
55
66
|
## 🧭 Routing
|
|
56
67
|
|
|
57
68
|
Routing is powered by [TanStack Router](https://tanstack.com/router) and uses a code-based configuration (in the `./src/main.tsx`).
|
|
@@ -102,6 +113,8 @@ import { Link } from "@tanstack/react-router";
|
|
|
102
113
|
|
|
103
114
|
More info: [Link documentation](https://tanstack.com/router/v1/docs/framework/react/api/router/linkComponent).
|
|
104
115
|
|
|
116
|
+
__Please note: Language routing is done at in `src/main.tsx`__
|
|
117
|
+
|
|
105
118
|
## 🔍 Data Fetching
|
|
106
119
|
|
|
107
120
|
Data fetching is powered by [TanStack Query](https://tanstack.com/query) for efficient, declarative data fetching and caching.
|
|
@@ -5,7 +5,7 @@ It includes:
|
|
|
5
5
|
* UNDP Design System
|
|
6
6
|
* Routing with [TanStack Router](https://tanstack.com/router)
|
|
7
7
|
* TailwindCSS
|
|
8
|
-
* Code linting and formatting via
|
|
8
|
+
* Code linting and formatting via Biome
|
|
9
9
|
|
|
10
10
|
## 🧩 Installation
|
|
11
11
|
|
|
@@ -33,24 +33,35 @@ The page will reload if you make edits. You will also see any lint errors in the
|
|
|
33
33
|
- `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
|
|
34
34
|
- `npm run preview`: Executes `vite preview` and serves the static build output (from vite build) locally.
|
|
35
35
|
- `npm run clean`: Executes `rimraf node_modules && rimraf dist && rimraf package-lock.json` and remove node_modules folder, dist folder and package-lock.json.
|
|
36
|
-
- `npm run lint`: Executes `
|
|
36
|
+
- `npm run lint`: Executes `biome check . --write` and resolve all the linting and prettier errors.
|
|
37
37
|
|
|
38
38
|
## 🧰 Tooling Setup
|
|
39
39
|
|
|
40
|
-
This project uses
|
|
40
|
+
This project uses Biome integrated to automatically format and lint your code.
|
|
41
41
|
|
|
42
42
|
If you’re using Visual Studio Code, install:
|
|
43
|
-
* [
|
|
44
|
-
* [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
43
|
+
* [Biome extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
|
|
45
44
|
|
|
46
45
|
Your editor should now show linting errors and automatically fix issues where possible.
|
|
47
46
|
|
|
48
|
-
More info: [
|
|
47
|
+
More info: [Biome Docs](https://biomejs.dev/guides/getting-started/)
|
|
48
|
+
|
|
49
|
+
__Recommendation__
|
|
50
|
+
|
|
51
|
+
On Visual Studio Code, you can also use the [i18n Ally](https://github.com/lokalise/i18n-ally/wiki) extension for a better translation workflow. It provides features such as translation key autocomplete, inline translation previews, missing key detection, and quick navigation between translation files.
|
|
49
52
|
|
|
50
53
|
## 🎨 Styling
|
|
51
54
|
|
|
52
55
|
This project uses [Tailwind CSS](https://tailwindcss.com/) for styling and and includes pre-configured design tokens from the UNDP Design System.
|
|
53
56
|
|
|
57
|
+
## 🔣 Adding a new language
|
|
58
|
+
|
|
59
|
+
1. Create a new translation file (e.g. `src/locales/<language code>/common.json`) containing all translated keys.
|
|
60
|
+
2. Import and register the language in your i18next `src/i18n.ts`.
|
|
61
|
+
3. Add the new language in `LANGUAGE` variable in `src/constants.ts`.
|
|
62
|
+
4. Add the language code to your language selector or supported languages list.
|
|
63
|
+
5. Switch languages using `i18n.changeLanguage('fr')` and i18next will load the corresponding translations.
|
|
64
|
+
|
|
54
65
|
## 🧭 Routing
|
|
55
66
|
|
|
56
67
|
Routing is powered by [TanStack Router](https://tanstack.com/router) and uses a code-based configuration (in the `./src/main.tsx`).
|
|
@@ -101,6 +112,8 @@ import { Link } from "@tanstack/react-router";
|
|
|
101
112
|
|
|
102
113
|
More info: [Link documentation](https://tanstack.com/router/v1/docs/framework/react/api/router/linkComponent).
|
|
103
114
|
|
|
115
|
+
__Please note: Language routing is done at in `src/main.tsx`__
|
|
116
|
+
|
|
104
117
|
## 📬 Contact us
|
|
105
118
|
|
|
106
119
|
For questions or feedback, contact us at [data@undp.org](mailto:data@undp.org).
|