@ardly/bunext 1.0.2 → 1.0.4
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/bin/cli.mjs +76 -41
- package/package.json +11 -1
package/bin/cli.mjs
CHANGED
|
@@ -13,55 +13,90 @@ const runCommand = (command) => {
|
|
|
13
13
|
return true
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const repoName = process.argv[2]
|
|
17
|
-
const gitCheckout = `git clone --depth 1 https://github.com/DarkidOP/Bunext.git ${repoName}`
|
|
18
|
-
const installDeps = `cd ${repoName} && bun install`
|
|
19
|
-
const removeGit = `cd ${repoName} && rm -rf .git`
|
|
20
|
-
const initGit = `cd ${repoName} && git init && git add . && git commit -m "Initial commit"`
|
|
21
|
-
|
|
22
16
|
const rl = readline.createInterface({
|
|
23
17
|
input: process.stdin,
|
|
24
18
|
output: process.stdout,
|
|
25
19
|
})
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'Failed to clone template repository "https://github.com/DarkidOP/Bunext.git"'
|
|
32
|
-
)
|
|
33
|
-
process.exit(1)
|
|
34
|
-
}
|
|
21
|
+
let repoName = process.argv[2]
|
|
22
|
+
const args = process.argv.slice(2)
|
|
23
|
+
const useVSCode = args.includes('--vs')
|
|
24
|
+
const useCursor = args.includes('--cursor')
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
if (!repoName || repoName.startsWith('--')) {
|
|
27
|
+
rl.question('Please enter a name for your project: ', (answer) => {
|
|
28
|
+
repoName = answer
|
|
29
|
+
initializeProject()
|
|
30
|
+
})
|
|
31
|
+
} else {
|
|
32
|
+
initializeProject()
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
35
|
+
function initializeProject() {
|
|
36
|
+
const gitCheckout = `git clone --depth 1 https://github.com/DarkidOP/Bunext.git ${repoName}`
|
|
37
|
+
const removeGit = `cd ${repoName} && rm -rf .git`
|
|
38
|
+
const initGit = `cd ${repoName} && git init && git add . && git commit -m "Initial commit"`
|
|
39
|
+
const openVSCode = `cd ${repoName} && code .`
|
|
40
|
+
const openCursor = `cd ${repoName} && cursor .`
|
|
49
41
|
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
// Determine package manager based on how script was executed
|
|
43
|
+
let packageManager = 'npm'
|
|
44
|
+
if (process.env.npm_execpath?.includes('pnpm')) {
|
|
45
|
+
packageManager = 'pnpm'
|
|
46
|
+
} else if (process.env.npm_execpath?.includes('yarn')) {
|
|
47
|
+
packageManager = 'yarn'
|
|
48
|
+
} else if (process.argv[1].includes('bunx')) {
|
|
49
|
+
packageManager = 'bun'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const installDeps = `cd ${repoName} && ${packageManager} install`
|
|
53
|
+
|
|
54
|
+
console.log(`Creating project template in ./${repoName}`)
|
|
55
|
+
const checkedOut = runCommand(gitCheckout)
|
|
56
|
+
if (!checkedOut) {
|
|
57
|
+
console.error(
|
|
58
|
+
'Failed to clone template repository "https://github.com/DarkidOP/Bunext.git"'
|
|
59
|
+
)
|
|
60
|
+
process.exit(1)
|
|
61
|
+
}
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
console.log('Removing Git history...')
|
|
64
|
+
const removedGit = runCommand(removeGit)
|
|
65
|
+
if (!removedGit) {
|
|
66
|
+
console.error('Failed to remove Git history')
|
|
67
|
+
process.exit(1)
|
|
66
68
|
}
|
|
67
|
-
|
|
69
|
+
|
|
70
|
+
console.log('Installing dependencies...')
|
|
71
|
+
const installedDeps = runCommand(installDeps)
|
|
72
|
+
if (!installedDeps) {
|
|
73
|
+
console.error('Failed to install dependencies')
|
|
74
|
+
process.exit(1)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
rl.question(
|
|
78
|
+
'Would you like to initialize a new git repository? (y/n) ',
|
|
79
|
+
(answer) => {
|
|
80
|
+
if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
|
|
81
|
+
console.log('Initializing Git repository...')
|
|
82
|
+
const initializedGit = runCommand(initGit)
|
|
83
|
+
if (!initializedGit) {
|
|
84
|
+
console.error('Failed to initialize Git repository')
|
|
85
|
+
process.exit(1)
|
|
86
|
+
}
|
|
87
|
+
console.log('Git repository initialized successfully!')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (useVSCode) {
|
|
91
|
+
console.log('Opening in Visual Studio Code...')
|
|
92
|
+
runCommand(openVSCode)
|
|
93
|
+
} else if (useCursor) {
|
|
94
|
+
console.log('Opening in Cursor...')
|
|
95
|
+
runCommand(openCursor)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log('\nHappy coding! 🎉')
|
|
99
|
+
rl.close()
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
}
|
package/package.json
CHANGED
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
"name": "@ardly/bunext",
|
|
3
3
|
"description": "Bunext - A Next.js 15 template with Tailwind CSS, shadcn ui and Bun with some utilities built in",
|
|
4
4
|
"author": "Ard Astroid <ardastroid@gmail.com>",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.4",
|
|
6
6
|
"bin": "./bin/cli.mjs",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"next.js",
|
|
9
|
+
"react",
|
|
10
|
+
"typescript",
|
|
11
|
+
"tailwindcss",
|
|
12
|
+
"shadcn-ui",
|
|
13
|
+
"bun",
|
|
14
|
+
"template",
|
|
15
|
+
"starter"
|
|
16
|
+
],
|
|
7
17
|
"scripts": {
|
|
8
18
|
"dev": "next dev --turbopack",
|
|
9
19
|
"build": "next build",
|