@undp/create-app 0.8.0 → 0.91.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.
- package/bin/generateFiles/generateLayoutForNext.js +16 -11
- package/bin/generateFiles/generatePackageJson.js +11 -9
- package/bin/generateFiles/generateStylesCss.js +2 -3
- package/bin/generateFiles/generateViteConfig.js +31 -19
- package/bin/generateFiles/index.js +10 -10
- package/bin/index.js +142 -101
- package/bin/templates/next/auth/app/globals.css +2 -1
- package/bin/templates/next/auth/app/layout.tsx +20 -22
- package/bin/templates/next/auth/biome.json +7 -2
- package/bin/templates/next/basic/app/globals.css +3 -1
- package/bin/templates/next/basic/app/layout.tsx +20 -23
- package/bin/templates/next/basic/biome.json +7 -2
- package/bin/templates/vite/basic/README.md +20 -7
- package/bin/templates/vite/basic/biome.json +7 -2
- package/bin/templates/vite/basic/src/main.tsx +16 -7
- package/bin/templates/vite/basic/src/styles/style.css +1 -2
- package/bin/templates/vite/query/README.md +20 -7
- package/bin/templates/vite/query/biome.json +7 -2
- package/bin/templates/vite/query/src/main.tsx +20 -15
- package/bin/templates/vite/query/src/styles/style.css +2 -2
- package/bin/templates/vite/query+router/biome.json +7 -2
- package/bin/templates/vite/query+router/src/main.tsx +52 -53
- package/bin/templates/vite/query+router/src/styles/style.css +2 -2
- package/bin/templates/vite/router/biome.json +7 -2
- package/bin/templates/vite/router/src/main.tsx +46 -47
- package/bin/templates/vite/router/src/styles/style.css +1 -2
- package/bin/templates/viteWithLanguage/basic/biome.json +7 -2
- package/bin/templates/viteWithLanguage/basic/src/styles/style.css +1 -2
- package/bin/templates/viteWithLanguage/query/biome.json +7 -2
- package/bin/templates/viteWithLanguage/query/src/styles/style.css +1 -2
- package/bin/templates/viteWithLanguage/query+router/biome.json +7 -2
- package/bin/templates/viteWithLanguage/query+router/src/main.tsx +70 -71
- package/bin/templates/viteWithLanguage/query+router/src/styles/style.css +1 -2
- package/bin/templates/viteWithLanguage/router/biome.json +7 -2
- package/bin/templates/viteWithLanguage/router/src/main.tsx +62 -66
- package/bin/templates/viteWithLanguage/router/src/styles/style.css +1 -2
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export function generateLayoutForNext(
|
|
2
|
-
|
|
1
|
+
export function generateLayoutForNext(projectName, query) {
|
|
2
|
+
return `import type { Metadata } from 'next';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
import HeaderEl from '@/components/Header';
|
|
6
|
-
import FooterEl from '@/components/Footer';${
|
|
7
|
-
|
|
6
|
+
import FooterEl from '@/components/Footer';${
|
|
7
|
+
query
|
|
8
|
+
? `
|
|
9
|
+
import TanStackQueryProvider from '@/integration/tanstack-query';`
|
|
10
|
+
: ""
|
|
11
|
+
}
|
|
8
12
|
|
|
9
13
|
import './globals.css';
|
|
10
|
-
import '@undp/design-system-react/style.css';${dataViz ? `
|
|
11
|
-
import '@undp/data-viz/style.css';` : ''}
|
|
12
14
|
|
|
13
15
|
export const metadata: Metadata = {
|
|
14
16
|
title: '${projectName}',
|
|
@@ -24,17 +26,20 @@ export default function RootLayout({
|
|
|
24
26
|
<html lang='en'>
|
|
25
27
|
<body className='flex flex-col gap-0 min-h-screen'>
|
|
26
28
|
<HeaderEl />
|
|
27
|
-
<main className='grow
|
|
29
|
+
<main className='grow flex flex-col justify-center'>${
|
|
30
|
+
query
|
|
31
|
+
? `
|
|
28
32
|
<TanStackQueryProvider>
|
|
29
33
|
<div className='flex flex-col justify-center'>{children}</div>
|
|
30
|
-
</TanStackQueryProvider>`
|
|
31
|
-
|
|
34
|
+
</TanStackQueryProvider>`
|
|
35
|
+
: `
|
|
36
|
+
<div className='flex flex-col justify-center'>{children}</div>`
|
|
37
|
+
}
|
|
32
38
|
</main>
|
|
33
39
|
<FooterEl />
|
|
34
40
|
</body>
|
|
35
41
|
</html>
|
|
36
42
|
);
|
|
37
43
|
}
|
|
38
|
-
|
|
44
|
+
`;
|
|
39
45
|
}
|
|
40
|
-
|
|
@@ -15,7 +15,7 @@ export function generatePackageJson(config) {
|
|
|
15
15
|
const typeScriptVer = `^${getLatestVersion("typescript")}`;
|
|
16
16
|
const zustandVer = `^${getLatestVersion("zustand")}`;
|
|
17
17
|
const tailwindcssVer = `^${getLatestVersion("tailwindcss")}`;
|
|
18
|
-
const
|
|
18
|
+
const twAnimateVer = `^${getLatestVersion("tailwind-animate")}`;
|
|
19
19
|
const dependenciesTemp =
|
|
20
20
|
config.libraries.includes("peer") &&
|
|
21
21
|
config.libraries.includes("@undp/data-viz")
|
|
@@ -35,14 +35,12 @@ export function generatePackageJson(config) {
|
|
|
35
35
|
"react-dom": "^19.2.3",
|
|
36
36
|
"react-globe.gl": "^2.37.0",
|
|
37
37
|
three: "^0.182.0",
|
|
38
|
-
"tw-animate-css": twAnimateCssVer,
|
|
39
38
|
zustand: zustandVer,
|
|
40
39
|
}
|
|
41
40
|
: {
|
|
42
41
|
"@undp/design-system-react": designSystemVer,
|
|
43
42
|
react: "^19.2.3",
|
|
44
43
|
"react-dom": "^19.2.3",
|
|
45
|
-
"tw-animate-css": twAnimateCssVer,
|
|
46
44
|
zustand: zustandVer,
|
|
47
45
|
};
|
|
48
46
|
|
|
@@ -86,25 +84,27 @@ export function generatePackageJson(config) {
|
|
|
86
84
|
);
|
|
87
85
|
const devDependencies = config.framework.includes("vite")
|
|
88
86
|
? {
|
|
89
|
-
"@biomejs/biome": "^2.
|
|
87
|
+
"@biomejs/biome": "^2.5.15",
|
|
90
88
|
"@tailwindcss/postcss": "^4.1.17",
|
|
91
89
|
"@tailwindcss/vite": "^4.3.0",
|
|
92
90
|
"@types/node": "^24.10.0",
|
|
93
91
|
"@types/react": "^19.2.7",
|
|
94
92
|
"@types/react-dom": "^19.2.3",
|
|
95
|
-
"@vitejs/plugin-react": "^6.
|
|
93
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
96
94
|
autoprefixer: "^10.4.21",
|
|
97
95
|
postcss: "^8.5.6",
|
|
98
96
|
"postcss-nested": "^7.0.2",
|
|
99
97
|
rimraf: "^6.1.0",
|
|
100
|
-
"rollup-plugin-visualizer": "^
|
|
98
|
+
"rollup-plugin-visualizer": "^7.1.1",
|
|
99
|
+
"tailwind-animate": twAnimateVer,
|
|
100
|
+
"tailwind-merge": "^3.4.0",
|
|
101
101
|
tailwindcss: tailwindcssVer,
|
|
102
102
|
typescript: typeScriptVer,
|
|
103
|
-
vite: "^8.
|
|
103
|
+
vite: "^8.3.5",
|
|
104
104
|
"vite-plugin-static-copy": "^4.1.0",
|
|
105
105
|
}
|
|
106
106
|
: {
|
|
107
|
-
"@biomejs/biome": "^2.
|
|
107
|
+
"@biomejs/biome": "^2.5.15",
|
|
108
108
|
"@tailwindcss/postcss": "^4.1.17",
|
|
109
109
|
"@types/node": "^24.10.0",
|
|
110
110
|
"@types/react": "^19.2.7",
|
|
@@ -112,7 +112,9 @@ export function generatePackageJson(config) {
|
|
|
112
112
|
postcss: "^8.5.6",
|
|
113
113
|
"postcss-nested": "^7.0.2",
|
|
114
114
|
rimraf: "^6.1.0",
|
|
115
|
-
"rollup-plugin-visualizer": "^
|
|
115
|
+
"rollup-plugin-visualizer": "^7.1.1",
|
|
116
|
+
"tailwind-animate": twAnimateVer,
|
|
117
|
+
"tailwind-merge": "^3.4.0",
|
|
116
118
|
tailwindcss: tailwindcssVer,
|
|
117
119
|
typescript: typeScriptVer,
|
|
118
120
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export function generateStylesCss(dataViz) {
|
|
2
2
|
return `
|
|
3
3
|
@import 'tailwindcss';
|
|
4
|
-
@import
|
|
5
|
-
@import '@undp/design-system-react/theme.css';${
|
|
4
|
+
@import "@undp/design-system-react/tailwind.css";${
|
|
6
5
|
dataViz
|
|
7
6
|
? `
|
|
8
|
-
@import '@undp/data-viz/
|
|
7
|
+
@import '@undp/data-viz/tailwind.css';`
|
|
9
8
|
: ""
|
|
10
9
|
}
|
|
11
10
|
`;
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
export function generateViteConfig(config) {
|
|
2
|
-
|
|
2
|
+
return `import path from 'path';
|
|
3
3
|
import { defineConfig } from 'vite';
|
|
4
4
|
import react from '@vitejs/plugin-react';
|
|
5
|
-
import { visualizer } from 'rollup-plugin-visualizer';
|
|
5
|
+
// import { visualizer } from 'rollup-plugin-visualizer';
|
|
6
6
|
import postcssNested from 'postcss-nested';
|
|
7
|
-
import tailwindcss from '@tailwindcss/postcss';${
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import tailwindcss from '@tailwindcss/postcss';${
|
|
8
|
+
config.addStaticWebAppConfig
|
|
9
|
+
? `
|
|
10
|
+
import { viteStaticCopy } from 'vite-plugin-static-copy';`
|
|
11
|
+
: ""
|
|
12
|
+
}${
|
|
13
|
+
config.addPostCSSScripts
|
|
14
|
+
? `
|
|
15
|
+
import { AtRule } from 'postcss';`
|
|
16
|
+
: ""
|
|
17
|
+
}
|
|
10
18
|
|
|
11
19
|
export default defineConfig({
|
|
12
20
|
plugins: [
|
|
13
21
|
react({}),
|
|
14
|
-
visualizer({ filename: 'stats.html', open: true }),${
|
|
22
|
+
// visualizer({ filename: 'stats.html', open: true }),${
|
|
23
|
+
config.addStaticWebAppConfig
|
|
24
|
+
? `
|
|
15
25
|
viteStaticCopy({
|
|
16
26
|
targets: [{ src: 'staticwebapp.config.json', dest: '' }],
|
|
17
|
-
}),`
|
|
27
|
+
}),`
|
|
28
|
+
: ""
|
|
29
|
+
}
|
|
18
30
|
],
|
|
19
31
|
css: {
|
|
20
32
|
postcss: {
|
|
21
33
|
plugins: [
|
|
22
34
|
postcssNested(),
|
|
23
|
-
tailwindcss(),${
|
|
35
|
+
tailwindcss(),${
|
|
36
|
+
config.addPostCSSScripts
|
|
37
|
+
? `
|
|
24
38
|
{
|
|
25
39
|
postcssPlugin: 'remove-layers', // If you want to flatten layers except base layer
|
|
26
40
|
AtRule: {
|
|
@@ -106,7 +120,8 @@ export default defineConfig({
|
|
|
106
120
|
root.append(rule);
|
|
107
121
|
});
|
|
108
122
|
},
|
|
109
|
-
},`
|
|
123
|
+
},`
|
|
124
|
+
: `
|
|
110
125
|
{
|
|
111
126
|
postcssPlugin: 'move-responsive-queries',
|
|
112
127
|
OnceExit(root) {
|
|
@@ -160,19 +175,17 @@ export default defineConfig({
|
|
|
160
175
|
});
|
|
161
176
|
},
|
|
162
177
|
},`
|
|
163
|
-
|
|
178
|
+
}
|
|
164
179
|
],
|
|
165
180
|
},
|
|
166
181
|
},
|
|
167
182
|
build: {
|
|
168
183
|
manifest: true,
|
|
169
|
-
cssCodeSplit:
|
|
170
|
-
|
|
184
|
+
cssCodeSplit: true,
|
|
185
|
+
rolldownOptions: {
|
|
171
186
|
output: {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (id.includes('@undp/design-system-react')) return 'undp-design-system';${config.libraries.includes('@undp/data-viz') ? `
|
|
175
|
-
if (id.includes('@undp/data-viz')) return 'undp-data-viz';` : ''}
|
|
187
|
+
codeSplitting: {
|
|
188
|
+
groups: [{ name: 'react', test: /node_modules[\\/]react/ }],
|
|
176
189
|
},
|
|
177
190
|
chunkFileNames: '[name]-[hash].js',
|
|
178
191
|
assetFileNames: '[name].[ext]',
|
|
@@ -189,8 +202,7 @@ export default defineConfig({
|
|
|
189
202
|
optionsSuccessStatus: 204,
|
|
190
203
|
},
|
|
191
204
|
},
|
|
192
|
-
resolve: { alias: { '@': path.resolve(
|
|
205
|
+
resolve: { alias: { '@': path.resolve(import.meta.dirname, './src') } },
|
|
193
206
|
});
|
|
194
|
-
|
|
207
|
+
`;
|
|
195
208
|
}
|
|
196
|
-
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { generateIndexHtml } from
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
1
|
+
export { generateEnv } from "./generateEnv.js";
|
|
2
|
+
export { generateGitIgnore } from "./generateGitIgnore.js";
|
|
3
|
+
export { generateIndexHtml } from "./generateIndexHtml.js";
|
|
4
|
+
export { generateLayoutForNext } from "./generateLayoutForNext.js";
|
|
5
|
+
export { generateNextEnvTypes } from "./generateNextEnvTypes.js";
|
|
6
|
+
export { generatePackageJson } from "./generatePackageJson.js";
|
|
7
|
+
export { generatePageForNext } from "./generatePageForNext.js";
|
|
8
|
+
export { generateStaticWebAppConfig } from "./generateStaticWebAppConfig.js";
|
|
9
|
+
export { generateStylesCss } from "./generateStylesCss.js";
|
|
10
|
+
export { generateViteConfig } from "./generateViteConfig.js";
|
package/bin/index.js
CHANGED
|
@@ -1,119 +1,160 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import inquirer from "inquirer";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
import {
|
|
10
|
+
generateEnv,
|
|
11
|
+
generateGitIgnore,
|
|
12
|
+
generateIndexHtml,
|
|
13
|
+
generateLayoutForNext,
|
|
14
|
+
generateNextEnvTypes,
|
|
15
|
+
generatePackageJson,
|
|
16
|
+
generatePageForNext,
|
|
17
|
+
generateStaticWebAppConfig,
|
|
18
|
+
generateStylesCss,
|
|
19
|
+
generateViteConfig,
|
|
20
|
+
} from "./generateFiles/index.js";
|
|
21
|
+
import { promptUser } from "./promptUser.js";
|
|
22
|
+
import { createFolders, printSuccess } from "./utils/index.js";
|
|
23
23
|
|
|
24
24
|
function copyFolder(source, destination) {
|
|
25
|
-
|
|
25
|
+
fs.cpSync(source, destination, { recursive: true, force: true });
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
async function main() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const args = process.argv.slice(2);
|
|
30
|
+
const projectName = args[0];
|
|
31
|
+
const config = await promptUser(projectName);
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
34
|
+
const __dirname = path.dirname(__filename);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const projectPath = path.resolve(process.cwd(), config.projectName);
|
|
37
|
+
console.log(chalk.gray("\n" + "─".repeat(60)));
|
|
38
|
+
console.log(
|
|
39
|
+
chalk.bold.green(`\n📁 Creating project at: ${chalk.cyan(projectPath)}\n`),
|
|
40
|
+
);
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
createFolders(projectPath, true);
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const baseFolder = config.framework.includes('vite') ? config.language ? 'viteWithLanguage' : 'vite' : 'next';
|
|
45
|
-
|
|
44
|
+
process.chdir(projectPath);
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
const baseFolder = config.framework.includes("vite")
|
|
47
|
+
? config.language
|
|
48
|
+
? "viteWithLanguage"
|
|
49
|
+
: "vite"
|
|
50
|
+
: "next";
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
case 'vite-basic':
|
|
51
|
-
if (config.query)
|
|
52
|
-
tertiaryFolder = 'query';
|
|
53
|
-
else
|
|
54
|
-
tertiaryFolder = 'basic';
|
|
55
|
-
break;
|
|
56
|
-
case 'vite-router':
|
|
57
|
-
if (config.query)
|
|
58
|
-
tertiaryFolder = 'query+router';
|
|
59
|
-
else
|
|
60
|
-
tertiaryFolder = 'router';
|
|
61
|
-
break;
|
|
62
|
-
case 'next-auth':
|
|
63
|
-
tertiaryFolder = 'auth';
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
52
|
+
let tertiaryFolder = "basic";
|
|
70
53
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
fs.writeFileSync('.gitignore', generateGitIgnore(config.framework.includes('vite')));
|
|
88
|
-
fs.writeFileSync('package.json', JSON.stringify(generatePackageJson(config), null, 2));
|
|
89
|
-
|
|
90
|
-
console.log(chalk.green(' ✓ Project folder and files generated\n'));
|
|
54
|
+
switch (config.framework) {
|
|
55
|
+
case "vite-basic":
|
|
56
|
+
if (config.query) tertiaryFolder = "query";
|
|
57
|
+
else tertiaryFolder = "basic";
|
|
58
|
+
break;
|
|
59
|
+
case "vite-router":
|
|
60
|
+
if (config.query) tertiaryFolder = "query+router";
|
|
61
|
+
else tertiaryFolder = "router";
|
|
62
|
+
break;
|
|
63
|
+
case "next-auth":
|
|
64
|
+
tertiaryFolder = "auth";
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
91
69
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
70
|
+
if (config.framework.includes("vite")) {
|
|
71
|
+
copyFolder(
|
|
72
|
+
path.join(__dirname, `./templates/${baseFolder}/${tertiaryFolder}`),
|
|
73
|
+
projectPath,
|
|
74
|
+
);
|
|
75
|
+
fs.writeFileSync("vite.config.ts", generateViteConfig(config));
|
|
76
|
+
fs.writeFileSync("index.html", generateIndexHtml(config));
|
|
77
|
+
fs.writeFileSync(
|
|
78
|
+
"src/styles/style.css",
|
|
79
|
+
generateStylesCss(config.libraries.includes("@undp/data-viz")),
|
|
80
|
+
);
|
|
81
|
+
if (config.addStaticWebAppConfig) {
|
|
82
|
+
fs.writeFileSync(
|
|
83
|
+
"staticwebapp.config.json",
|
|
84
|
+
generateStaticWebAppConfig(),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
copyFolder(
|
|
89
|
+
path.join(__dirname, `./templates/${baseFolder}/${tertiaryFolder}`),
|
|
90
|
+
projectPath,
|
|
91
|
+
);
|
|
92
|
+
fs.writeFileSync(
|
|
93
|
+
"app/layout.tsx",
|
|
94
|
+
generateLayoutForNext(config.projectName, config.query),
|
|
95
|
+
);
|
|
96
|
+
fs.writeFileSync(
|
|
97
|
+
"app/globals.css",
|
|
98
|
+
generateStylesCss(config.libraries.includes("@undp/data-viz")),
|
|
99
|
+
);
|
|
100
|
+
fs.writeFileSync("next-env.d.ts", generateNextEnvTypes());
|
|
101
|
+
fs.writeFileSync("app/page.tsx", generatePageForNext(config.query));
|
|
102
|
+
if (config.framework === "next-auth")
|
|
103
|
+
fs.writeFileSync(".env.local", generateEnv());
|
|
104
|
+
if (config.query)
|
|
105
|
+
copyFolder(
|
|
106
|
+
path.join(__dirname, "./templates/queryIntegrationForNext"),
|
|
107
|
+
projectPath,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
fs.writeFileSync(
|
|
111
|
+
".gitignore",
|
|
112
|
+
generateGitIgnore(config.framework.includes("vite")),
|
|
113
|
+
);
|
|
114
|
+
fs.writeFileSync(
|
|
115
|
+
"package.json",
|
|
116
|
+
JSON.stringify(generatePackageJson(config), null, 2),
|
|
117
|
+
);
|
|
100
118
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
console.log(chalk.green(" ✓ Project folder and files generated\n"));
|
|
120
|
+
|
|
121
|
+
const { installNow } = await inquirer.prompt([
|
|
122
|
+
{
|
|
123
|
+
type: "confirm",
|
|
124
|
+
name: "installNow",
|
|
125
|
+
message: "Would you like to install dependencies now?",
|
|
126
|
+
default: true,
|
|
127
|
+
},
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
console.log(
|
|
131
|
+
chalk.bold.yellow(
|
|
132
|
+
"\n📦 Installing dependencies (this might take some time)...",
|
|
133
|
+
),
|
|
134
|
+
);
|
|
135
|
+
if (installNow) {
|
|
136
|
+
try {
|
|
137
|
+
execSync("npm install", { stdio: "inherit" });
|
|
138
|
+
console.log(chalk.green(" ✓ All dependencies installed"));
|
|
139
|
+
} catch {
|
|
140
|
+
console.log(
|
|
141
|
+
chalk.yellow(
|
|
142
|
+
" ⚠️ Skipped installing dependencies (npm not installed or error occurred)",
|
|
143
|
+
),
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
execSync("git init", { stdio: "ignore" });
|
|
149
|
+
console.log(chalk.green(" ✓ Git repository initialized"));
|
|
150
|
+
} catch {
|
|
151
|
+
console.log(
|
|
152
|
+
chalk.yellow(
|
|
153
|
+
" ⚠️ Skipped git init (Git not installed or error occurred)",
|
|
154
|
+
),
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
printSuccess(config, installNow);
|
|
117
158
|
}
|
|
118
159
|
|
|
119
|
-
main().catch(console.error);
|
|
160
|
+
main().catch(console.error);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "@undp/design-system-react/tailwind.css";
|
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
import type { Metadata } from
|
|
2
|
-
import { ReactNode } from
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import FooterEl from "@/components/Footer";
|
|
4
|
+
import HeaderEl from "@/components/Header";
|
|
3
5
|
|
|
4
|
-
import
|
|
5
|
-
import FooterEl from '@/components/Footer';
|
|
6
|
-
|
|
7
|
-
import './globals.css';
|
|
8
|
-
import '@undp/design-system-react/style.css';
|
|
6
|
+
import "./globals.css";
|
|
9
7
|
|
|
10
8
|
export const metadata: Metadata = {
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
title: "My Next + UNDP app",
|
|
10
|
+
description: "Generated by create undp app",
|
|
13
11
|
};
|
|
14
12
|
|
|
15
13
|
export default function RootLayout({
|
|
16
|
-
|
|
14
|
+
children,
|
|
17
15
|
}: Readonly<{
|
|
18
|
-
|
|
16
|
+
children: ReactNode;
|
|
19
17
|
}>) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
return (
|
|
19
|
+
<html lang="en">
|
|
20
|
+
<body className="flex flex-col gap-0 min-h-screen">
|
|
21
|
+
<HeaderEl />
|
|
22
|
+
<main className="grow flex flex-col justify-center">
|
|
23
|
+
<div className="flex flex-col justify-center">{children}</div>
|
|
24
|
+
</main>
|
|
25
|
+
<FooterEl />
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
28
|
+
);
|
|
31
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.5.15/schema.json",
|
|
3
3
|
"vcs": {
|
|
4
4
|
"enabled": true,
|
|
5
5
|
"clientKind": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"linter": {
|
|
20
20
|
"enabled": true,
|
|
21
21
|
"rules": {
|
|
22
|
-
"
|
|
22
|
+
"preset": "recommended",
|
|
23
23
|
"suspicious": {
|
|
24
24
|
"noExplicitAny": "warn",
|
|
25
25
|
"noUnassignedVariables": "warn",
|
|
@@ -66,5 +66,10 @@
|
|
|
66
66
|
"organizeImports": "on"
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
},
|
|
70
|
+
"css": {
|
|
71
|
+
"parser": {
|
|
72
|
+
"tailwindDirectives": true
|
|
73
|
+
}
|
|
69
74
|
}
|
|
70
75
|
}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import type { Metadata } from
|
|
2
|
-
import { ReactNode } from
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import FooterEl from "@/components/Footer";
|
|
4
|
+
import HeaderEl from "@/components/Header";
|
|
3
5
|
|
|
4
|
-
import
|
|
5
|
-
import FooterEl from '@/components/Footer';
|
|
6
|
-
|
|
7
|
-
import './globals.css';
|
|
8
|
-
import '@undp/design-system-react/style.css';
|
|
9
|
-
import '@undp/data-viz/style.css';
|
|
6
|
+
import "./globals.css";
|
|
10
7
|
|
|
11
8
|
export const metadata: Metadata = {
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
title: "My Next + UNDP app",
|
|
10
|
+
description: "Generated by create undp app",
|
|
14
11
|
};
|
|
15
12
|
|
|
16
13
|
export default function RootLayout({
|
|
17
|
-
|
|
14
|
+
children,
|
|
18
15
|
}: Readonly<{
|
|
19
|
-
|
|
16
|
+
children: ReactNode;
|
|
20
17
|
}>) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
return (
|
|
19
|
+
<html lang="en">
|
|
20
|
+
<body className="flex flex-col gap-0 min-h-screen">
|
|
21
|
+
<HeaderEl />
|
|
22
|
+
<main className="grow flex flex-col justify-center">
|
|
23
|
+
<div className="flex flex-col justify-center">{children}</div>
|
|
24
|
+
</main>
|
|
25
|
+
<FooterEl />
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
28
|
+
);
|
|
32
29
|
}
|