create-slidev 52.19.0 → 52.19.2
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/index.mjs +6 -26
- package/package.json +4 -3
- package/template/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import process from 'node:process'
|
|
|
8
8
|
import { fileURLToPath } from 'node:url'
|
|
9
9
|
import { blue, bold, cyan, dim, green, yellow } from 'ansis'
|
|
10
10
|
import minimist from 'minimist'
|
|
11
|
+
import { detect } from 'package-manager-detector/detect'
|
|
11
12
|
import path from 'pathe'
|
|
12
13
|
import prompts from 'prompts'
|
|
13
14
|
import { x } from 'tinyexec'
|
|
@@ -95,21 +96,7 @@ async function init() {
|
|
|
95
96
|
|
|
96
97
|
console.log(green(' Done.\n'))
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
const pm = []
|
|
100
|
-
if (typeof Deno !== 'undefined')
|
|
101
|
-
pm.push('deno')
|
|
102
|
-
if (typeof Bun !== 'undefined')
|
|
103
|
-
pm.push('bun')
|
|
104
|
-
const userAgent = process.env.npm_config_user_agent || ''
|
|
105
|
-
const execPath = process.env.npm_execpath || ''
|
|
106
|
-
if (execPath.includes('pnpm') || userAgent.includes('pnpm'))
|
|
107
|
-
pm.push('pnpm')
|
|
108
|
-
if (execPath.includes('yarn') || userAgent.includes('yarn'))
|
|
109
|
-
pm.push('yarn')
|
|
110
|
-
return pm.length === 1 ? pm[0] : null
|
|
111
|
-
}
|
|
112
|
-
const pkgManager = getPkgManager()
|
|
99
|
+
const pkgManager = await detect().catch(() => undefined) ?? 'npm'
|
|
113
100
|
|
|
114
101
|
/**
|
|
115
102
|
* @type {{ yes: boolean }}
|
|
@@ -122,19 +109,12 @@ async function init() {
|
|
|
122
109
|
})
|
|
123
110
|
|
|
124
111
|
if (yes) {
|
|
125
|
-
|
|
126
|
-
name: 'agent',
|
|
127
|
-
type: 'select',
|
|
128
|
-
message: 'Choose the package manager',
|
|
129
|
-
choices: ['npm', 'yarn', 'pnpm', 'bun', 'deno'].map(i => ({ value: i, title: i })),
|
|
130
|
-
}).agent)
|
|
131
|
-
|
|
132
|
-
if (!agent)
|
|
112
|
+
if (!pkgManager)
|
|
133
113
|
return
|
|
134
114
|
|
|
135
|
-
writeReadme(
|
|
136
|
-
await x(
|
|
137
|
-
await x(
|
|
115
|
+
writeReadme(pkgManager)
|
|
116
|
+
await x(pkgManager, ['install'], { nodeOptions: { stdio: 'inherit', cwd: root } })
|
|
117
|
+
await x(pkgManager, ['run', 'dev'], { nodeOptions: { stdio: 'inherit', cwd: root } })
|
|
138
118
|
}
|
|
139
119
|
else {
|
|
140
120
|
writeReadme(pkgManager)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-slidev",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "52.19.
|
|
4
|
+
"version": "52.19.2",
|
|
5
5
|
"description": "Create starter template for Slidev",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"node": ">=20.12.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"ansis": "^4.
|
|
27
|
+
"ansis": "^4.4.0",
|
|
28
28
|
"minimist": "^1.2.8",
|
|
29
|
+
"package-manager-detector": "^1.8.0",
|
|
29
30
|
"pathe": "^2.0.3",
|
|
30
31
|
"prompts": "^2.4.2",
|
|
31
|
-
"tinyexec": "^1.3.
|
|
32
|
+
"tinyexec": "^1.3.1"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"build": "node build.mjs"
|