@vatvaghool/create-ipl-dashboard 0.1.13 → 0.1.14

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 CHANGED
@@ -6,7 +6,7 @@ Scaffold a full-featured IPL fantasy cricket dashboard in seconds.
6
6
  npx @vatvaghool/create-ipl-dashboard my-league
7
7
  ```
8
8
 
9
- Follow the prompts to enter your fantasy league URL, collection name, and team names — the database is pre-configured, so you don't need to provide a MongoDB URI. You get a ready-to-run Next.js dashboard with standings charts, performance trackers, AI roasts, and more.
9
+ Follow the prompts to enter your MongoDB URI, fantasy league URL, collection name, and team names — you get a ready-to-run Next.js dashboard with standings charts, performance trackers, AI roasts, and more.
10
10
 
11
11
  ## Usage
12
12
 
@@ -27,12 +27,11 @@ npx @vatvaghool/create-ipl-dashboard [project-name] [options]
27
27
  | Prompt | Description |
28
28
  |--------|-------------|
29
29
  | Project name | Directory to scaffold into |
30
+ | MongoDB URI | Your MongoDB connection string (press Enter for a default) |
30
31
  | League URL | The fantasy.iplt20.com league page URL |
31
32
  | Collection name | MongoDB collection to store this league's data (e.g. `ipl_2025_office_league`) |
32
33
  | League name | Display name for your league |
33
- | Teams | Team names (and optional owners) in your league |
34
-
35
- The database connection (`MONGODB_URI`) is hardcoded — you only need to specify which collection each league should use.
34
+ | Teams | Team names (and optional owners) in your league
36
35
 
37
36
  If `--scrape` is provided, the CLI attempts to extract team names from the league page HTML. If that fails, it falls back to manual entry.
38
37
 
@@ -97,7 +96,7 @@ Open http://localhost:3000 to see your dashboard.
97
96
  The CLI:
98
97
 
99
98
  1. Copies a pre-built Next.js app template
100
- 2. Writes your `.env` with the pre-configured `MONGODB_URI`, `COLLECTION_NAME`, league URL, and league name
99
+ 2. Writes your `.env` with the `MONGODB_URI`, `COLLECTION_NAME`, league URL, and league name
101
100
  3. Generates `app/data/teams.ts` with your team roster
102
101
  4. Generates `app/data/league.ts` with league metadata
103
102
  5. Creates a placeholder `app/data/match-points.ts` (auto-populates as you sync)
@@ -132,4 +131,4 @@ npm run build
132
131
  npx vercel --prod
133
132
  ```
134
133
 
135
- Set `IPL_POST_SECRET` in your Vercel dashboard. The `MONGODB_URI` and `COLLECTION_NAME` are already configured in the scaffolded `.env`.
134
+ Set `IPL_POST_SECRET` in your Vercel dashboard. The `MONGODB_URI` and `COLLECTION_NAME` are already populated in the scaffolded `.env`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatvaghool/create-ipl-dashboard",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Scaffold an IPL fantasy cricket dashboard project",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.mjs CHANGED
@@ -3,11 +3,11 @@
3
3
  import { join } from "node:path";
4
4
  import { existsSync } from "node:fs";
5
5
  import { mkdir } from "node:fs/promises";
6
- import { getProjectName, getLeagueUrl, getCollectionName, getLeagueName, getTeams, close } from "./prompts.mjs";
6
+ import { getProjectName, getMongoUri, getLeagueUrl, getCollectionName, getLeagueName, getTeams, close } from "./prompts.mjs";
7
7
  import { scaffoldProject } from "./scaffold.mjs";
8
8
  import { scrapeTeamsFromUrl } from "./scraper.mjs";
9
9
 
10
- const MONGODB_URI = "mongodb+srv://admin:admin@cricket.ptjjrub.mongodb.net/?appName=cricket";
10
+ const DEFAULT_MONGODB_URI = "mongodb+srv://admin:admin@cricket.ptjjrub.mongodb.net/?appName=cricket";
11
11
 
12
12
  function printHelp(exitCode) {
13
13
  console.log(`
@@ -61,6 +61,7 @@ async function main() {
61
61
 
62
62
  await mkdir(projectPath, { recursive: true });
63
63
 
64
+ const mongoUri = await getMongoUri(DEFAULT_MONGODB_URI);
64
65
  const leagueUrl = await getLeagueUrl();
65
66
  const collectionName = await getCollectionName();
66
67
  const leagueName = await getLeagueName();
@@ -81,7 +82,7 @@ async function main() {
81
82
 
82
83
  close();
83
84
 
84
- await scaffoldProject(projectPath, { mongoUri: MONGODB_URI, leagueUrl, collectionName, leagueName, teams, skipInstall: flags.skipInstall });
85
+ await scaffoldProject(projectPath, { mongoUri, leagueUrl, collectionName, leagueName, teams, skipInstall: flags.skipInstall });
85
86
 
86
87
  console.log("");
87
88
  console.log(" Next steps:");
package/src/prompts.mjs CHANGED
@@ -33,6 +33,15 @@ export async function getProjectName(args) {
33
33
  return (await prompt("Project name: ")).trim() || "ipl-dashboard";
34
34
  }
35
35
 
36
+ export async function getMongoUri(defaultUri) {
37
+ if (!isTTY) {
38
+ await consumeAllLines();
39
+ return (pipedLines[promptIndex++] || defaultUri || "").trim();
40
+ }
41
+ const answer = (await prompt(`MongoDB URI (press Enter for default): `)).trim();
42
+ return answer || defaultUri || "";
43
+ }
44
+
36
45
  export async function getLeagueUrl() {
37
46
  if (!isTTY) {
38
47
  await consumeAllLines();