@suryasairus/create-projectx 1.0.1 → 1.0.3

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 +22 -21
  2. package/package.json +9 -8
package/index.js CHANGED
@@ -1,28 +1,29 @@
1
1
  #!/usr/bin/env node
2
- import inquirer from 'inquirer';
3
- import fs from 'fs-extra';
4
- import { execSync } from 'child_process';
2
+ import fs from 'fs';
3
+ import path from 'path';
5
4
 
6
- async function run() {
7
- const projectName = process.argv[2] || 'my-app';
5
+ const projectName = process.argv[2] || 'my-app';
6
+ const projectPath = path.join(process.cwd(), projectName);
8
7
 
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
- ]);
8
+ // 1. Create folder
9
+ fs.mkdirSync(projectPath, { recursive: true });
14
10
 
15
- // 2. Create the folder
16
- fs.mkdirSync(projectName);
11
+ // 2. Create the user's package.json
12
+ const pkgJson = {
13
+ name: projectName,
14
+ version: "1.0.0",
15
+ scripts: {
16
+ "build": "next build node_modules/@suryasairus/projectx-core"
17
+ },
18
+ dependencies: {
19
+ "next": "latest",
20
+ "@suryasairus/projectx-core": "latest" // This package contains your code
21
+ }
22
+ };
17
23
 
18
- // 3. Create the .env file
19
- const envData = `DATABASE_URL=postgresql://${answers.dbUser}@${answers.dbHost}:5432/mydb`;
20
- fs.writeFileSync(`${projectName}/.env`, envData);
24
+ fs.writeFileSync(path.join(projectPath, 'package.json'), JSON.stringify(pkgJson, null, 2));
21
25
 
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}`);
26
+ // 3. Write .env (from your CLI questions)
27
+ fs.writeFileSync(path.join(projectPath, '.env'), "DATABASE_URL=your_value_here");
25
28
 
26
- console.log('Done! Now run: cd ' + projectName + ' && npm install');
27
- }
28
- run();
29
+ console.log(`Project ${projectName} created! Now run: cd ${projectName} && npm install`);
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@suryasairus/create-projectx",
3
- "version": "1.0.1",
4
- "description": "",
3
+ "version": "1.0.3",
4
+ "description": "CLI to scaffold ProjectX",
5
5
  "license": "ISC",
6
- "author": "",
7
- "type": "commonjs",
8
- "main": "index.js",
9
- "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
11
- }
6
+ "type": "module",
7
+ "bin": {
8
+ "create-projectx": "index.js"
9
+ },
10
+ "files": [
11
+ "index.js"
12
+ ]
12
13
  }