@suryasairus/create-projectx 1.0.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/index.js +28 -0
  2. package/package.json +12 -0
package/index.js ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import inquirer from 'inquirer';
3
+ import fs from 'fs-extra';
4
+ import { execSync } from 'child_process';
5
+
6
+ async function run() {
7
+ const projectName = process.argv[2] || 'my-app';
8
+
9
+ // 1. Ask DB Questions
10
+ const answers = await inquirer.prompt([
11
+ { name: 'dbHost', message: 'Database Host:', default: 'localhost' },
12
+ { name: 'dbUser', message: 'Database User:' }
13
+ ]);
14
+
15
+ // 2. Create the folder
16
+ fs.mkdirSync(projectName);
17
+
18
+ // 3. Create the .env file
19
+ const envData = `DATABASE_URL=postgresql://${answers.dbUser}@${answers.dbHost}:5432/mydb`;
20
+ fs.writeFileSync(`${projectName}/.env`, envData);
21
+
22
+ // 4. Download your source code (e.g., from a GitHub repo)
23
+ console.log('Downloading template...');
24
+ execSync(`npx degit your-github-username/projectx-template ${projectName}`);
25
+
26
+ console.log('Done! Now run: cd ' + projectName + ' && npm install');
27
+ }
28
+ run();
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@suryasairus/create-projectx",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "commonjs",
8
+ "main": "index.js",
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ }
12
+ }