@jox51/purchases-boilerplate 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.
- package/README.md +42 -0
- package/bin/cli.js +14 -0
- package/lib/create-project.js +78 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @jox51/purchases-boilerplate
|
|
2
|
+
|
|
3
|
+
CLI tool to create new projects from the Laravel React Whop purchases boilerplate.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @jox51/purchases-boilerplate my-project-name
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will:
|
|
12
|
+
- Clone the boilerplate repository
|
|
13
|
+
- Set up the project with your chosen name
|
|
14
|
+
- Configure `.env` with your project name
|
|
15
|
+
- Provide setup instructions
|
|
16
|
+
|
|
17
|
+
## What's in the boilerplate?
|
|
18
|
+
|
|
19
|
+
- Laravel 12 + React 18 + Inertia.js
|
|
20
|
+
- Whop one-time payment integration with server-side polling
|
|
21
|
+
- Automatic membership cancellation (enables repeat purchases)
|
|
22
|
+
- Email notifications (buyer + admin)
|
|
23
|
+
- Blog system with admin dashboard
|
|
24
|
+
- Authentication (login, register, email verification)
|
|
25
|
+
- Landing page with pricing, features, FAQ, testimonials
|
|
26
|
+
- Contact form (Formspree)
|
|
27
|
+
- Google Tag Manager
|
|
28
|
+
- SEO optimization
|
|
29
|
+
|
|
30
|
+
## After Setup
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cd my-project-name
|
|
34
|
+
composer install
|
|
35
|
+
npm install
|
|
36
|
+
php artisan key:generate
|
|
37
|
+
# Edit .env with your database, Whop, and email credentials
|
|
38
|
+
php artisan migrate
|
|
39
|
+
php artisan serve & npm run dev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See the [full documentation](https://github.com/jox51/purchases-boilerplate#readme) for details.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { program } from "commander"
|
|
4
|
+
import { createProject } from "../lib/create-project.js"
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.version("1.0.0")
|
|
8
|
+
.description("Create a new project from the purchases boilerplate")
|
|
9
|
+
.argument("<project-name>", "Name of the project")
|
|
10
|
+
.action((projectName) => {
|
|
11
|
+
createProject(projectName)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
program.parse(process.argv)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import fs from "fs-extra"
|
|
2
|
+
import path from "path"
|
|
3
|
+
import chalk from "chalk"
|
|
4
|
+
import clone from "git-clone"
|
|
5
|
+
import { promisify } from "util"
|
|
6
|
+
|
|
7
|
+
const clonePromise = promisify(clone)
|
|
8
|
+
|
|
9
|
+
export async function createProject(projectName) {
|
|
10
|
+
const targetPath = path.join(process.cwd(), projectName)
|
|
11
|
+
const repoUrl = "https://github.com/jox51/purchases-boilerplate.git"
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
console.log(chalk.blue(`\nCreating new project: ${projectName}\n`))
|
|
15
|
+
|
|
16
|
+
// Clone the repository
|
|
17
|
+
await clonePromise(repoUrl, targetPath)
|
|
18
|
+
|
|
19
|
+
// Remove the .git directory
|
|
20
|
+
await fs.remove(path.join(targetPath, ".git"))
|
|
21
|
+
|
|
22
|
+
// Read the .env.example file
|
|
23
|
+
const envPath = path.join(targetPath, ".env.example")
|
|
24
|
+
let envContent = await fs.readFile(envPath, "utf8")
|
|
25
|
+
|
|
26
|
+
// Replace the APP_NAME in .env.example
|
|
27
|
+
envContent = envContent.replace(/APP_NAME=.*/, `APP_NAME="${projectName}"`)
|
|
28
|
+
|
|
29
|
+
// Replace DB_DATABASE with project name (sanitized)
|
|
30
|
+
const dbName = projectName.replace(/[^a-zA-Z0-9_]/g, "_").toLowerCase()
|
|
31
|
+
envContent = envContent.replace(/DB_DATABASE=.*/, `DB_DATABASE=${dbName}`)
|
|
32
|
+
|
|
33
|
+
// Write back the modified .env.example
|
|
34
|
+
await fs.writeFile(envPath, envContent)
|
|
35
|
+
|
|
36
|
+
// Create a new .env file from .env.example
|
|
37
|
+
await fs.copy(envPath, path.join(targetPath, ".env"))
|
|
38
|
+
|
|
39
|
+
console.log(chalk.green("Project created successfully!\n"))
|
|
40
|
+
console.log(chalk.cyan("Follow these steps to get started:\n"))
|
|
41
|
+
console.log(chalk.magenta(` 1. cd ${projectName}`))
|
|
42
|
+
console.log(chalk.blue(" 2. composer install"))
|
|
43
|
+
console.log(chalk.blue(" 3. npm install"))
|
|
44
|
+
console.log(chalk.blue(" 4. php artisan key:generate"))
|
|
45
|
+
console.log(
|
|
46
|
+
chalk.red.bold(
|
|
47
|
+
" 5. Configure your .env file:"
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
console.log(
|
|
51
|
+
chalk.yellow(" - DB_USERNAME and DB_PASSWORD")
|
|
52
|
+
)
|
|
53
|
+
console.log(
|
|
54
|
+
chalk.yellow(" - WHOP_API_KEY, WHOP_WEBHOOK_SECRET")
|
|
55
|
+
)
|
|
56
|
+
console.log(
|
|
57
|
+
chalk.yellow(" - WHOP_PLAN_1_ID, WHOP_PLAN_2_ID, WHOP_PLAN_3_ID")
|
|
58
|
+
)
|
|
59
|
+
console.log(
|
|
60
|
+
chalk.yellow(" - MAIL_USERNAME, MAIL_PASSWORD, MAIL_FROM_ADDRESS")
|
|
61
|
+
)
|
|
62
|
+
console.log(
|
|
63
|
+
chalk.yellow(" - PURCHASE_EMAIL_ADDRESS (admin notifications)")
|
|
64
|
+
)
|
|
65
|
+
console.log(chalk.blue(" 6. php artisan migrate"))
|
|
66
|
+
console.log(chalk.blue(" 7. php artisan db:seed --class=PostSeeder"))
|
|
67
|
+
console.log(chalk.green(" 8. php artisan serve"))
|
|
68
|
+
console.log(chalk.green(" 9. npm run dev"))
|
|
69
|
+
console.log(
|
|
70
|
+
chalk.cyan(
|
|
71
|
+
"\nYour Laravel + React + Whop purchases app is ready!\n"
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error(chalk.red("Error creating project:"), error)
|
|
76
|
+
process.exit(1)
|
|
77
|
+
}
|
|
78
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jox51/purchases-boilerplate",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI tool to create new projects from the Laravel React Whop purchases boilerplate",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-purchases-app": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"cli",
|
|
14
|
+
"laravel",
|
|
15
|
+
"react",
|
|
16
|
+
"inertia",
|
|
17
|
+
"whop",
|
|
18
|
+
"boilerplate",
|
|
19
|
+
"purchases"
|
|
20
|
+
],
|
|
21
|
+
"author": "jox51",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"chalk": "^5.3.0",
|
|
25
|
+
"commander": "^12.0.0",
|
|
26
|
+
"fs-extra": "^11.2.0",
|
|
27
|
+
"git-clone": "^0.2.0"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/jox51/purchases-boilerplate.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/jox51/purchases-boilerplate/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/jox51/purchases-boilerplate#readme",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|