@undp/create-app 0.0.1 → 0.1.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 (2) hide show
  1. package/bin/index.js +16 -4
  2. package/package.json +1 -1
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.0",
4
4
  "description": "UNDP's project scaffolding tool",
5
5
  "bin": {
6
6
  "create-undp-app": "./bin/index.js"