create-jant 0.1.0 → 0.1.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/README.md +3 -3
- package/dist/index.js +11 -7
- package/package.json +3 -2
- package/template/pnpm-workspace.yaml +7 -0
package/README.md
CHANGED
|
@@ -6,13 +6,13 @@ Bookstrap a new [Jant](https://github.com/jant-me/jant) project.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Using npm
|
|
9
|
-
npm create jant my-
|
|
9
|
+
npm create jant my-blog
|
|
10
10
|
|
|
11
11
|
# Using pnpm
|
|
12
|
-
pnpm create jant my-
|
|
12
|
+
pnpm create jant my-blog
|
|
13
13
|
|
|
14
14
|
# Using yarn
|
|
15
|
-
yarn create jant my-
|
|
15
|
+
yarn create jant my-blog
|
|
16
16
|
|
|
17
17
|
# Interactive mode (prompts for project name)
|
|
18
18
|
npm create jant
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { program } from "commander";
|
|
3
3
|
import * as p from "@clack/prompts";
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
+
import crypto from "crypto";
|
|
5
6
|
import fs from "fs-extra";
|
|
6
7
|
import path from "path";
|
|
7
8
|
import { fileURLToPath } from "url";
|
|
@@ -14,6 +15,9 @@ function isValidProjectName(name) {
|
|
|
14
15
|
function toValidProjectName(name) {
|
|
15
16
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/^-+|-+$/g, "").replace(/-+/g, "-");
|
|
16
17
|
}
|
|
18
|
+
function generateAuthSecret() {
|
|
19
|
+
return crypto.randomBytes(32).toString("base64");
|
|
20
|
+
}
|
|
17
21
|
async function copyTemplate(config) {
|
|
18
22
|
const { projectName, targetDir } = config;
|
|
19
23
|
await fs.copy(TEMPLATE_DIR, targetDir, {
|
|
@@ -59,6 +63,12 @@ async function copyTemplate(config) {
|
|
|
59
63
|
content = content.replace(/bucket_name = "jant-site-media"/g, `bucket_name = "${projectName}-media"`);
|
|
60
64
|
await fs.writeFile(wranglerPath, content, "utf-8");
|
|
61
65
|
}
|
|
66
|
+
const authSecret = generateAuthSecret();
|
|
67
|
+
const devVarsContent = `# Generated by create-jant
|
|
68
|
+
# AUTH_SECRET is used for session encryption (better-auth)
|
|
69
|
+
AUTH_SECRET=${authSecret}
|
|
70
|
+
`;
|
|
71
|
+
await fs.writeFile(path.join(targetDir, ".dev.vars"), devVarsContent, "utf-8");
|
|
62
72
|
}
|
|
63
73
|
async function main() {
|
|
64
74
|
console.log();
|
|
@@ -131,13 +141,7 @@ async function main() {
|
|
|
131
141
|
}
|
|
132
142
|
console.log();
|
|
133
143
|
p.note(
|
|
134
|
-
[
|
|
135
|
-
`cd ${projectName}`,
|
|
136
|
-
"pnpm install",
|
|
137
|
-
"cp .dev.vars.example .dev.vars",
|
|
138
|
-
"# Edit .dev.vars with your AUTH_SECRET",
|
|
139
|
-
"pnpm dev"
|
|
140
|
-
].join("\n"),
|
|
144
|
+
[`cd ${projectName}`, "pnpm install", "pnpm dev"].join("\n"),
|
|
141
145
|
"Next steps"
|
|
142
146
|
);
|
|
143
147
|
p.outro(chalk.green("Happy coding!"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-jant",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Create a new Jant project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
],
|
|
48
48
|
"license": "AGPL-3.0",
|
|
49
49
|
"publishConfig": {
|
|
50
|
-
"access": "public"
|
|
50
|
+
"access": "public",
|
|
51
|
+
"provenance": true
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|
|
53
54
|
"build": "tsup src/index.ts --format esm --clean --outDir dist",
|