@undp/create-app 0.0.1 → 0.1.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 ADDED
@@ -0,0 +1,32 @@
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**, **Vite**, 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
+ - ⚡ **Vite + React + TypeScript + TailwindCSS** setup out of the box
12
+ - 🧱 Preconfigured for UNDP’s Design System
13
+ - 🎨 Optional integrations (TanStack Query, TanStack Router, @undp/data-viz)
14
+ - 🧩 Automatically installs dependencies
15
+ - 🧼 ESLint + Prettier + Vite config ready
16
+
17
+ ---
18
+
19
+ ## 📦 Installation
20
+
21
+ You don’t need to install it globally — just use **npx**:
22
+
23
+ ```bash
24
+ npx @undp/create-app my-project
25
+ ```
26
+
27
+ or install it globally
28
+
29
+ ```bash
30
+ npm install -g @undp/create-app
31
+ create-undp-app my-project
32
+ ```
@@ -44,7 +44,7 @@ export function generateFiles(config) {
44
44
 
45
45
  // Config files
46
46
  console.log(chalk.bold.yellow('\n⚙️ Creating configuration and tooling files...'));
47
- copyTemplate('eslint.config.js', 'eslint.config.js', ['templates', 'configFiles']);
47
+ copyTemplate('eslint.config.mjs', 'eslint.config.mjs', ['templates', 'configFiles']);
48
48
  copyTemplate('.prettierrc', '.prettierrc', ['templates', 'configFiles']);
49
49
  copyTemplate('vite.config.ts', config.addPostCSSScripts ? 'vite.config.ts.txt' : 'viteWithoutPostCss.config.ts.txt', ['templates', 'configFiles']);
50
50
  fs.writeFileSync('src/vite-env.d.ts', `/// <reference types="vite/client" />`);
package/bin/index.js CHANGED
@@ -1,8 +1,9 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import path from 'path';
4
4
  import inquirer from 'inquirer';
5
5
  import chalk from 'chalk';
6
+ import { execSync } from 'child_process';
6
7
  import { promptUser } from './promptUser.js';
7
8
  import { generateFiles } from './generateFiles.js';
8
9
  import { printSuccess, createFolders } from './utils/index.js';
@@ -48,9 +49,20 @@ async function main() {
48
49
  ]);
49
50
 
50
51
  console.log(chalk.bold.yellow('\n📦 Installing dependencies (this might take some time)...'));
51
- if (installNow) execSync('npm install', { stdio: 'inherit' })
52
- console.log(chalk.green(' ✓ All dependencies installed'));
53
-
52
+ if (installNow) {
53
+ try {
54
+ execSync('npm install', { stdio: 'inherit' })
55
+ console.log(chalk.green(' ✓ All dependencies installed'));
56
+ } catch {
57
+ console.log(chalk.yellow(' ⚠️ Skipped installing dependencies (npm not installed or error occurred)'));
58
+ }
59
+ }
60
+ try {
61
+ execSync('git init', { stdio: 'ignore' });
62
+ console.log(chalk.green(' ✓ Git repository initialized'));
63
+ } catch {
64
+ console.log(chalk.yellow(' ⚠️ Skipped git init (Git not installed or error occurred)'));
65
+ }
54
66
  printSuccess(config, installNow);
55
67
  }
56
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@undp/create-app",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "UNDP's project scaffolding tool",
5
5
  "bin": {
6
6
  "create-undp-app": "./bin/index.js"