@voltkit/create-volt 0.1.9 → 0.1.11
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/dist/create-project.js +15 -2
- package/package.json +5 -2
package/dist/create-project.js
CHANGED
|
@@ -4,6 +4,16 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
import { updateVoltConfigContent } from './config-updater.js';
|
|
5
5
|
import { escapeHtml } from './options.js';
|
|
6
6
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
7
|
+
function detectPackageManager() {
|
|
8
|
+
const ua = process.env.npm_config_user_agent ?? '';
|
|
9
|
+
if (ua.startsWith('pnpm'))
|
|
10
|
+
return { name: 'pnpm', run: 'pnpm', exec: 'pnpm exec', install: 'pnpm install' };
|
|
11
|
+
if (ua.startsWith('yarn'))
|
|
12
|
+
return { name: 'yarn', run: 'yarn', exec: 'yarn', install: 'yarn' };
|
|
13
|
+
if (ua.startsWith('bun'))
|
|
14
|
+
return { name: 'bun', run: 'bun run', exec: 'bunx', install: 'bun install' };
|
|
15
|
+
return { name: 'npm', run: 'npm run', exec: 'npx', install: 'npm install' };
|
|
16
|
+
}
|
|
7
17
|
export async function createProject(options) {
|
|
8
18
|
const targetDir = resolve(process.cwd(), options.name);
|
|
9
19
|
if (existsSync(targetDir)) {
|
|
@@ -37,10 +47,13 @@ export async function createProject(options) {
|
|
|
37
47
|
html = html.replace(/<title>.*?<\/title>/is, `<title>${escapeHtml(options.displayName)}</title>`);
|
|
38
48
|
writeFileSync(htmlPath, html);
|
|
39
49
|
}
|
|
50
|
+
const pm = detectPackageManager();
|
|
40
51
|
console.log(' Done! Next steps:');
|
|
41
52
|
console.log();
|
|
42
53
|
console.log(` cd ${options.name}`);
|
|
43
|
-
console.log(
|
|
44
|
-
console.log(
|
|
54
|
+
console.log(` ${pm.install}`);
|
|
55
|
+
console.log(` ${pm.run} dev`);
|
|
56
|
+
console.log();
|
|
57
|
+
console.log(` Optional: run \`${pm.run} doctor\` to verify your environment.`);
|
|
45
58
|
console.log();
|
|
46
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltkit/create-volt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"license": "BSL-1.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "dist/index.js",
|
|
15
|
-
"files": [
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"templates"
|
|
18
|
+
],
|
|
16
19
|
"scripts": {
|
|
17
20
|
"build": "tsc && node -e \"require('node:fs').cpSync('src/templates','dist/templates',{recursive:true})\"",
|
|
18
21
|
"lint": "eslint \"src/**/*.{ts,mts,cts,js,mjs,cjs}\" --max-warnings 0",
|