@undp/create-app 0.4.0 → 0.6.0

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.
@@ -1,148 +1,157 @@
1
- import { execSync } from 'child_process';
2
- import chalk from 'chalk';
1
+ import chalk from "chalk";
2
+ import { execSync } from "child_process";
3
3
 
4
4
  function getLatestVersion(pkg) {
5
- try {
6
- return execSync(`npm show ${pkg} version`).toString().trim();
7
- } catch {
8
- return 'latest';
9
- }
5
+ try {
6
+ return execSync(`npm show ${pkg} version`).toString().trim();
7
+ } catch {
8
+ return "latest";
9
+ }
10
10
  }
11
11
 
12
12
  export function generatePackageJson(config) {
13
- console.log(chalk.gray(` Fetching latest version for packages...`));
14
- const designSystemVer = `^${getLatestVersion('@undp/design-system-react')}`
15
- const zustandVer = `^${getLatestVersion('zustand')}`
16
- const dependenciesTemp = config.libraries.includes('peer') && config.libraries.includes('@undp/data-viz') ? {
17
- '@undp/design-system-react': designSystemVer,
18
- '@dnd-kit/core': '^6.3.1',
19
- '@dnd-kit/modifiers': '^9.0.0',
20
- 'ajv': '^8.17.1',
21
- 'dom-to-svg': '^0.12.2',
22
- 'file-saver': '^2.0.5',
23
- 'handlebars': '^4.7.8',
24
- 'maplibre-gl': '^5.12.0',
25
- 'marked': '^16.4.1',
26
- 'math-expression-evaluator': '^2.0.7',
27
- 'pmtiles': '^4.3.0',
28
- 'react': '^19.2.3',
29
- 'react-dom': '^19.2.3',
30
- 'react-globe.gl': '^2.37.0',
31
- 'three': '^0.180.0',
32
- 'zustand': zustandVer
33
- } : {
34
- '@undp/design-system-react': designSystemVer,
35
- 'react': '^19.2.3',
36
- 'react-dom': '^19.2.3',
37
- 'zustand': zustandVer
38
- };
13
+ console.log(chalk.gray(` Fetching latest version for packages...`));
14
+ const designSystemVer = `^${getLatestVersion("@undp/design-system-react")}`;
15
+ const typeScriptVer = `^${getLatestVersion("typescript")}`;
16
+ const zustandVer = `^${getLatestVersion("zustand")}`;
17
+ const tailwindcssVer = `^${getLatestVersion("tailwindcss")}`;
18
+ const twAnimateCssVer = `^${getLatestVersion("tw-animate-css")}`;
19
+ const dependenciesTemp =
20
+ config.libraries.includes("peer") &&
21
+ config.libraries.includes("@undp/data-viz")
22
+ ? {
23
+ "@undp/design-system-react": designSystemVer,
24
+ "@dnd-kit/core": "^6.3.1",
25
+ "@dnd-kit/modifiers": "^9.0.0",
26
+ ajv: "^8.17.1",
27
+ "dom-to-svg": "^0.12.2",
28
+ "file-saver": "^2.0.5",
29
+ handlebars: "^4.7.8",
30
+ "maplibre-gl": "^5.16.0",
31
+ marked: "^18.0.9",
32
+ "math-expression-evaluator": "^2.0.7",
33
+ pmtiles: "^4.3.0",
34
+ react: "^19.2.3",
35
+ "react-dom": "^19.2.3",
36
+ "react-globe.gl": "^2.37.0",
37
+ three: "^0.182.0",
38
+ "tw-animate-css": twAnimateCssVer,
39
+ zustand: zustandVer,
40
+ }
41
+ : {
42
+ "@undp/design-system-react": designSystemVer,
43
+ react: "^19.2.3",
44
+ "react-dom": "^19.2.3",
45
+ "tw-animate-css": twAnimateCssVer,
46
+ zustand: zustandVer,
47
+ };
39
48
 
40
- const dependencies = config.language && !config.framework.includes('next') ? {
41
- ...dependenciesTemp,
42
- 'i18next': '^26.0.8',
43
- 'i18next-browser-languagedetector': '^8.2.1',
44
- 'react-i18next': '^17.0.6',
45
- } : {...dependenciesTemp}
49
+ const dependencies =
50
+ config.language && !config.framework.includes("next")
51
+ ? {
52
+ ...dependenciesTemp,
53
+ i18next: "^26.0.8",
54
+ "i18next-browser-languagedetector": "^8.2.1",
55
+ "react-i18next": "^17.0.6",
56
+ }
57
+ : { ...dependenciesTemp };
46
58
 
47
- switch (config.framework) {
48
- case 'vite-router':
49
- dependencies['@tanstack/react-router'] = '^1.141.1';
50
- break;
51
- case 'next-basic':
52
- dependencies['next'] = '16.0.10';
53
- break;
54
- case 'next-auth':
55
- dependencies['better-auth'] = '^1.3.34';
56
- dependencies['next'] = '16.0.10';
57
- break;
58
- default:
59
- break;
60
- }
61
- if (config.query) {
62
- dependencies['@tanstack/react-query'] = '^5.90.12';
63
- }
64
- if (config.libraries.includes('@undp/data-viz')) {
65
- const dataVizVer = `^${getLatestVersion('@undp/data-viz')}`
66
- dependencies['@undp/data-viz'] = dataVizVer;
67
- }
68
- if (config.libraries.includes('lucide-react')) {
69
- const lucideReactVer = `^${getLatestVersion('lucide-react')}`
70
- dependencies['lucide-react'] = lucideReactVer;
71
- }
72
- const sortedDependencies = Object.fromEntries(
73
- Object.entries(dependencies).sort(([a], [b]) => a.localeCompare(b))
74
- );
75
- const devDependencies = config.framework.includes('vite') ? {
76
- '@biomejs/biome': '^2.4.12',
77
- '@tailwindcss/postcss': '^4.1.17',
78
- '@tailwindcss/vite': '^4.3.0',
79
- '@types/node': '^24.10.0',
80
- '@types/react': '^19.2.7',
81
- '@types/react-dom': '^19.2.3',
82
- '@vitejs/plugin-react': '^6.0.2',
83
- 'autoprefixer': '^10.4.21',
84
- 'postcss': '^8.5.6',
85
- 'postcss-nested': '^7.0.2',
86
- 'rimraf': '^6.1.0',
87
- 'rollup-plugin-visualizer': '^6.0.5',
88
- 'tailwind-animate': '^0.2.10',
89
- 'tailwind-merge': '^3.4.0',
90
- 'tailwindcss': '^4.1.17',
91
- 'tailwindcss-animate': '^1.0.7',
92
- 'typescript': '^5.9.3',
93
- 'vite': '^8.0.13',
94
- 'vite-plugin-static-copy': '^4.1.0'
95
- } : {
96
- '@biomejs/biome': '^2.4.12',
97
- '@tailwindcss/postcss': '^4.1.17',
98
- '@types/node': '^24.10.0',
99
- '@types/react': '^19.2.7',
100
- '@types/react-dom': '^19.2.3',
101
- 'postcss': '^8.5.6',
102
- 'postcss-nested': '^7.0.2',
103
- 'rimraf': '^6.1.0',
104
- 'rollup-plugin-visualizer': '^6.0.5',
105
- 'tailwind-animate': '^0.2.10',
106
- 'tailwind-merge': '^3.3.1',
107
- 'tailwindcss': '^4.1.17',
108
- 'tailwindcss-animate': '^1.0.7',
109
- 'typescript': '^5.9.3',
110
- };
111
- const sortedDevDependencies = Object.fromEntries(
112
- Object.entries(devDependencies).sort(([a], [b]) => a.localeCompare(b))
113
- );
59
+ switch (config.framework) {
60
+ case "vite-router":
61
+ dependencies["@tanstack/react-router"] = "^1.141.1";
62
+ break;
63
+ case "next-basic":
64
+ dependencies["next"] = "16.0.10";
65
+ break;
66
+ case "next-auth":
67
+ dependencies["better-auth"] = "^1.3.34";
68
+ dependencies["next"] = "16.0.10";
69
+ break;
70
+ default:
71
+ break;
72
+ }
73
+ if (config.query) {
74
+ dependencies["@tanstack/react-query"] = "^5.90.12";
75
+ }
76
+ if (config.libraries.includes("@undp/data-viz")) {
77
+ const dataVizVer = `^${getLatestVersion("@undp/data-viz")}`;
78
+ dependencies["@undp/data-viz"] = dataVizVer;
79
+ }
80
+ if (config.libraries.includes("lucide-react")) {
81
+ const lucideReactVer = `^${getLatestVersion("lucide-react")}`;
82
+ dependencies["lucide-react"] = lucideReactVer;
83
+ }
84
+ const sortedDependencies = Object.fromEntries(
85
+ Object.entries(dependencies).sort(([a], [b]) => a.localeCompare(b)),
86
+ );
87
+ const devDependencies = config.framework.includes("vite")
88
+ ? {
89
+ "@biomejs/biome": "^2.4.12",
90
+ "@tailwindcss/postcss": "^4.1.17",
91
+ "@tailwindcss/vite": "^4.3.0",
92
+ "@types/node": "^24.10.0",
93
+ "@types/react": "^19.2.7",
94
+ "@types/react-dom": "^19.2.3",
95
+ "@vitejs/plugin-react": "^6.0.2",
96
+ autoprefixer: "^10.4.21",
97
+ postcss: "^8.5.6",
98
+ "postcss-nested": "^7.0.2",
99
+ rimraf: "^6.1.0",
100
+ "rollup-plugin-visualizer": "^6.0.5",
101
+ tailwindcss: tailwindcssVer,
102
+ typescript: typeScriptVer,
103
+ vite: "^8.0.13",
104
+ "vite-plugin-static-copy": "^4.1.0",
105
+ }
106
+ : {
107
+ "@biomejs/biome": "^2.4.12",
108
+ "@tailwindcss/postcss": "^4.1.17",
109
+ "@types/node": "^24.10.0",
110
+ "@types/react": "^19.2.7",
111
+ "@types/react-dom": "^19.2.3",
112
+ postcss: "^8.5.6",
113
+ "postcss-nested": "^7.0.2",
114
+ rimraf: "^6.1.0",
115
+ "rollup-plugin-visualizer": "^6.0.5",
116
+ tailwindcss: tailwindcssVer,
117
+ typescript: typeScriptVer,
118
+ };
119
+ const sortedDevDependencies = Object.fromEntries(
120
+ Object.entries(devDependencies).sort(([a], [b]) => a.localeCompare(b)),
121
+ );
114
122
 
115
- const packageJson = {
116
- name: config.projectName,
117
- private: true,
118
- version: '0.0.0',
119
- type: 'module',
120
- keywords: [],
121
- author: '',
122
- sideEffects: [
123
- '*.css'
124
- ],
125
- scripts: config.framework.includes('next')
126
- ? {
127
- dev: 'next dev',
128
- build: 'next build',
129
- start: 'next start',
130
- clean: 'rimraf node_modules && rimraf .next && rimraf package-lock.json',
131
- check: 'biome check .',
132
- 'check:fix': 'biome check --write .',
133
- 'check:unsafe': 'biome check --write --unsafe .',
134
- } : {
135
- dev: 'vite',
136
- build: 'tsc && vite build',
137
- preview: 'vite preview',
138
- clean: 'rimraf node_modules && rimraf dist && rimraf package-lock.json',
139
- 'install:build': 'npm install && tsc && vite build',
140
- check: 'biome check .',
141
- 'check:fix': 'biome check --write .',
142
- 'check:unsafe': 'biome check --write --unsafe .',
143
- },
144
- dependencies: sortedDependencies,
145
- devDependencies: sortedDevDependencies
146
- }
147
- return packageJson
148
- }
123
+ const packageJson = {
124
+ name: config.projectName,
125
+ private: true,
126
+ version: "0.0.0",
127
+ type: "module",
128
+ keywords: [],
129
+ author: "",
130
+ sideEffects: ["*.css"],
131
+ scripts: config.framework.includes("next")
132
+ ? {
133
+ dev: "next dev",
134
+ build: "next build",
135
+ start: "next start",
136
+ clean:
137
+ "rimraf node_modules && rimraf .next && rimraf package-lock.json",
138
+ check: "biome check .",
139
+ "check:fix": "biome check --write .",
140
+ "check:unsafe": "biome check --write --unsafe .",
141
+ }
142
+ : {
143
+ dev: "vite",
144
+ build: "tsc && vite build",
145
+ preview: "vite preview",
146
+ clean:
147
+ "rimraf node_modules && rimraf dist && rimraf package-lock.json",
148
+ "install:build": "npm install && tsc && vite build",
149
+ check: "biome check .",
150
+ "check:fix": "biome check --write .",
151
+ "check:unsafe": "biome check --write --unsafe .",
152
+ },
153
+ dependencies: sortedDependencies,
154
+ devDependencies: sortedDevDependencies,
155
+ };
156
+ return packageJson;
157
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@undp/create-app",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "UNDP's project scaffolding tool",
5
5
  "bin": {
6
6
  "create-undp-app": "./bin/index.js"