@undp/create-app 0.1.1 → 0.2.1
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 +31 -8
- package/bin/generateFiles/generateIndexHtml.js +18 -0
- package/bin/generateFiles/generatePackageJson.js +160 -0
- package/bin/{generateTemplates/templates/configFiles/staticwebapp.config.json → generateFiles/generateStaticWebAppConfig.js} +4 -1
- package/bin/{generateTemplates/templates/configFiles/vite.config.ts.txt → generateFiles/generateViteConfig.js} +14 -12
- package/bin/generateFiles/index.js +4 -0
- package/bin/index.js +46 -14
- package/bin/promptUser.js +60 -37
- package/bin/templates/next/withDataViz/auth/README.md +108 -0
- package/bin/templates/next/withDataViz/auth/app/about/page.tsx +33 -0
- package/bin/templates/next/withDataViz/auth/app/api/auth/[...all]/route.ts +5 -0
- package/bin/templates/next/withDataViz/auth/app/favicon.ico +0 -0
- package/bin/templates/next/withDataViz/auth/app/globals.css +3 -0
- package/bin/templates/next/withDataViz/auth/app/layout.tsx +30 -0
- package/bin/templates/next/withDataViz/auth/app/login/page.tsx +45 -0
- package/bin/templates/next/withDataViz/auth/app/page.tsx +33 -0
- package/bin/templates/next/withDataViz/auth/app/user/page.tsx +86 -0
- package/bin/templates/next/withDataViz/auth/components/Footer.tsx +16 -0
- package/bin/templates/next/withDataViz/auth/components/Header.tsx +56 -0
- package/bin/templates/next/withDataViz/auth/eslint.config.mjs +103 -0
- package/bin/templates/next/withDataViz/auth/lib/auth-client.ts +7 -0
- package/bin/templates/next/withDataViz/auth/lib/auth.ts +30 -0
- package/bin/templates/next/withDataViz/auth/next.config.ts +10 -0
- package/bin/templates/next/withDataViz/auth/postcss.config.mjs +7 -0
- package/bin/templates/next/withDataViz/auth/public/next.svg +1 -0
- package/bin/templates/next/withDataViz/auth/tsconfig.json +34 -0
- package/bin/templates/next/withDataViz/basic/.prettierrc +10 -0
- package/bin/templates/next/withDataViz/basic/README.md +56 -0
- package/bin/templates/next/withDataViz/basic/app/about/page.tsx +33 -0
- package/bin/templates/next/withDataViz/basic/app/favicon.ico +0 -0
- package/bin/templates/next/withDataViz/basic/app/globals.css +3 -0
- package/bin/templates/next/withDataViz/basic/app/layout.tsx +31 -0
- package/bin/templates/next/withDataViz/basic/app/page.tsx +33 -0
- package/bin/templates/next/withDataViz/basic/components/Footer.tsx +16 -0
- package/bin/templates/next/withDataViz/basic/components/Header.tsx +27 -0
- package/bin/templates/next/withDataViz/basic/eslint.config.mjs +103 -0
- package/bin/templates/next/withDataViz/basic/next.config.ts +7 -0
- package/bin/templates/next/withDataViz/basic/postcss.config.mjs +7 -0
- package/bin/templates/next/withDataViz/basic/public/next.svg +1 -0
- package/bin/templates/next/withDataViz/basic/public/undp-logo-blue.svg +1 -0
- package/bin/templates/next/withDataViz/basic/tailwind.config.js +7 -0
- package/bin/templates/next/withDataViz/basic/tsconfig.json +34 -0
- package/bin/templates/next/withoutDataViz/auth/.prettierrc +10 -0
- package/bin/templates/next/withoutDataViz/auth/README.md +107 -0
- package/bin/templates/next/withoutDataViz/auth/app/about/page.tsx +33 -0
- package/bin/templates/next/withoutDataViz/auth/app/api/auth/[...all]/route.ts +5 -0
- package/bin/templates/next/withoutDataViz/auth/app/favicon.ico +0 -0
- package/bin/templates/next/withoutDataViz/auth/app/globals.css +3 -0
- package/bin/templates/next/withoutDataViz/auth/app/layout.tsx +30 -0
- package/bin/templates/next/withoutDataViz/auth/app/login/page.tsx +45 -0
- package/bin/templates/next/withoutDataViz/auth/app/page.tsx +33 -0
- package/bin/templates/next/withoutDataViz/auth/app/user/page.tsx +86 -0
- package/bin/templates/next/withoutDataViz/auth/components/Footer.tsx +16 -0
- package/bin/templates/next/withoutDataViz/auth/components/Header.tsx +56 -0
- package/bin/templates/next/withoutDataViz/auth/eslint.config.mjs +103 -0
- package/bin/templates/next/withoutDataViz/auth/lib/auth-client.ts +7 -0
- package/bin/templates/next/withoutDataViz/auth/lib/auth.ts +30 -0
- package/bin/templates/next/withoutDataViz/auth/next.config.ts +10 -0
- package/bin/templates/next/withoutDataViz/auth/postcss.config.mjs +7 -0
- package/bin/templates/next/withoutDataViz/auth/public/next.svg +1 -0
- package/bin/templates/next/withoutDataViz/auth/public/undp-logo-blue.svg +1 -0
- package/bin/templates/next/withoutDataViz/auth/tailwind.config.js +7 -0
- package/bin/templates/next/withoutDataViz/auth/tsconfig.json +34 -0
- package/bin/templates/next/withoutDataViz/basic/.prettierrc +10 -0
- package/bin/templates/next/withoutDataViz/basic/README.md +55 -0
- package/bin/templates/next/withoutDataViz/basic/app/about/page.tsx +33 -0
- package/bin/templates/next/withoutDataViz/basic/app/favicon.ico +0 -0
- package/bin/templates/next/withoutDataViz/basic/app/globals.css +3 -0
- package/bin/templates/next/withoutDataViz/basic/app/layout.tsx +31 -0
- package/bin/templates/next/withoutDataViz/basic/app/page.tsx +33 -0
- package/bin/templates/next/withoutDataViz/basic/components/Footer.tsx +16 -0
- package/bin/templates/next/withoutDataViz/basic/components/Header.tsx +27 -0
- package/bin/templates/next/withoutDataViz/basic/eslint.config.mjs +103 -0
- package/bin/templates/next/withoutDataViz/basic/next.config.ts +7 -0
- package/bin/templates/next/withoutDataViz/basic/postcss.config.mjs +7 -0
- package/bin/templates/next/withoutDataViz/basic/public/next.svg +1 -0
- package/bin/templates/next/withoutDataViz/basic/public/undp-logo-blue.svg +1 -0
- package/bin/templates/next/withoutDataViz/basic/tailwind.config.js +7 -0
- package/bin/templates/next/withoutDataViz/basic/tsconfig.json +34 -0
- package/bin/templates/vite/withDataViz/basic/.prettierrc +10 -0
- package/bin/templates/vite/withDataViz/basic/README.md +76 -0
- package/bin/{generateTemplates/generateIndexHtml.js → templates/vite/withDataViz/basic/index.html} +3 -5
- package/bin/templates/vite/withDataViz/basic/public/favicon.ico +0 -0
- package/bin/templates/vite/withDataViz/basic/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withDataViz/basic/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withDataViz/basic/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/basic/src/App.tsx +38 -0
- package/bin/templates/vite/withDataViz/basic/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/basic/src/components/Footer.tsx +14 -0
- package/bin/{generateTemplates/templates/router/components/Header.txt → templates/vite/withDataViz/basic/src/components/Header.tsx} +8 -12
- package/bin/templates/vite/withDataViz/basic/src/styles/style.css +4 -0
- package/bin/templates/vite/withDataViz/basic/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withDataViz/basic/tailwind.config.js +7 -0
- package/bin/{generateTemplates/templates/configFiles → templates/vite/withDataViz/basic}/tsconfig.json +1 -1
- package/bin/{generateTemplates/templates/configFiles/viteWithoutPostCss.config.ts.txt → templates/vite/withDataViz/basic/vite.config.ts} +17 -1
- package/bin/templates/vite/withDataViz/query/.prettierrc +10 -0
- package/bin/templates/vite/withDataViz/query/README.md +80 -0
- package/bin/templates/vite/withDataViz/query/eslint.config.mjs +97 -0
- package/bin/templates/vite/withDataViz/query/index.html +13 -0
- package/bin/templates/vite/withDataViz/query/public/favicon.ico +0 -0
- package/bin/templates/vite/withDataViz/query/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withDataViz/query/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withDataViz/query/public/imgs/logo-color-600.png +0 -0
- package/bin/templates/vite/withDataViz/query/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/query/src/App.tsx +70 -0
- package/bin/templates/vite/withDataViz/query/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/query/src/components/Footer.tsx +14 -0
- package/bin/templates/vite/withDataViz/query/src/components/Header.tsx +25 -0
- package/bin/templates/vite/withDataViz/query/src/integration/tanstack-query.tsx +27 -0
- package/bin/templates/vite/withDataViz/query/src/main.tsx +21 -0
- package/bin/templates/vite/withDataViz/query/src/styles/fonts.css +213 -0
- package/bin/templates/vite/withDataViz/query/src/styles/style.css +4 -0
- package/bin/templates/vite/withDataViz/query/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withDataViz/query/tailwind.config.js +7 -0
- package/bin/templates/vite/withDataViz/query/tsconfig.json +29 -0
- package/bin/templates/vite/withDataViz/query/tsconfig.node.json +9 -0
- package/bin/templates/vite/withDataViz/query/vite.config.ts +75 -0
- package/bin/templates/vite/withDataViz/query+router/.prettierrc +10 -0
- package/bin/templates/vite/withDataViz/query+router/README.md +112 -0
- package/bin/templates/vite/withDataViz/query+router/eslint.config.mjs +97 -0
- package/bin/templates/vite/withDataViz/query+router/index.html +13 -0
- package/bin/templates/vite/withDataViz/query+router/public/favicon.ico +0 -0
- package/bin/templates/vite/withDataViz/query+router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withDataViz/query+router/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withDataViz/query+router/public/imgs/logo-color-600.png +0 -0
- package/bin/templates/vite/withDataViz/query+router/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/query+router/src/App.tsx +42 -0
- package/bin/templates/vite/withDataViz/query+router/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/query+router/src/components/Footer.tsx +14 -0
- package/bin/{generateTemplates/templates/router+query/components/Header.txt → templates/vite/withDataViz/query+router/src/components/Header.tsx} +8 -12
- package/bin/{generateTemplates/templates/router+query/integration/tanstack-query.txt → templates/vite/withDataViz/query+router/src/integration/tanstack-query.tsx} +5 -5
- package/bin/{generateTemplates/templates/router+query/main.txt → templates/vite/withDataViz/query+router/src/main.tsx} +15 -11
- package/bin/templates/vite/withDataViz/query+router/src/routes/queryDemo.tsx +73 -0
- package/bin/templates/vite/withDataViz/query+router/src/styles/fonts.css +213 -0
- package/bin/templates/vite/withDataViz/query+router/src/styles/style.css +4 -0
- package/bin/templates/vite/withDataViz/query+router/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withDataViz/query+router/tailwind.config.js +7 -0
- package/bin/templates/vite/withDataViz/query+router/tsconfig.json +29 -0
- package/bin/templates/vite/withDataViz/query+router/tsconfig.node.json +9 -0
- package/bin/templates/vite/withDataViz/query+router/vite.config.ts +75 -0
- package/bin/templates/vite/withDataViz/router/.prettierrc +10 -0
- package/bin/templates/vite/withDataViz/router/README.md +107 -0
- package/bin/templates/vite/withDataViz/router/eslint.config.mjs +97 -0
- package/bin/templates/vite/withDataViz/router/index.html +13 -0
- package/bin/templates/vite/withDataViz/router/public/favicon.ico +0 -0
- package/bin/templates/vite/withDataViz/router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withDataViz/router/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withDataViz/router/public/imgs/logo-color-600.png +0 -0
- package/bin/templates/vite/withDataViz/router/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/router/src/App.tsx +51 -0
- package/bin/templates/vite/withDataViz/router/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withDataViz/router/src/components/Footer.tsx +14 -0
- package/bin/templates/vite/withDataViz/router/src/components/Header.tsx +25 -0
- package/bin/{generateTemplates/templates/router/main.txt → templates/vite/withDataViz/router/src/main.tsx} +18 -12
- package/bin/templates/vite/withDataViz/router/src/routes/about.tsx +73 -0
- package/bin/templates/vite/withDataViz/router/src/styles/fonts.css +213 -0
- package/bin/templates/vite/withDataViz/router/src/styles/style.css +4 -0
- package/bin/templates/vite/withDataViz/router/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withDataViz/router/tailwind.config.js +7 -0
- package/bin/templates/vite/withDataViz/router/tsconfig.json +29 -0
- package/bin/templates/vite/withDataViz/router/tsconfig.node.json +9 -0
- package/bin/templates/vite/withDataViz/router/vite.config.ts +75 -0
- package/bin/templates/vite/withoutDataViz/basic/.prettierrc +10 -0
- package/bin/templates/vite/withoutDataViz/basic/README.md +75 -0
- package/bin/templates/vite/withoutDataViz/basic/eslint.config.mjs +97 -0
- package/bin/templates/vite/withoutDataViz/basic/index.html +13 -0
- package/bin/templates/vite/withoutDataViz/basic/public/favicon.ico +0 -0
- package/bin/templates/vite/withoutDataViz/basic/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withoutDataViz/basic/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withoutDataViz/basic/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/basic/src/App.tsx +38 -0
- package/bin/templates/vite/withoutDataViz/basic/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/basic/src/components/Footer.tsx +14 -0
- package/bin/templates/vite/withoutDataViz/basic/src/components/Header.tsx +25 -0
- package/bin/templates/vite/withoutDataViz/basic/src/main.tsx +10 -0
- package/bin/templates/vite/withoutDataViz/basic/src/styles/fonts.css +213 -0
- package/bin/templates/vite/withoutDataViz/basic/src/styles/style.css +3 -0
- package/bin/templates/vite/withoutDataViz/basic/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withoutDataViz/basic/tailwind.config.js +7 -0
- package/bin/templates/vite/withoutDataViz/basic/tsconfig.json +29 -0
- package/bin/templates/vite/withoutDataViz/basic/tsconfig.node.json +9 -0
- package/bin/templates/vite/withoutDataViz/basic/vite.config.ts +75 -0
- package/bin/templates/vite/withoutDataViz/query/.prettierrc +10 -0
- package/bin/templates/vite/withoutDataViz/query/README.md +80 -0
- package/bin/templates/vite/withoutDataViz/query/eslint.config.mjs +97 -0
- package/bin/templates/vite/withoutDataViz/query/index.html +13 -0
- package/bin/templates/vite/withoutDataViz/query/public/favicon.ico +0 -0
- package/bin/templates/vite/withoutDataViz/query/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withoutDataViz/query/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withoutDataViz/query/public/imgs/logo-color-600.png +0 -0
- package/bin/templates/vite/withoutDataViz/query/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/query/src/App.tsx +70 -0
- package/bin/templates/vite/withoutDataViz/query/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/query/src/components/Footer.tsx +14 -0
- package/bin/templates/vite/withoutDataViz/query/src/components/Header.tsx +25 -0
- package/bin/templates/vite/withoutDataViz/query/src/integration/tanstack-query.tsx +27 -0
- package/bin/templates/vite/withoutDataViz/query/src/main.tsx +21 -0
- package/bin/templates/vite/withoutDataViz/query/src/styles/fonts.css +213 -0
- package/bin/templates/vite/withoutDataViz/query/src/styles/style.css +3 -0
- package/bin/templates/vite/withoutDataViz/query/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withoutDataViz/query/tailwind.config.js +7 -0
- package/bin/templates/vite/withoutDataViz/query/tsconfig.json +29 -0
- package/bin/templates/vite/withoutDataViz/query/tsconfig.node.json +9 -0
- package/bin/templates/vite/withoutDataViz/query/vite.config.ts +75 -0
- package/bin/templates/vite/withoutDataViz/query+router/.prettierrc +10 -0
- package/bin/templates/vite/withoutDataViz/query+router/README.md +111 -0
- package/bin/templates/vite/withoutDataViz/query+router/eslint.config.mjs +97 -0
- package/bin/templates/vite/withoutDataViz/query+router/index.html +13 -0
- package/bin/templates/vite/withoutDataViz/query+router/public/favicon.ico +0 -0
- package/bin/templates/vite/withoutDataViz/query+router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withoutDataViz/query+router/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withoutDataViz/query+router/public/imgs/logo-color-600.png +0 -0
- package/bin/templates/vite/withoutDataViz/query+router/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/App.tsx +42 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/components/Footer.tsx +14 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/components/Header.tsx +25 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/integration/tanstack-query.tsx +27 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/main.tsx +73 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/routes/queryDemo.tsx +73 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/styles/fonts.css +213 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/styles/style.css +3 -0
- package/bin/templates/vite/withoutDataViz/query+router/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withoutDataViz/query+router/tailwind.config.js +7 -0
- package/bin/templates/vite/withoutDataViz/query+router/tsconfig.json +29 -0
- package/bin/templates/vite/withoutDataViz/query+router/tsconfig.node.json +9 -0
- package/bin/templates/vite/withoutDataViz/query+router/vite.config.ts +75 -0
- package/bin/templates/vite/withoutDataViz/router/.prettierrc +10 -0
- package/bin/templates/vite/withoutDataViz/router/README.md +106 -0
- package/bin/templates/vite/withoutDataViz/router/eslint.config.mjs +97 -0
- package/bin/templates/vite/withoutDataViz/router/index.html +13 -0
- package/bin/templates/vite/withoutDataViz/router/public/favicon.ico +0 -0
- package/bin/templates/vite/withoutDataViz/router/public/imgs/Tailwind_CSS_Logo.svg +1 -0
- package/bin/templates/vite/withoutDataViz/router/public/imgs/Vitejs-logo.svg +15 -0
- package/bin/templates/vite/withoutDataViz/router/public/imgs/logo-color-600.png +0 -0
- package/bin/templates/vite/withoutDataViz/router/public/imgs/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/router/src/App.tsx +51 -0
- package/bin/templates/vite/withoutDataViz/router/src/assets/undp-logo-blue.svg +1 -0
- package/bin/templates/vite/withoutDataViz/router/src/components/Footer.tsx +14 -0
- package/bin/templates/vite/withoutDataViz/router/src/components/Header.tsx +25 -0
- package/bin/templates/vite/withoutDataViz/router/src/main.tsx +66 -0
- package/bin/templates/vite/withoutDataViz/router/src/routes/about.tsx +73 -0
- package/bin/templates/vite/withoutDataViz/router/src/styles/fonts.css +213 -0
- package/bin/templates/vite/withoutDataViz/router/src/styles/style.css +4 -0
- package/bin/templates/vite/withoutDataViz/router/src/vite-env.d.ts +1 -0
- package/bin/templates/vite/withoutDataViz/router/tailwind.config.js +7 -0
- package/bin/templates/vite/withoutDataViz/router/tsconfig.json +29 -0
- package/bin/templates/vite/withoutDataViz/router/tsconfig.node.json +9 -0
- package/bin/templates/vite/withoutDataViz/router/vite.config.ts +75 -0
- package/bin/utils/printSuccess.js +0 -9
- package/package.json +6 -2
- package/bin/generateFiles.js +0 -65
- package/bin/generateTemplates/copyTemplate.js +0 -18
- package/bin/generateTemplates/generatePackageJson.js +0 -105
- package/bin/generateTemplates/generateReadme.js +0 -143
- package/bin/generateTemplates/generateStyleCss.js +0 -6
- package/bin/generateTemplates/index.js +0 -6
- package/bin/generateTemplates/templates/basic/App.txt +0 -32
- package/bin/generateTemplates/templates/basic/AppWithContainer.txt +0 -32
- package/bin/generateTemplates/templates/configFiles/vite-env.txt +0 -1
- package/bin/generateTemplates/templates/query/App.txt +0 -57
- package/bin/generateTemplates/templates/query/AppWithContainer.txt +0 -67
- package/bin/generateTemplates/templates/query/main.txt +0 -29
- package/bin/generateTemplates/templates/router/App.txt +0 -30
- package/bin/generateTemplates/templates/router/components/Footer.txt +0 -20
- package/bin/generateTemplates/templates/router/routes/About.txt +0 -28
- package/bin/generateTemplates/templates/router+query/App.txt +0 -30
- package/bin/generateTemplates/templates/router+query/components/Footer.txt +0 -20
- package/bin/generateTemplates/templates/router+query/routes/queryDemo.txt +0 -56
- /package/bin/{generateTemplates/templates/configFiles → templates/next/withDataViz/auth}/.prettierrc +0 -0
- /package/bin/{generateTemplates/templates/configFiles/icon.txt → templates/next/withDataViz/auth/public/undp-logo-blue.svg} +0 -0
- /package/bin/{generateTemplates/templates/configFiles → templates/next/withDataViz/auth}/tailwind.config.js +0 -0
- /package/bin/{generateTemplates/templates/configFiles → templates/vite/withDataViz/basic}/eslint.config.mjs +0 -0
- /package/bin/{generateTemplates/templates/basic/main.txt → templates/vite/withDataViz/basic/src/main.tsx} +0 -0
- /package/bin/{generateTemplates/templates/css → templates/vite/withDataViz/basic/src/styles}/fonts.css +0 -0
- /package/bin/{generateTemplates/templates/configFiles → templates/vite/withDataViz/basic}/tsconfig.node.json +0 -0
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**,
|
|
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
4
|
|
|
5
5
|
[NPM Package](https://www.npmjs.com/package/@undp/create-app)
|
|
6
6
|
|
|
@@ -8,11 +8,29 @@
|
|
|
8
8
|
|
|
9
9
|
## 🚀 Features
|
|
10
10
|
|
|
11
|
-
- ⚡ **
|
|
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**
|
|
12
14
|
- 🧱 Preconfigured for UNDP’s Design System
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
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
|
|
16
34
|
|
|
17
35
|
---
|
|
18
36
|
|
|
@@ -24,9 +42,14 @@ You don’t need to install it globally — just use **npx**:
|
|
|
24
42
|
npx @undp/create-app my-project
|
|
25
43
|
```
|
|
26
44
|
|
|
27
|
-
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 📦 Getting started
|
|
48
|
+
|
|
49
|
+
After running the CLI, navigate into your project and start the dev server:
|
|
28
50
|
|
|
29
51
|
```bash
|
|
30
|
-
npm
|
|
31
|
-
create-undp-app my-project
|
|
52
|
+
cd my-project && npm run dev
|
|
32
53
|
```
|
|
54
|
+
|
|
55
|
+
*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 dependencies = config.libraries.includes('peer') && config.libraries.includes('@undp/data-viz') ? {
|
|
16
|
+
"@undp/design-system-react": designSystemVer,
|
|
17
|
+
"react": "^19.2.0",
|
|
18
|
+
"react-dom": "^19.2.0",
|
|
19
|
+
"@dnd-kit/core": "^6.3.1",
|
|
20
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
21
|
+
"ajv": "^8.17.1",
|
|
22
|
+
"dom-to-svg": "^0.12.2",
|
|
23
|
+
"file-saver": "^2.0.5",
|
|
24
|
+
"handlebars": "^4.7.8",
|
|
25
|
+
"maplibre-gl": "^5.12.0",
|
|
26
|
+
"marked": "^16.4.1",
|
|
27
|
+
"math-expression-evaluator": "^2.0.7",
|
|
28
|
+
"pmtiles": "^4.3.0",
|
|
29
|
+
"react-globe.gl": "^2.37.0",
|
|
30
|
+
"three": "^0.180.0"
|
|
31
|
+
} : {
|
|
32
|
+
"@undp/design-system-react": designSystemVer,
|
|
33
|
+
"react": "^19.2.0",
|
|
34
|
+
"react-dom": "^19.2.0",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
switch (config.framework) {
|
|
38
|
+
case 'vite-query':
|
|
39
|
+
dependencies['@tanstack/react-query'] = '^5.90.7';
|
|
40
|
+
break;
|
|
41
|
+
case 'vite-router':
|
|
42
|
+
dependencies['@tanstack/react-router'] = '^1.135.0';
|
|
43
|
+
break;
|
|
44
|
+
case 'vite-full':
|
|
45
|
+
dependencies['@tanstack/react-query'] = '^5.90.7';
|
|
46
|
+
dependencies['@tanstack/react-router'] = '^1.135.0';
|
|
47
|
+
break;
|
|
48
|
+
case 'next-basic':
|
|
49
|
+
dependencies['next'] = '16.0.1';
|
|
50
|
+
break;
|
|
51
|
+
case 'next-auth':
|
|
52
|
+
dependencies['better-auth'] = '^1.3.34';
|
|
53
|
+
dependencies['next'] = '16.0.1';
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
if (config.libraries.includes('@undp/data-viz')) {
|
|
59
|
+
const dataVizVer = `^${getLatestVersion('@undp/data-viz')}`
|
|
60
|
+
dependencies['@undp/data-viz'] = dataVizVer;
|
|
61
|
+
}
|
|
62
|
+
if (config.libraries.includes('lucide-react')) {
|
|
63
|
+
const lucideReactVer = `^${getLatestVersion('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,4 +1,5 @@
|
|
|
1
|
-
{
|
|
1
|
+
export function generateStaticWebAppConfig() {
|
|
2
|
+
return `{
|
|
2
3
|
"globalHeaders": {
|
|
3
4
|
"Access-Control-Allow-Origin": "*",
|
|
4
5
|
"Access-Control-Allow-Methods": "GET, OPTIONS"
|
|
@@ -41,4 +42,6 @@
|
|
|
41
42
|
"rewrite": "/index.html",
|
|
42
43
|
"exclude": ["/assets/*", "/*.js", "/*.css", "/*.png", "/*.jpg", "/*.svg"]
|
|
43
44
|
}
|
|
45
|
+
}`
|
|
44
46
|
}
|
|
47
|
+
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
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
|
|
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
|
+
|
package/bin/index.js
CHANGED
|
@@ -5,15 +5,28 @@ 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
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
9
10
|
import { printSuccess, createFolders } from './utils/index.js';
|
|
11
|
+
import {
|
|
12
|
+
generatePackageJson,
|
|
13
|
+
generateViteConfig,
|
|
14
|
+
generateIndexHtml,
|
|
15
|
+
generateStaticWebAppConfig,
|
|
16
|
+
} from './generateFiles/index.js';
|
|
17
|
+
|
|
18
|
+
function copyFolder(source, destination) {
|
|
19
|
+
fs.cpSync(source, destination, { recursive: true, force: true });
|
|
20
|
+
}
|
|
10
21
|
|
|
11
22
|
async function main() {
|
|
12
|
-
// Get user configuration
|
|
13
23
|
const args = process.argv.slice(2);
|
|
14
24
|
const projectName = args[0];
|
|
15
25
|
const config = await promptUser(projectName);
|
|
16
26
|
|
|
27
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
28
|
+
const __dirname = path.dirname(__filename);
|
|
29
|
+
|
|
17
30
|
const projectPath = path.resolve(process.cwd(), config.projectName);
|
|
18
31
|
console.log(chalk.gray('\n' + '─'.repeat(60)));
|
|
19
32
|
console.log(chalk.bold.green(`\n📁 Creating project at: ${chalk.cyan(projectPath)}\n`));
|
|
@@ -22,22 +35,41 @@ async function main() {
|
|
|
22
35
|
|
|
23
36
|
process.chdir(projectPath);
|
|
24
37
|
|
|
38
|
+
const baseFolder = config.framework.includes('vite') ? 'vite' : 'next';
|
|
25
39
|
|
|
26
|
-
|
|
27
|
-
createFolders(path.join(projectPath, 'src'), false);
|
|
28
|
-
createFolders(path.join(projectPath, 'src', 'styles'), false);
|
|
29
|
-
createFolders(path.join(projectPath, 'src', 'assets'), false);
|
|
40
|
+
const secondaryFolder = config.libraries.includes('@undp/data-viz') ? 'withDataViz' : 'withoutDataViz';
|
|
30
41
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
let tertiaryFolder = 'basic';
|
|
43
|
+
|
|
44
|
+
switch (config.framework) {
|
|
45
|
+
case 'vite-query':
|
|
46
|
+
tertiaryFolder = 'query';
|
|
47
|
+
break;
|
|
48
|
+
case 'vite-router':
|
|
49
|
+
tertiaryFolder = 'router';
|
|
50
|
+
break;
|
|
51
|
+
case 'vite-full':
|
|
52
|
+
tertiaryFolder = 'query+router';
|
|
53
|
+
break;
|
|
54
|
+
case 'next-auth':
|
|
55
|
+
tertiaryFolder = 'auth';
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
break;
|
|
34
59
|
}
|
|
60
|
+
|
|
61
|
+
copyFolder(path.join(__dirname, `./templates/${baseFolder}/${secondaryFolder}/${tertiaryFolder}`), projectPath)
|
|
35
62
|
|
|
36
|
-
if(config.
|
|
37
|
-
|
|
63
|
+
if (config.framework.includes('vite')) {
|
|
64
|
+
fs.writeFileSync('vite.config.ts', generateViteConfig(config));
|
|
65
|
+
fs.writeFileSync('index.html', generateIndexHtml(config));
|
|
66
|
+
if (config.addStaticWebAppConfig) {
|
|
67
|
+
fs.writeFileSync('staticwebapp.config.json', generateStaticWebAppConfig());
|
|
68
|
+
}
|
|
38
69
|
}
|
|
70
|
+
fs.writeFileSync('package.json', JSON.stringify(generatePackageJson(config), null, 2));
|
|
39
71
|
|
|
40
|
-
|
|
72
|
+
console.log(chalk.green(' ✓ Project folder and files generated'));
|
|
41
73
|
|
|
42
74
|
const { installNow } = await inquirer.prompt([
|
|
43
75
|
{
|
|
@@ -54,14 +86,14 @@ async function main() {
|
|
|
54
86
|
execSync('npm install', { stdio: 'inherit' })
|
|
55
87
|
console.log(chalk.green(' ✓ All dependencies installed'));
|
|
56
88
|
} catch {
|
|
57
|
-
console.log(chalk.yellow(' ⚠️
|
|
89
|
+
console.log(chalk.yellow(' ⚠️ Skipped installing dependencies (npm not installed or error occurred)'));
|
|
58
90
|
}
|
|
59
91
|
}
|
|
60
92
|
try {
|
|
61
93
|
execSync('git init', { stdio: 'ignore' });
|
|
62
94
|
console.log(chalk.green(' ✓ Git repository initialized'));
|
|
63
95
|
} catch {
|
|
64
|
-
console.log(chalk.yellow(' ⚠️
|
|
96
|
+
console.log(chalk.yellow(' ⚠️ Skipped git init (Git not installed or error occurred)'));
|
|
65
97
|
}
|
|
66
98
|
printSuccess(config, installNow);
|
|
67
99
|
}
|
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
|
-
|
|
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(
|
|
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
|
|
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
|
-
|
|
89
|
-
installDataViz,
|
|
90
|
-
installDataVizPeerDeps,
|
|
114
|
+
libraries,
|
|
91
115
|
addStaticWebAppConfig,
|
|
92
116
|
addPostCSSScripts,
|
|
93
|
-
|
|
94
|
-
installQuery
|
|
117
|
+
framework,
|
|
95
118
|
};
|
|
96
119
|
}
|