@undp/create-app 0.1.0 → 0.2.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.
Files changed (276) hide show
  1. package/README.md +62 -0
  2. package/bin/generateFiles/generateIndexHtml.js +18 -0
  3. package/bin/generateFiles/generatePackageJson.js +160 -0
  4. package/bin/{generateTemplates/templates/configFiles/vite.config.ts.txt → generateFiles/generateViteConfig.js} +14 -12
  5. package/bin/generateFiles/index.js +3 -0
  6. package/bin/generateFiles.js +42 -2
  7. package/bin/index.js +38 -14
  8. package/bin/promptUser.js +60 -37
  9. package/bin/templates/next/withDataViz/auth/README.md +108 -0
  10. package/bin/templates/next/withDataViz/auth/app/about/page.tsx +33 -0
  11. package/bin/templates/next/withDataViz/auth/app/api/auth/[...all]/route.ts +5 -0
  12. package/bin/templates/next/withDataViz/auth/app/favicon.ico +0 -0
  13. package/bin/templates/next/withDataViz/auth/app/globals.css +3 -0
  14. package/bin/templates/next/withDataViz/auth/app/layout.tsx +30 -0
  15. package/bin/templates/next/withDataViz/auth/app/login/page.tsx +45 -0
  16. package/bin/templates/next/withDataViz/auth/app/page.tsx +33 -0
  17. package/bin/templates/next/withDataViz/auth/app/user/page.tsx +86 -0
  18. package/bin/templates/next/withDataViz/auth/components/Footer.tsx +16 -0
  19. package/bin/templates/next/withDataViz/auth/components/Header.tsx +56 -0
  20. package/bin/templates/next/withDataViz/auth/eslint.config.mjs +103 -0
  21. package/bin/templates/next/withDataViz/auth/lib/auth-client.ts +7 -0
  22. package/bin/templates/next/withDataViz/auth/lib/auth.ts +30 -0
  23. package/bin/templates/next/withDataViz/auth/next.config.ts +10 -0
  24. package/bin/templates/next/withDataViz/auth/postcss.config.mjs +7 -0
  25. package/bin/templates/next/withDataViz/auth/public/next.svg +1 -0
  26. package/bin/templates/next/withDataViz/auth/tsconfig.json +34 -0
  27. package/bin/templates/next/withDataViz/basic/.prettierrc +10 -0
  28. package/bin/templates/next/withDataViz/basic/README.md +56 -0
  29. package/bin/templates/next/withDataViz/basic/app/about/page.tsx +33 -0
  30. package/bin/templates/next/withDataViz/basic/app/favicon.ico +0 -0
  31. package/bin/templates/next/withDataViz/basic/app/globals.css +3 -0
  32. package/bin/templates/next/withDataViz/basic/app/layout.tsx +31 -0
  33. package/bin/templates/next/withDataViz/basic/app/page.tsx +33 -0
  34. package/bin/templates/next/withDataViz/basic/components/Footer.tsx +16 -0
  35. package/bin/templates/next/withDataViz/basic/components/Header.tsx +27 -0
  36. package/bin/templates/next/withDataViz/basic/eslint.config.mjs +103 -0
  37. package/bin/templates/next/withDataViz/basic/next.config.ts +7 -0
  38. package/bin/templates/next/withDataViz/basic/postcss.config.mjs +7 -0
  39. package/bin/templates/next/withDataViz/basic/public/next.svg +1 -0
  40. package/bin/templates/next/withDataViz/basic/public/undp-logo-blue.svg +1 -0
  41. package/bin/templates/next/withDataViz/basic/tailwind.config.js +7 -0
  42. package/bin/templates/next/withDataViz/basic/tsconfig.json +34 -0
  43. package/bin/templates/next/withoutDataViz/auth/.prettierrc +10 -0
  44. package/bin/templates/next/withoutDataViz/auth/README.md +107 -0
  45. package/bin/templates/next/withoutDataViz/auth/app/about/page.tsx +33 -0
  46. package/bin/templates/next/withoutDataViz/auth/app/api/auth/[...all]/route.ts +5 -0
  47. package/bin/templates/next/withoutDataViz/auth/app/favicon.ico +0 -0
  48. package/bin/templates/next/withoutDataViz/auth/app/globals.css +3 -0
  49. package/bin/templates/next/withoutDataViz/auth/app/layout.tsx +30 -0
  50. package/bin/templates/next/withoutDataViz/auth/app/login/page.tsx +45 -0
  51. package/bin/templates/next/withoutDataViz/auth/app/page.tsx +33 -0
  52. package/bin/templates/next/withoutDataViz/auth/app/user/page.tsx +86 -0
  53. package/bin/templates/next/withoutDataViz/auth/components/Footer.tsx +16 -0
  54. package/bin/templates/next/withoutDataViz/auth/components/Header.tsx +56 -0
  55. package/bin/templates/next/withoutDataViz/auth/eslint.config.mjs +103 -0
  56. package/bin/templates/next/withoutDataViz/auth/lib/auth-client.ts +7 -0
  57. package/bin/templates/next/withoutDataViz/auth/lib/auth.ts +30 -0
  58. package/bin/templates/next/withoutDataViz/auth/next.config.ts +10 -0
  59. package/bin/templates/next/withoutDataViz/auth/postcss.config.mjs +7 -0
  60. package/bin/templates/next/withoutDataViz/auth/public/next.svg +1 -0
  61. package/bin/templates/next/withoutDataViz/auth/public/undp-logo-blue.svg +1 -0
  62. package/bin/templates/next/withoutDataViz/auth/tailwind.config.js +7 -0
  63. package/bin/templates/next/withoutDataViz/auth/tsconfig.json +34 -0
  64. package/bin/templates/next/withoutDataViz/basic/.prettierrc +10 -0
  65. package/bin/templates/next/withoutDataViz/basic/README.md +55 -0
  66. package/bin/templates/next/withoutDataViz/basic/app/about/page.tsx +33 -0
  67. package/bin/templates/next/withoutDataViz/basic/app/favicon.ico +0 -0
  68. package/bin/templates/next/withoutDataViz/basic/app/globals.css +3 -0
  69. package/bin/templates/next/withoutDataViz/basic/app/layout.tsx +31 -0
  70. package/bin/templates/next/withoutDataViz/basic/app/page.tsx +33 -0
  71. package/bin/templates/next/withoutDataViz/basic/components/Footer.tsx +16 -0
  72. package/bin/templates/next/withoutDataViz/basic/components/Header.tsx +27 -0
  73. package/bin/templates/next/withoutDataViz/basic/eslint.config.mjs +103 -0
  74. package/bin/templates/next/withoutDataViz/basic/next.config.ts +7 -0
  75. package/bin/templates/next/withoutDataViz/basic/postcss.config.mjs +7 -0
  76. package/bin/templates/next/withoutDataViz/basic/public/next.svg +1 -0
  77. package/bin/templates/next/withoutDataViz/basic/public/undp-logo-blue.svg +1 -0
  78. package/bin/templates/next/withoutDataViz/basic/tailwind.config.js +7 -0
  79. package/bin/templates/next/withoutDataViz/basic/tsconfig.json +34 -0
  80. package/bin/templates/vite/withDataViz/basic/.prettierrc +10 -0
  81. package/bin/templates/vite/withDataViz/basic/README.md +76 -0
  82. package/bin/{generateTemplates/generateIndexHtml.js → templates/vite/withDataViz/basic/index.html} +3 -5
  83. package/bin/templates/vite/withDataViz/basic/public/favicon.ico +0 -0
  84. package/bin/templates/vite/withDataViz/basic/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  85. package/bin/templates/vite/withDataViz/basic/public/imgs/Vitejs-logo.svg +15 -0
  86. package/bin/templates/vite/withDataViz/basic/public/imgs/undp-logo-blue.svg +1 -0
  87. package/bin/templates/vite/withDataViz/basic/src/App.tsx +38 -0
  88. package/bin/templates/vite/withDataViz/basic/src/assets/undp-logo-blue.svg +1 -0
  89. package/bin/templates/vite/withDataViz/basic/src/components/Footer.tsx +14 -0
  90. package/bin/{generateTemplates/templates/router/components/Header.txt → templates/vite/withDataViz/basic/src/components/Header.tsx} +8 -12
  91. package/bin/templates/vite/withDataViz/basic/src/styles/style.css +4 -0
  92. package/bin/templates/vite/withDataViz/basic/src/vite-env.d.ts +1 -0
  93. package/bin/templates/vite/withDataViz/basic/tailwind.config.js +7 -0
  94. package/bin/{generateTemplates/templates/configFiles → templates/vite/withDataViz/basic}/tsconfig.json +1 -1
  95. package/bin/{generateTemplates/templates/configFiles/viteWithoutPostCss.config.ts.txt → templates/vite/withDataViz/basic/vite.config.ts} +17 -1
  96. package/bin/templates/vite/withDataViz/query/.prettierrc +10 -0
  97. package/bin/templates/vite/withDataViz/query/README.md +80 -0
  98. package/bin/templates/vite/withDataViz/query/eslint.config.mjs +97 -0
  99. package/bin/templates/vite/withDataViz/query/index.html +13 -0
  100. package/bin/templates/vite/withDataViz/query/public/favicon.ico +0 -0
  101. package/bin/templates/vite/withDataViz/query/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  102. package/bin/templates/vite/withDataViz/query/public/imgs/Vitejs-logo.svg +15 -0
  103. package/bin/templates/vite/withDataViz/query/public/imgs/logo-color-600.png +0 -0
  104. package/bin/templates/vite/withDataViz/query/public/imgs/undp-logo-blue.svg +1 -0
  105. package/bin/templates/vite/withDataViz/query/src/App.tsx +70 -0
  106. package/bin/templates/vite/withDataViz/query/src/assets/undp-logo-blue.svg +1 -0
  107. package/bin/templates/vite/withDataViz/query/src/components/Footer.tsx +14 -0
  108. package/bin/templates/vite/withDataViz/query/src/components/Header.tsx +25 -0
  109. package/bin/templates/vite/withDataViz/query/src/integration/tanstack-query.tsx +27 -0
  110. package/bin/templates/vite/withDataViz/query/src/main.tsx +21 -0
  111. package/bin/templates/vite/withDataViz/query/src/styles/fonts.css +213 -0
  112. package/bin/templates/vite/withDataViz/query/src/styles/style.css +4 -0
  113. package/bin/templates/vite/withDataViz/query/src/vite-env.d.ts +1 -0
  114. package/bin/templates/vite/withDataViz/query/tailwind.config.js +7 -0
  115. package/bin/templates/vite/withDataViz/query/tsconfig.json +29 -0
  116. package/bin/templates/vite/withDataViz/query/tsconfig.node.json +9 -0
  117. package/bin/templates/vite/withDataViz/query/vite.config.ts +75 -0
  118. package/bin/templates/vite/withDataViz/query+router/.prettierrc +10 -0
  119. package/bin/templates/vite/withDataViz/query+router/README.md +112 -0
  120. package/bin/templates/vite/withDataViz/query+router/eslint.config.mjs +97 -0
  121. package/bin/templates/vite/withDataViz/query+router/index.html +13 -0
  122. package/bin/templates/vite/withDataViz/query+router/public/favicon.ico +0 -0
  123. package/bin/templates/vite/withDataViz/query+router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  124. package/bin/templates/vite/withDataViz/query+router/public/imgs/Vitejs-logo.svg +15 -0
  125. package/bin/templates/vite/withDataViz/query+router/public/imgs/logo-color-600.png +0 -0
  126. package/bin/templates/vite/withDataViz/query+router/public/imgs/undp-logo-blue.svg +1 -0
  127. package/bin/templates/vite/withDataViz/query+router/src/App.tsx +42 -0
  128. package/bin/templates/vite/withDataViz/query+router/src/assets/undp-logo-blue.svg +1 -0
  129. package/bin/templates/vite/withDataViz/query+router/src/components/Footer.tsx +14 -0
  130. package/bin/{generateTemplates/templates/router+query/components/Header.txt → templates/vite/withDataViz/query+router/src/components/Header.tsx} +8 -12
  131. package/bin/{generateTemplates/templates/router+query/integration/tanstack-query.txt → templates/vite/withDataViz/query+router/src/integration/tanstack-query.tsx} +5 -5
  132. package/bin/{generateTemplates/templates/router+query/main.txt → templates/vite/withDataViz/query+router/src/main.tsx} +15 -11
  133. package/bin/templates/vite/withDataViz/query+router/src/routes/queryDemo.tsx +73 -0
  134. package/bin/templates/vite/withDataViz/query+router/src/styles/fonts.css +213 -0
  135. package/bin/templates/vite/withDataViz/query+router/src/styles/style.css +4 -0
  136. package/bin/templates/vite/withDataViz/query+router/src/vite-env.d.ts +1 -0
  137. package/bin/templates/vite/withDataViz/query+router/tailwind.config.js +7 -0
  138. package/bin/templates/vite/withDataViz/query+router/tsconfig.json +29 -0
  139. package/bin/templates/vite/withDataViz/query+router/tsconfig.node.json +9 -0
  140. package/bin/templates/vite/withDataViz/query+router/vite.config.ts +75 -0
  141. package/bin/templates/vite/withDataViz/router/.prettierrc +10 -0
  142. package/bin/templates/vite/withDataViz/router/README.md +107 -0
  143. package/bin/templates/vite/withDataViz/router/eslint.config.mjs +97 -0
  144. package/bin/templates/vite/withDataViz/router/index.html +13 -0
  145. package/bin/templates/vite/withDataViz/router/public/favicon.ico +0 -0
  146. package/bin/templates/vite/withDataViz/router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  147. package/bin/templates/vite/withDataViz/router/public/imgs/Vitejs-logo.svg +15 -0
  148. package/bin/templates/vite/withDataViz/router/public/imgs/logo-color-600.png +0 -0
  149. package/bin/templates/vite/withDataViz/router/public/imgs/undp-logo-blue.svg +1 -0
  150. package/bin/templates/vite/withDataViz/router/src/App.tsx +51 -0
  151. package/bin/templates/vite/withDataViz/router/src/assets/undp-logo-blue.svg +1 -0
  152. package/bin/templates/vite/withDataViz/router/src/components/Footer.tsx +14 -0
  153. package/bin/templates/vite/withDataViz/router/src/components/Header.tsx +25 -0
  154. package/bin/{generateTemplates/templates/router/main.txt → templates/vite/withDataViz/router/src/main.tsx} +18 -12
  155. package/bin/templates/vite/withDataViz/router/src/routes/about.tsx +73 -0
  156. package/bin/templates/vite/withDataViz/router/src/styles/fonts.css +213 -0
  157. package/bin/templates/vite/withDataViz/router/src/styles/style.css +4 -0
  158. package/bin/templates/vite/withDataViz/router/src/vite-env.d.ts +1 -0
  159. package/bin/templates/vite/withDataViz/router/tailwind.config.js +7 -0
  160. package/bin/templates/vite/withDataViz/router/tsconfig.json +29 -0
  161. package/bin/templates/vite/withDataViz/router/tsconfig.node.json +9 -0
  162. package/bin/templates/vite/withDataViz/router/vite.config.ts +75 -0
  163. package/bin/templates/vite/withoutDataViz/basic/.prettierrc +10 -0
  164. package/bin/templates/vite/withoutDataViz/basic/README.md +75 -0
  165. package/bin/templates/vite/withoutDataViz/basic/eslint.config.mjs +97 -0
  166. package/bin/templates/vite/withoutDataViz/basic/index.html +13 -0
  167. package/bin/templates/vite/withoutDataViz/basic/public/favicon.ico +0 -0
  168. package/bin/templates/vite/withoutDataViz/basic/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  169. package/bin/templates/vite/withoutDataViz/basic/public/imgs/Vitejs-logo.svg +15 -0
  170. package/bin/templates/vite/withoutDataViz/basic/public/imgs/undp-logo-blue.svg +1 -0
  171. package/bin/templates/vite/withoutDataViz/basic/src/App.tsx +38 -0
  172. package/bin/templates/vite/withoutDataViz/basic/src/assets/undp-logo-blue.svg +1 -0
  173. package/bin/templates/vite/withoutDataViz/basic/src/components/Footer.tsx +14 -0
  174. package/bin/templates/vite/withoutDataViz/basic/src/components/Header.tsx +25 -0
  175. package/bin/templates/vite/withoutDataViz/basic/src/main.tsx +10 -0
  176. package/bin/templates/vite/withoutDataViz/basic/src/styles/fonts.css +213 -0
  177. package/bin/templates/vite/withoutDataViz/basic/src/styles/style.css +3 -0
  178. package/bin/templates/vite/withoutDataViz/basic/src/vite-env.d.ts +1 -0
  179. package/bin/templates/vite/withoutDataViz/basic/tailwind.config.js +7 -0
  180. package/bin/templates/vite/withoutDataViz/basic/tsconfig.json +29 -0
  181. package/bin/templates/vite/withoutDataViz/basic/tsconfig.node.json +9 -0
  182. package/bin/templates/vite/withoutDataViz/basic/vite.config.ts +75 -0
  183. package/bin/templates/vite/withoutDataViz/query/.prettierrc +10 -0
  184. package/bin/templates/vite/withoutDataViz/query/README.md +80 -0
  185. package/bin/templates/vite/withoutDataViz/query/eslint.config.mjs +97 -0
  186. package/bin/templates/vite/withoutDataViz/query/index.html +13 -0
  187. package/bin/templates/vite/withoutDataViz/query/public/favicon.ico +0 -0
  188. package/bin/templates/vite/withoutDataViz/query/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  189. package/bin/templates/vite/withoutDataViz/query/public/imgs/Vitejs-logo.svg +15 -0
  190. package/bin/templates/vite/withoutDataViz/query/public/imgs/logo-color-600.png +0 -0
  191. package/bin/templates/vite/withoutDataViz/query/public/imgs/undp-logo-blue.svg +1 -0
  192. package/bin/templates/vite/withoutDataViz/query/src/App.tsx +70 -0
  193. package/bin/templates/vite/withoutDataViz/query/src/assets/undp-logo-blue.svg +1 -0
  194. package/bin/templates/vite/withoutDataViz/query/src/components/Footer.tsx +14 -0
  195. package/bin/templates/vite/withoutDataViz/query/src/components/Header.tsx +25 -0
  196. package/bin/templates/vite/withoutDataViz/query/src/integration/tanstack-query.tsx +27 -0
  197. package/bin/templates/vite/withoutDataViz/query/src/main.tsx +21 -0
  198. package/bin/templates/vite/withoutDataViz/query/src/styles/fonts.css +213 -0
  199. package/bin/templates/vite/withoutDataViz/query/src/styles/style.css +3 -0
  200. package/bin/templates/vite/withoutDataViz/query/src/vite-env.d.ts +1 -0
  201. package/bin/templates/vite/withoutDataViz/query/tailwind.config.js +7 -0
  202. package/bin/templates/vite/withoutDataViz/query/tsconfig.json +29 -0
  203. package/bin/templates/vite/withoutDataViz/query/tsconfig.node.json +9 -0
  204. package/bin/templates/vite/withoutDataViz/query/vite.config.ts +75 -0
  205. package/bin/templates/vite/withoutDataViz/query+router/.prettierrc +10 -0
  206. package/bin/templates/vite/withoutDataViz/query+router/README.md +111 -0
  207. package/bin/templates/vite/withoutDataViz/query+router/eslint.config.mjs +97 -0
  208. package/bin/templates/vite/withoutDataViz/query+router/index.html +13 -0
  209. package/bin/templates/vite/withoutDataViz/query+router/public/favicon.ico +0 -0
  210. package/bin/templates/vite/withoutDataViz/query+router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  211. package/bin/templates/vite/withoutDataViz/query+router/public/imgs/Vitejs-logo.svg +15 -0
  212. package/bin/templates/vite/withoutDataViz/query+router/public/imgs/logo-color-600.png +0 -0
  213. package/bin/templates/vite/withoutDataViz/query+router/public/imgs/undp-logo-blue.svg +1 -0
  214. package/bin/templates/vite/withoutDataViz/query+router/src/App.tsx +42 -0
  215. package/bin/templates/vite/withoutDataViz/query+router/src/assets/undp-logo-blue.svg +1 -0
  216. package/bin/templates/vite/withoutDataViz/query+router/src/components/Footer.tsx +14 -0
  217. package/bin/templates/vite/withoutDataViz/query+router/src/components/Header.tsx +25 -0
  218. package/bin/templates/vite/withoutDataViz/query+router/src/integration/tanstack-query.tsx +27 -0
  219. package/bin/templates/vite/withoutDataViz/query+router/src/main.tsx +73 -0
  220. package/bin/templates/vite/withoutDataViz/query+router/src/routes/queryDemo.tsx +73 -0
  221. package/bin/templates/vite/withoutDataViz/query+router/src/styles/fonts.css +213 -0
  222. package/bin/templates/vite/withoutDataViz/query+router/src/styles/style.css +3 -0
  223. package/bin/templates/vite/withoutDataViz/query+router/src/vite-env.d.ts +1 -0
  224. package/bin/templates/vite/withoutDataViz/query+router/tailwind.config.js +7 -0
  225. package/bin/templates/vite/withoutDataViz/query+router/tsconfig.json +29 -0
  226. package/bin/templates/vite/withoutDataViz/query+router/tsconfig.node.json +9 -0
  227. package/bin/templates/vite/withoutDataViz/query+router/vite.config.ts +75 -0
  228. package/bin/templates/vite/withoutDataViz/router/.prettierrc +10 -0
  229. package/bin/templates/vite/withoutDataViz/router/README.md +106 -0
  230. package/bin/templates/vite/withoutDataViz/router/eslint.config.mjs +97 -0
  231. package/bin/templates/vite/withoutDataViz/router/index.html +13 -0
  232. package/bin/templates/vite/withoutDataViz/router/public/favicon.ico +0 -0
  233. package/bin/templates/vite/withoutDataViz/router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
  234. package/bin/templates/vite/withoutDataViz/router/public/imgs/Vitejs-logo.svg +15 -0
  235. package/bin/templates/vite/withoutDataViz/router/public/imgs/logo-color-600.png +0 -0
  236. package/bin/templates/vite/withoutDataViz/router/public/imgs/undp-logo-blue.svg +1 -0
  237. package/bin/templates/vite/withoutDataViz/router/src/App.tsx +51 -0
  238. package/bin/templates/vite/withoutDataViz/router/src/assets/undp-logo-blue.svg +1 -0
  239. package/bin/templates/vite/withoutDataViz/router/src/components/Footer.tsx +14 -0
  240. package/bin/templates/vite/withoutDataViz/router/src/components/Header.tsx +25 -0
  241. package/bin/templates/vite/withoutDataViz/router/src/main.tsx +66 -0
  242. package/bin/templates/vite/withoutDataViz/router/src/routes/about.tsx +73 -0
  243. package/bin/templates/vite/withoutDataViz/router/src/styles/fonts.css +213 -0
  244. package/bin/templates/vite/withoutDataViz/router/src/styles/style.css +4 -0
  245. package/bin/templates/vite/withoutDataViz/router/src/vite-env.d.ts +1 -0
  246. package/bin/templates/vite/withoutDataViz/router/tailwind.config.js +7 -0
  247. package/bin/templates/vite/withoutDataViz/router/tsconfig.json +29 -0
  248. package/bin/templates/vite/withoutDataViz/router/tsconfig.node.json +9 -0
  249. package/bin/templates/vite/withoutDataViz/router/vite.config.ts +75 -0
  250. package/bin/utils/printSuccess.js +0 -9
  251. package/package.json +6 -2
  252. package/bin/generateTemplates/copyTemplate.js +0 -18
  253. package/bin/generateTemplates/generatePackageJson.js +0 -105
  254. package/bin/generateTemplates/generateReadme.js +0 -143
  255. package/bin/generateTemplates/generateStyleCss.js +0 -6
  256. package/bin/generateTemplates/index.js +0 -6
  257. package/bin/generateTemplates/templates/basic/App.txt +0 -32
  258. package/bin/generateTemplates/templates/basic/AppWithContainer.txt +0 -32
  259. package/bin/generateTemplates/templates/configFiles/staticwebapp.config.json +0 -44
  260. package/bin/generateTemplates/templates/configFiles/vite-env.txt +0 -1
  261. package/bin/generateTemplates/templates/query/App.txt +0 -57
  262. package/bin/generateTemplates/templates/query/AppWithContainer.txt +0 -67
  263. package/bin/generateTemplates/templates/query/main.txt +0 -29
  264. package/bin/generateTemplates/templates/router/App.txt +0 -30
  265. package/bin/generateTemplates/templates/router/components/Footer.txt +0 -20
  266. package/bin/generateTemplates/templates/router/routes/About.txt +0 -28
  267. package/bin/generateTemplates/templates/router+query/App.txt +0 -30
  268. package/bin/generateTemplates/templates/router+query/components/Footer.txt +0 -20
  269. package/bin/generateTemplates/templates/router+query/routes/queryDemo.txt +0 -56
  270. /package/bin/{generateTemplates/templates/configFiles → templates/next/withDataViz/auth}/.prettierrc +0 -0
  271. /package/bin/{generateTemplates/templates/configFiles/icon.txt → templates/next/withDataViz/auth/public/undp-logo-blue.svg} +0 -0
  272. /package/bin/{generateTemplates/templates/configFiles → templates/next/withDataViz/auth}/tailwind.config.js +0 -0
  273. /package/bin/{generateTemplates/templates/configFiles/eslint.config.js → templates/vite/withDataViz/basic/eslint.config.mjs} +0 -0
  274. /package/bin/{generateTemplates/templates/basic/main.txt → templates/vite/withDataViz/basic/src/main.tsx} +0 -0
  275. /package/bin/{generateTemplates/templates/css → templates/vite/withDataViz/basic/src/styles}/fonts.css +0 -0
  276. /package/bin/{generateTemplates/templates/configFiles → templates/vite/withDataViz/basic}/tsconfig.node.json +0 -0
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # 🏗️ UNDP Create App CLI ![npm](https://img.shields.io/npm/v/@undp/create-app)
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 ESLint, Prettier, and UNDP’s Design System.
4
+
5
+ [NPM Package](https://www.npmjs.com/package/@undp/create-app)
6
+
7
+ ---
8
+
9
+ ## 🚀 Features
10
+
11
+ - ⚡ **React + TypeScript + TailwindCSS** setup out of the box
12
+ - 🚀 **Vite support** for fast SPA development, including optional **state management**, and **routing** using **tanstack libraries**
13
+ - 🌐 **Next.js support** for full-stack apps, including optional **authentication (Auth)** using **Better Auth**
14
+ - 🧱 Preconfigured for UNDP’s Design System
15
+ - 📊 Optional integration with **@undp/data-viz** for data visualization
16
+ - 🧼 ESLint + Prettier ready
17
+
18
+ ---
19
+
20
+ ## 🧩 Pre-configured setups
21
+
22
+ - Vite + Tailwind
23
+ - Lightweight and blazing fast React starter (ideal if you are planning to embed the SPA in another page)
24
+ - Vite + Tailwind + Query
25
+ - Optimized starter with data fetching powered by TanStack Query (ideal if you are planning to embed the SPA in another page)
26
+ - Vite + Tailwind + Router
27
+ - Fast starter with built-in routing support
28
+ - Vite + Tailwind + Router + Query
29
+ - Complete Vite setup for routing and data management
30
+ - Next.js + Tailwind
31
+ - Production-ready React framework with file-based routing and SSR
32
+ - Next.js + Tailwind + Auth
33
+ - Secure, full-stack framework with authentication and SSR
34
+
35
+ ---
36
+
37
+ ## 📦 Installation
38
+
39
+ You don’t need to install it globally — just use **npx**:
40
+
41
+ ```bash
42
+ npx @undp/create-app my-project
43
+ ```
44
+
45
+ or install it globally
46
+
47
+ ```bash
48
+ npm install -g @undp/create-app
49
+ create-undp-app my-project
50
+ ```
51
+
52
+ ---
53
+
54
+ ## 📦 Getting started
55
+
56
+ After running the CLI, navigate into your project and start the dev server:
57
+
58
+ ```bash
59
+ cd my-project && npm run dev
60
+ ```
61
+
62
+ *Please note: If you have not installed the dependencies then you might want to run `npm install` before `npm run dev`.*
@@ -0,0 +1,18 @@
1
+ export function generateIndexHtml(config) {
2
+ return `<!doctype html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <title>${config.projectName}</title>
9
+ </head>
10
+ <body>
11
+ ${!config.addPostCSSScripts ? `<div id="root"></div>` : `<div id="undp-container">
12
+ <div id="root"></div>
13
+ </div>` }
14
+ <script type="module" src="/src/main.tsx"></script>
15
+ </body>
16
+ </html>
17
+ `
18
+ }
@@ -0,0 +1,160 @@
1
+ import { execSync } from 'child_process';
2
+ import chalk from 'chalk';
3
+
4
+ function getLatestVersion(pkg) {
5
+ console.log(chalk.gray(` Fetching latest version for ${pkg}`));
6
+ try {
7
+ return execSync(`npm show ${pkg} version`).toString().trim();
8
+ } catch {
9
+ return 'latest';
10
+ }
11
+ }
12
+
13
+ export function generatePackageJson(config) {
14
+ const designSystemVer = `^${getLatestVersion('@undp/design-system-react')}`
15
+ const dataVizVer = `^${getLatestVersion('@undp/data-viz')}`
16
+ const lucideReactVer = `^${getLatestVersion('lucide-react')}`
17
+ const dependencies = config.libraries.includes('peer') && config.libraries.includes('@undp/data-viz') ? {
18
+ "@undp/design-system-react": designSystemVer,
19
+ "react": "^19.2.0",
20
+ "react-dom": "^19.2.0",
21
+ "@dnd-kit/core": "^6.3.1",
22
+ "@dnd-kit/modifiers": "^9.0.0",
23
+ "ajv": "^8.17.1",
24
+ "dom-to-svg": "^0.12.2",
25
+ "file-saver": "^2.0.5",
26
+ "handlebars": "^4.7.8",
27
+ "maplibre-gl": "^5.12.0",
28
+ "marked": "^16.4.1",
29
+ "math-expression-evaluator": "^2.0.7",
30
+ "pmtiles": "^4.3.0",
31
+ "react-globe.gl": "^2.37.0",
32
+ "three": "^0.180.0"
33
+ } : {
34
+ "@undp/design-system-react": designSystemVer,
35
+ "react": "^19.2.0",
36
+ "react-dom": "^19.2.0",
37
+ };
38
+
39
+ switch (config.framework) {
40
+ case 'vite-query':
41
+ dependencies['@tanstack/react-query'] = '^5.90.7';
42
+ break;
43
+ case 'vite-router':
44
+ dependencies['@tanstack/react-router'] = '^1.135.0';
45
+ break;
46
+ case 'vite-full':
47
+ dependencies['@tanstack/react-query'] = '^5.90.7';
48
+ dependencies['@tanstack/react-router'] = '^1.135.0';
49
+ break;
50
+ case 'next-basic':
51
+ dependencies['next'] = '16.0.1';
52
+ break;
53
+ case 'next-auth':
54
+ dependencies['better-auth'] = '^1.3.34';
55
+ dependencies['next'] = '16.0.1';
56
+ break;
57
+ default:
58
+ break;
59
+ }
60
+ if (config.libraries.includes('@undp/data-viz')) {
61
+ dependencies['@undp/data-viz'] = dataVizVer;
62
+ }
63
+ if (config.libraries.includes('lucide-react')) {
64
+ dependencies['lucide-react'] = lucideReactVer;
65
+ }
66
+ const devDependencies = config.framework !== 'next-basic' && config.framework !== 'next-auth' ? {
67
+ "@eslint/config-array": "^0.21.1",
68
+ "@eslint/js": "^9.39.1",
69
+ "@nabla/vite-plugin-eslint": "^2.0.6",
70
+ "@tailwindcss/postcss": "^4.1.17",
71
+ "@types/node": "^24.10.0",
72
+ "@types/react": "^19.2.2",
73
+ "@types/react-dom": "^19.2.2",
74
+ "autoprefixer": "^10.4.21",
75
+ "babel-plugin-react-compiler": "^1.0.0",
76
+ "eslint": "^9.39.1",
77
+ "eslint-config-love": "^133.0.0",
78
+ "eslint-config-prettier": "^10.1.8",
79
+ "eslint-plugin-import": "^2.32.0",
80
+ "eslint-plugin-jsx-a11y": "^6.10.2",
81
+ "eslint-plugin-n": "^17.23.1",
82
+ "eslint-plugin-prettier": "^5.5.4",
83
+ "eslint-plugin-promise": "^7.2.1",
84
+ "eslint-plugin-react": "^7.37.5",
85
+ "eslint-plugin-react-hooks": "^7.0.1",
86
+ "postcss": "^8.5.6",
87
+ "postcss-nested": "^7.0.2",
88
+ "prettier": "^3.6.2",
89
+ "rimraf": "^6.1.0",
90
+ "rollup-plugin-visualizer": "^6.0.5",
91
+ "tailwind-animate": "^0.2.10",
92
+ "tailwind-merge": "^3.4.0",
93
+ "tailwindcss": "^4.1.17",
94
+ "tailwindcss-animate": "^1.0.7",
95
+ "typescript": "^5.9.3",
96
+ "typescript-eslint": "^8.46.3",
97
+ "vite": "^7.2.2",
98
+ "vite-plugin-static-copy": "^3.1.4",
99
+ "@vitejs/plugin-react": "^5.1.0",
100
+ "@tailwindcss/vite": "^4.1.17"
101
+ } : {
102
+ "@eslint/js": "^9.39.1",
103
+ "@tailwindcss/postcss": "^4.1.17",
104
+ "@types/node": "^24.10.0",
105
+ "@types/react": "^19.2.2",
106
+ "@types/react-dom": "^19.2.2",
107
+ "eslint": "^9.39.1",
108
+ "eslint-config-love": "^133.0.0",
109
+ "eslint-config-next": "16.0.1",
110
+ "eslint-config-prettier": "^10.1.8",
111
+ "eslint-plugin-import": "^2.32.0",
112
+ "eslint-plugin-jsx-a11y": "^6.10.2",
113
+ "eslint-plugin-n": "^17.23.1",
114
+ "eslint-plugin-prettier": "^5.5.4",
115
+ "eslint-plugin-promise": "^7.2.1",
116
+ "eslint-plugin-react": "^7.37.5",
117
+ "eslint-plugin-react-hooks": "^7.0.1",
118
+ "postcss": "^8.5.6",
119
+ "postcss-nested": "^7.0.2",
120
+ "prettier": "^3.6.2",
121
+ "rimraf": "^6.1.0",
122
+ "rollup-plugin-visualizer": "^6.0.5",
123
+ "tailwind-animate": "^0.2.10",
124
+ "tailwind-merge": "^3.3.1",
125
+ "tailwindcss": "^4.1.17",
126
+ "tailwindcss-animate": "^1.0.7",
127
+ "typescript": "^5.9.3",
128
+ "typescript-eslint": "^8.46.3"
129
+ };
130
+
131
+ const packageJson = {
132
+ name: config.projectName,
133
+ private: true,
134
+ version: '0.0.0',
135
+ type: 'module',
136
+ keywords: [],
137
+ author: '',
138
+ sideEffects: [
139
+ '*.css'
140
+ ],
141
+ scripts: config.framework === 'next'
142
+ ? {
143
+ dev: 'next dev',
144
+ build: 'next build',
145
+ start: 'next start',
146
+ clean: 'rimraf node_modules && rimraf .next && rimraf package-lock.json',
147
+ lint: 'npx eslint --fix && npx prettier . --write'
148
+ } : {
149
+ dev: 'vite',
150
+ build: 'tsc && vite build',
151
+ preview: 'vite preview',
152
+ clean: 'rimraf node_modules && rimraf dist && rimraf package-lock.json',
153
+ 'install:build': 'npm install && tsc && vite build',
154
+ lint: 'npx eslint --fix && npx prettier . --write'
155
+ },
156
+ dependencies: dependencies,
157
+ devDependencies: devDependencies
158
+ }
159
+ return packageJson
160
+ }
@@ -1,13 +1,12 @@
1
- import path from 'path';
2
-
1
+ export function generateViteConfig(config) {
2
+ return `import path from 'path';
3
3
  import { defineConfig } from 'vite';
4
4
  import react from '@vitejs/plugin-react';
5
5
  import eslint from '@nabla/vite-plugin-eslint';
6
- import { AtRule } from 'postcss';
7
6
  import { visualizer } from 'rollup-plugin-visualizer';
8
7
  import postcssNested from 'postcss-nested';
9
- import tailwindcss from '@tailwindcss/postcss';
10
- import { viteStaticCopy } from 'vite-plugin-static-copy';
8
+ import tailwindcss from '@tailwindcss/postcss';${config.addStaticWebAppConfig ? `
9
+ import { viteStaticCopy } from 'vite-plugin-static-copy';` : ''}
11
10
 
12
11
  export default defineConfig({
13
12
  plugins: [
@@ -17,16 +16,16 @@ export default defineConfig({
17
16
  },
18
17
  }),
19
18
  eslint(),
20
- visualizer({ filename: 'stats.html', open: true }),
19
+ visualizer({ filename: 'stats.html', open: true }),${config.addStaticWebAppConfig ? `
21
20
  viteStaticCopy({
22
21
  targets: [{ src: 'staticwebapp.config.json', dest: '' }],
23
- }),
22
+ }),` : ''}
24
23
  ],
25
24
  css: {
26
25
  postcss: {
27
26
  plugins: [
28
27
  postcssNested(),
29
- tailwindcss(),
28
+ tailwindcss(),${config.addPostCSSScripts ? `
30
29
  {
31
30
  postcssPlugin: 'remove-layers', // If you want to flatten layers except base layer
32
31
  AtRule: {
@@ -55,11 +54,11 @@ export default defineConfig({
55
54
  if (selector.startsWith('.undp-container')) return selector;
56
55
  if (skipSelectors.some(skip => selector.startsWith(skip)))
57
56
  return selector;
58
- return `.undp-container ${selector}`;
57
+ return \`.undp-container \${selector}\`;
59
58
  });
60
59
  });
61
60
  },
62
- },
61
+ },` : ''}
63
62
  {
64
63
  postcssPlugin: 'move-media-queries-last', // If you want to reorder media queries to the end
65
64
  OnceExit(root) {
@@ -87,8 +86,8 @@ export default defineConfig({
87
86
  output: {
88
87
  manualChunks(id) {
89
88
  if (id.includes('node_modules/react')) return 'react';
90
- if (id.includes('@undp/design-system-react')) return 'undp';
91
- if (id.includes('@undp/data-viz')) return 'undp';
89
+ if (id.includes('@undp/design-system-react')) return 'undp';${config.libraries.includes('@undp/data-viz') ? `
90
+ if (id.includes('@undp/data-viz')) return 'undp';` : ''}
92
91
  },
93
92
  chunkFileNames: '[name]-[hash].js',
94
93
  assetFileNames: '[name].[ext]',
@@ -107,3 +106,6 @@ export default defineConfig({
107
106
  },
108
107
  resolve: { alias: { '@': path.resolve(__dirname, './src') } },
109
108
  });
109
+ `
110
+ }
111
+
@@ -0,0 +1,3 @@
1
+ export { generatePackageJson } from './generatePackageJson.js';
2
+ export { generateViteConfig } from './generateViteConfig.js';
3
+ export { generateIndexHtml } from './generateIndexHtml.js';
@@ -5,7 +5,8 @@ import {
5
5
  generateReadme,
6
6
  generateStyleCss,
7
7
  copyTemplate,
8
- } from './generateTemplates/index.js';
8
+ generateNextLayout,
9
+ } from './generateFiles/index.js';
9
10
 
10
11
  export function generateFiles(config) {
11
12
  // Main files
@@ -44,7 +45,7 @@ export function generateFiles(config) {
44
45
 
45
46
  // Config files
46
47
  console.log(chalk.bold.yellow('\n⚙️ Creating configuration and tooling files...'));
47
- copyTemplate('eslint.config.js', 'eslint.config.js', ['templates', 'configFiles']);
48
+ copyTemplate('eslint.config.mjs', 'eslint.config.mjs', ['templates', 'configFiles']);
48
49
  copyTemplate('.prettierrc', '.prettierrc', ['templates', 'configFiles']);
49
50
  copyTemplate('vite.config.ts', config.addPostCSSScripts ? 'vite.config.ts.txt' : 'viteWithoutPostCss.config.ts.txt', ['templates', 'configFiles']);
50
51
  fs.writeFileSync('src/vite-env.d.ts', `/// <reference types="vite/client" />`);
@@ -58,6 +59,45 @@ export function generateFiles(config) {
58
59
  fs.writeFileSync('README.md', generateReadme(config));
59
60
  console.log(chalk.green(' ✓ Created ESLint, Prettier, Vite, TypeScript, Tailwind, and other configs.'));
60
61
 
62
+ // Package.json
63
+ console.log(chalk.bold.yellow('\n📜 Creating package.json and scripts...'));
64
+ fs.writeFileSync('package.json', JSON.stringify(generatePackageJson(config), null, 2));
65
+ console.log(chalk.green(' ✓ Created package.json.'));
66
+ }
67
+
68
+
69
+ export function generateNextFiles(config) {
70
+ // Main files
71
+ copyTemplate('public/undp-logo-blue.svg', 'icon.txt', ['templates', 'configFiles']);
72
+ fs.writeFileSync('src/styles/style.css', generateStyleCss(config.installDataViz));
73
+ copyTemplate('src/styles/fonts.css', 'fonts.css', ['templates', 'css']);
74
+ fs.writeFileSync('src/app/layout.tsx', generateNextLayout(config.projectName));
75
+ copyTemplate('src/app/page.tsx', 'page.txt', ['templates', 'next']);
76
+ copyTemplate('src/app/head.tsx', 'head.txt', ['templates', 'next']);
77
+ copyTemplate('src/app/about/page.tsx', 'About.txt', ['templates', 'next', 'routes']);
78
+ copyTemplate('src/components/Header.tsx', 'Header.txt', ['templates', 'next', 'components']);
79
+ copyTemplate('src/components/Footer.tsx', 'Footer.txt', ['templates', 'next', 'components']);
80
+ console.log(chalk.green(' ✓ Created core files and base styles.'));
81
+
82
+ // Config files
83
+ console.log(chalk.bold.yellow('\n⚙️ Creating configuration and tooling files...'));
84
+ copyTemplate('.next/types/routes.d.ts', 'routes.d.ts.txt', ['templates', 'next']);
85
+ copyTemplate('.next/types/validator.ts', 'validator.ts.txt', ['templates', 'next']);
86
+ copyTemplate('eslint.config.mjs', 'eslint.config.mjs', ['templates', 'configFiles']);
87
+ copyTemplate('.prettierrc', '.prettierrc', ['templates', 'configFiles']);
88
+ copyTemplate('tsconfig.json', 'tsconfig.json', ['templates', 'configFiles']);
89
+ copyTemplate('tsconfig.node.json', 'tsconfig.node.json', ['templates', 'configFiles']);
90
+ copyTemplate('tailwind.config.js', 'tailwind.config.js', ['templates', 'configFiles']);
91
+ copyTemplate('.gitignore', '.gitignore', ['templates', 'configFiles']);
92
+ copyTemplate('next.config.ts', 'next.config.ts.txt', ['templates', 'next']);
93
+ copyTemplate('next-env.d.ts', 'next-env.d.ts.txt', ['templates', 'next']);
94
+ copyTemplate('postcss.config.mjs', 'postcss.config.mjs.txt', ['templates', 'next']);
95
+ if (config.addAuth) {
96
+ copyTemplate('.env.local', '.env.local', ['templates', 'configFiles']);
97
+ }
98
+ fs.writeFileSync('README.md', generateReadme(config));
99
+ console.log(chalk.green(' ✓ Created ESLint, Prettier, Next, TypeScript, Tailwind, and other configs.'));
100
+
61
101
  // Package.json
62
102
  console.log(chalk.bold.yellow('\n📜 Creating package.json and scripts...'));
63
103
  fs.writeFileSync('package.json', JSON.stringify(generatePackageJson(config), null, 2));
package/bin/index.js CHANGED
@@ -5,15 +5,23 @@ import inquirer from 'inquirer';
5
5
  import chalk from 'chalk';
6
6
  import { execSync } from 'child_process';
7
7
  import { promptUser } from './promptUser.js';
8
- import { generateFiles } from './generateFiles.js';
8
+ import fs from 'fs';
9
+ import { fileURLToPath } from 'url';
9
10
  import { printSuccess, createFolders } from './utils/index.js';
11
+ import { generatePackageJson, generateViteConfig, generateIndexHtml} from './generateFiles/index.js';
12
+
13
+ function copyFolder(source, destination) {
14
+ fs.cpSync(source, destination, { recursive: true, force: true });
15
+ }
10
16
 
11
17
  async function main() {
12
- // Get user configuration
13
18
  const args = process.argv.slice(2);
14
19
  const projectName = args[0];
15
20
  const config = await promptUser(projectName);
16
21
 
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = path.dirname(__filename);
24
+
17
25
  const projectPath = path.resolve(process.cwd(), config.projectName);
18
26
  console.log(chalk.gray('\n' + '─'.repeat(60)));
19
27
  console.log(chalk.bold.green(`\n📁 Creating project at: ${chalk.cyan(projectPath)}\n`));
@@ -22,22 +30,38 @@ async function main() {
22
30
 
23
31
  process.chdir(projectPath);
24
32
 
33
+ const baseFolder = config.framework.includes('vite') ? 'vite' : 'next';
25
34
 
26
- createFolders(path.join(projectPath, 'public'), false);
27
- createFolders(path.join(projectPath, 'src'), false);
28
- createFolders(path.join(projectPath, 'src', 'styles'), false);
29
- createFolders(path.join(projectPath, 'src', 'assets'), false);
35
+ const secondaryFolder = config.libraries.includes('@undp/data-viz') ? 'withDataViz' : 'withoutDataViz';
30
36
 
31
- if(config.installRouter) {
32
- createFolders(path.join(projectPath, 'src', 'routes'), false);
33
- createFolders(path.join(projectPath, 'src', 'components'), false);
37
+ let tertiaryFolder = 'basic';
38
+
39
+ switch (config.framework) {
40
+ case 'vite-query':
41
+ tertiaryFolder = 'query';
42
+ break;
43
+ case 'vite-router':
44
+ tertiaryFolder = 'router';
45
+ break;
46
+ case 'vite-full':
47
+ tertiaryFolder = 'query+router';
48
+ break;
49
+ case 'next-auth':
50
+ tertiaryFolder = 'auth';
51
+ break;
52
+ default:
53
+ break;
34
54
  }
55
+
56
+ copyFolder(path.join(__dirname, `./templates/${baseFolder}/${secondaryFolder}/${tertiaryFolder}`), projectPath)
35
57
 
36
- if(config.installRouter && config.installQuery) {
37
- createFolders(path.join(projectPath, 'src', 'integration'), false);
58
+ if (config.framework.includes('vite')) {
59
+ fs.writeFileSync('vite.config.ts', generateViteConfig(config));
60
+ fs.writeFileSync('index.html', generateIndexHtml(config));
38
61
  }
62
+ fs.writeFileSync('package.json', JSON.stringify(generatePackageJson(config), null, 2));
39
63
 
40
- generateFiles(config);
64
+ console.log(chalk.green(' ✓ Project folder and files generated'));
41
65
 
42
66
  const { installNow } = await inquirer.prompt([
43
67
  {
@@ -54,14 +78,14 @@ async function main() {
54
78
  execSync('npm install', { stdio: 'inherit' })
55
79
  console.log(chalk.green(' ✓ All dependencies installed'));
56
80
  } catch {
57
- console.log(chalk.yellow(' ⚠️ Skipped installing dependencies (npm not installed or error occurred)'));
81
+ console.log(chalk.yellow(' ⚠️ Skipped installing dependencies (npm not installed or error occurred)'));
58
82
  }
59
83
  }
60
84
  try {
61
85
  execSync('git init', { stdio: 'ignore' });
62
86
  console.log(chalk.green(' ✓ Git repository initialized'));
63
87
  } catch {
64
- console.log(chalk.yellow(' ⚠️ Skipped git init (Git not installed or error occurred)'));
88
+ console.log(chalk.yellow(' ⚠️ Skipped git init (Git not installed or error occurred)'));
65
89
  }
66
90
  printSuccess(config, installNow);
67
91
  }
package/bin/promptUser.js CHANGED
@@ -12,55 +12,81 @@ const question = (query) =>
12
12
 
13
13
  export async function promptUser(name) {
14
14
  console.log(
15
- chalk.bold.cyan("\n🚀 UNDP Frontend Starter Kit | Let's configure your application") +
16
- chalk.gray('\n🔧 Powered by React, Vite, TypeScript, ESLint, Prettier, Tailwind, and React Compiler\n')
15
+ chalk.bold.cyan("\n🚀 UNDP Frontend Starter Kit | Let's configure your application")
17
16
  );
18
17
  console.log(chalk.gray('─'.repeat(60)) + '\n');
19
18
 
20
19
  const projectName = name ? name : (await question(chalk.yellow('📝 Enter project name: '))) || 'my-undp-react-app';
21
20
 
21
+ const { framework } = await inquirer.prompt([
22
+ {
23
+ type: 'list',
24
+ name: 'framework',
25
+ message: chalk.yellow('📦 Select the framework you prefer to use:\n'),
26
+ choices: [
27
+ {
28
+ name: 'Vite + Tailwind — Lightweight and blazing fast React starter (ideal if you are planning to embed the SPA in another page)',
29
+ value: 'vite-basic'
30
+ },
31
+ {
32
+ name: 'Vite + Tailwind + Query — Optimized starter with data fetching powered by TanStack Query (ideal if you are planning to embed the SPA in another page)',
33
+ value: 'vite-query'
34
+ },
35
+ {
36
+ name: 'Vite + Tailwind + Router — Fast starter with built-in routing support',
37
+ value: 'vite-router'
38
+ },
39
+ {
40
+ name: 'Vite + Tailwind + Router + Query — Complete Vite setup for routing and data management',
41
+ value: 'vite-full'
42
+ },
43
+ {
44
+ name: 'Next.js + Tailwind — Production-ready React framework with file-based routing and SSR',
45
+ value: 'next-basic'
46
+ },
47
+ {
48
+ name: 'Next.js + Tailwind + Auth — Secure, full-stack framework with authentication and SSR',
49
+ value: 'next-auth'
50
+ },
51
+ ],
52
+ default: 'vite-basic',
53
+ },
54
+ ]);
55
+
56
+ const libraryChoices = [
57
+ {
58
+ name: '@undp/data-viz — UNDP data visualization components',
59
+ value: '@undp/data-viz'
60
+ },
61
+ {
62
+ name: 'lucide-react — Beautiful open-source icon set for React',
63
+ value: 'lucide-react'
64
+ },
65
+ {
66
+ name: 'Peer dependencies — Install required framework dependencies',
67
+ value: 'peer'
68
+ },
69
+ ];
70
+
22
71
  const { libraries } = await inquirer.prompt([
23
72
  {
24
73
  type: 'checkbox',
25
74
  name: 'libraries',
26
75
  message: chalk.yellow('📦 Select the libraries you want to install:'),
27
- choices: [
28
- { name: '@undp/data-viz (for visualizations)', value: '@undp/data-viz' },
29
- { name: 'lucide-react (for icons)', value: 'lucide-react' },
30
- { name: '@tanstack/react-router (for routing)', value: '@tanstack/react-router' },
31
- { name: '@tanstack/react-query (for state management and fetching data from api)', value: '@tanstack/react-query' },
32
- ],
33
- default: ['@undp/data-viz', 'lucide-react'], // optional default selection
76
+ choices: libraryChoices,
77
+ default: ['@undp/data-viz', 'lucide-react'],
34
78
  },
35
79
  ]);
36
- const installLucide = libraries.includes('lucide-react');
37
- const installDataViz = libraries.includes('@undp/data-viz');
38
- const installRouter = libraries.includes('@tanstack/react-router');
39
- const installQuery = libraries.includes('@tanstack/react-query');
40
-
41
- let installDataVizPeerDeps = false;
42
- if (installDataViz) {
43
- const { peerDeps } = await inquirer.prompt([
44
- {
45
- type: 'list',
46
- name: 'peerDeps',
47
- message: chalk.yellow('📦 Add peer dependencies for @undp/data-viz?'),
48
- choices: ['Yes', 'No'],
49
- default: 'Yes',
50
- },
51
- ]);
52
- installDataVizPeerDeps = peerDeps === 'Yes'
53
- }
54
80
 
55
81
  let addPostCSSScripts = false;
56
82
 
57
- if(!installRouter) {
83
+ if(framework !== 'next-basic' && framework !== 'next-auth') {
58
84
  const { postCSS } = await inquirer.prompt([
59
85
  {
60
86
  type: 'list',
61
87
  name: 'postCSS',
62
88
  message: chalk.yellow(
63
- '⚙️ Add PostCSS script to flatten layers, wrap all classes in `.undp-container`, and reorder media queries (recommended if embedding in another app)?'
89
+ '⚙️ Add PostCSS script to flatten layers, wrap all classes in `.undp-container` (recommended if embedding in another app)?'
64
90
  ),
65
91
  choices: ['Yes', 'No'],
66
92
  default: 'Yes',
@@ -69,7 +95,7 @@ export async function promptUser(name) {
69
95
  addPostCSSScripts = postCSS === 'Yes';
70
96
  }
71
97
 
72
- const { staticWebApp } = await inquirer.prompt([
98
+ const { staticWebApp } = framework !== 'next-basic' && framework !== 'next-auth' ? await inquirer.prompt([
73
99
  {
74
100
  type: 'list',
75
101
  name: 'staticWebApp',
@@ -77,20 +103,17 @@ export async function promptUser(name) {
77
103
  choices: ['Yes', 'No'],
78
104
  default: 'No',
79
105
  },
80
- ]);
106
+ ]) : { staticWebApp: 'No' };
81
107
 
82
- // Convert string responses to booleans for convenience
83
108
  const addStaticWebAppConfig = staticWebApp === 'Yes';
84
109
 
85
110
  rl.close();
111
+
86
112
  return {
87
113
  projectName,
88
- installLucide,
89
- installDataViz,
90
- installDataVizPeerDeps,
114
+ libraries,
91
115
  addStaticWebAppConfig,
92
116
  addPostCSSScripts,
93
- installRouter,
94
- installQuery
117
+ framework,
95
118
  };
96
119
  }