create-jant 0.2.5 → 0.3.10
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/index.js +24 -21
- package/package.json +1 -1
- package/template/scripts/seed-demo.sql +6 -6
- package/template/vite.config.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import path from "path";
|
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
9
|
var __filename = fileURLToPath(import.meta.url);
|
|
10
10
|
var __dirname = path.dirname(__filename);
|
|
11
|
-
var CORE_VERSION = "0.3.
|
|
11
|
+
var CORE_VERSION = "0.3.10";
|
|
12
12
|
var TEMPLATE_DIR = fs.existsSync(path.resolve(__dirname, "../template")) ? path.resolve(__dirname, "../template") : path.resolve(__dirname, "../../../templates/jant-site");
|
|
13
13
|
function isValidProjectName(name) {
|
|
14
14
|
return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(name);
|
|
@@ -19,6 +19,27 @@ function toValidProjectName(name) {
|
|
|
19
19
|
function generateAuthSecret() {
|
|
20
20
|
return crypto.randomBytes(32).toString("base64");
|
|
21
21
|
}
|
|
22
|
+
function processMarkers(content, vars) {
|
|
23
|
+
content = content.replace(
|
|
24
|
+
/\s*(?:\/\/|#)\s*@create-jant:\s*@remove-start[\s\S]*?(?:\/\/|#)\s*@create-jant:\s*@remove-end\n?/g,
|
|
25
|
+
""
|
|
26
|
+
);
|
|
27
|
+
content = content.replace(
|
|
28
|
+
/^.*(?:\/\/|#)\s*@create-jant:\s*@remove\s*\n?/gm,
|
|
29
|
+
""
|
|
30
|
+
);
|
|
31
|
+
content = content.replace(
|
|
32
|
+
/^(.+=\s*)"[^"]*"\s*(?:\/\/|#)\s*@create-jant:\s*"([^"]*)"/gm,
|
|
33
|
+
(_, prefix, template) => {
|
|
34
|
+
const value = template.replace(
|
|
35
|
+
/\$\{(\w+)\}/g,
|
|
36
|
+
(__, key) => vars[key] ?? ""
|
|
37
|
+
);
|
|
38
|
+
return `${prefix}"${value}"`;
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return content;
|
|
42
|
+
}
|
|
22
43
|
async function copyTemplate(config) {
|
|
23
44
|
const { projectName, targetDir } = config;
|
|
24
45
|
await fs.copy(TEMPLATE_DIR, targetDir, {
|
|
@@ -66,18 +87,7 @@ async function copyTemplate(config) {
|
|
|
66
87
|
const wranglerPath = path.join(targetDir, "wrangler.toml");
|
|
67
88
|
if (await fs.pathExists(wranglerPath)) {
|
|
68
89
|
let content = await fs.readFile(wranglerPath, "utf-8");
|
|
69
|
-
|
|
70
|
-
content = content.replace(
|
|
71
|
-
/^(.+=\s*)"[^"]*"\s*#\s*@create-jant:\s*"([^"]*)"/gm,
|
|
72
|
-
(_, prefix, template) => {
|
|
73
|
-
const value = template.replace(
|
|
74
|
-
/\$\{(\w+)\}/g,
|
|
75
|
-
(__, key) => vars[key] ?? ""
|
|
76
|
-
);
|
|
77
|
-
return `${prefix}"${value}"`;
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
content = content.replace(/^.*#\s*@create-jant:\s*@remove\s*\n?/gm, "");
|
|
90
|
+
content = processMarkers(content, { name: projectName });
|
|
81
91
|
await fs.writeFile(wranglerPath, content, "utf-8");
|
|
82
92
|
}
|
|
83
93
|
const authSecret = generateAuthSecret();
|
|
@@ -113,14 +123,7 @@ S3_SECRET_ACCESS_KEY=
|
|
|
113
123
|
const viteConfigPath = path.join(targetDir, "vite.config.ts");
|
|
114
124
|
if (await fs.pathExists(viteConfigPath)) {
|
|
115
125
|
let content = await fs.readFile(viteConfigPath, "utf-8");
|
|
116
|
-
content = content
|
|
117
|
-
/\s*\/\/ @monorepo-only-start[\s\S]*?\/\/ @monorepo-only-end\n?/g,
|
|
118
|
-
""
|
|
119
|
-
);
|
|
120
|
-
content = content.replace(
|
|
121
|
-
/@jant\/core\/src\/([^"']+)\.ts/g,
|
|
122
|
-
"@jant/core/dist/$1.js"
|
|
123
|
-
);
|
|
126
|
+
content = processMarkers(content, {});
|
|
124
127
|
await fs.writeFile(viteConfigPath, content, "utf-8");
|
|
125
128
|
}
|
|
126
129
|
}
|
package/package.json
CHANGED
|
@@ -187,9 +187,9 @@ INSERT INTO post_collections VALUES(1,1,1770689095);
|
|
|
187
187
|
INSERT INTO post_collections VALUES(6,2,1770758568);
|
|
188
188
|
|
|
189
189
|
-- media
|
|
190
|
-
INSERT INTO media VALUES('019c496c-46bd-7954-bd6a-77b1b8f1d451',NULL,'019c496c-46bd-7954-bd6a-77b1b8f1d451.webp','tegan-conway-KaFfNTw8OYQ-unsplash.webp','image/webp',715364,'media/2026/02/019c496c-46bd-7954-bd6a-77b1b8f1d451.webp',NULL,NULL,NULL,1770758358,0,NULL);
|
|
191
|
-
INSERT INTO media VALUES('019c496c-5e44-70d2-ac8a-c0c0bdaab65c',6,'019c496c-5e44-70d2-ac8a-c0c0bdaab65c.webp','land-o-lakes-inc-9w6Qb-dqBwE-unsplash.webp','image/webp',306042,'media/2026/02/019c496c-5e44-70d2-ac8a-c0c0bdaab65c.webp',NULL,NULL,NULL,1770758364,3,NULL);
|
|
192
|
-
INSERT INTO media VALUES('019c496d-5011-7981-89a0-b4373a695d78',6,'019c496d-5011-7981-89a0-b4373a695d78.webp','land-o-lakes-inc-k71TQkbVIgI-unsplash.webp','image/webp',597680,'media/2026/02/019c496d-5011-7981-89a0-b4373a695d78.webp',NULL,NULL,NULL,1770758426,2,NULL);
|
|
193
|
-
INSERT INTO media VALUES('019c496d-630c-70b4-9004-51a194746566',6,'019c496d-630c-70b4-9004-51a194746566.webp','thingsneverchange-CgHNmQ0c2w4-unsplash.webp','image/webp',358320,'media/2026/02/019c496d-630c-70b4-9004-51a194746566.webp',NULL,NULL,NULL,1770758431,1,NULL);
|
|
194
|
-
INSERT INTO media VALUES('019c496d-720f-70d2-98b8-3779457de73c',6,'019c496d-720f-70d2-98b8-3779457de73c.webp','willian-justen-de-vasconcellos-7jg7Y_Mlf2Q-unsplash.webp','image/webp',478956,'media/2026/02/019c496d-720f-70d2-98b8-3779457de73c.webp',NULL,NULL,NULL,1770758435,0,NULL);
|
|
195
|
-
INSERT INTO media VALUES('019c496e-6904-7f61-b14f-080035ffe23f',5,'019c496e-6904-7f61-b14f-080035ffe23f.webp','richard-stachmann-Es--yoQocSM-unsplash.webp','image/webp',381534,'media/2026/02/019c496e-6904-7f61-b14f-080035ffe23f.webp',NULL,NULL,NULL,1770758498,0,NULL);
|
|
190
|
+
INSERT INTO media VALUES('019c496c-46bd-7954-bd6a-77b1b8f1d451',NULL,'019c496c-46bd-7954-bd6a-77b1b8f1d451.webp','tegan-conway-KaFfNTw8OYQ-unsplash.webp','image/webp',715364,'media/2026/02/019c496c-46bd-7954-bd6a-77b1b8f1d451.webp',NULL,NULL,NULL,1770758358,0,NULL,'r2');
|
|
191
|
+
INSERT INTO media VALUES('019c496c-5e44-70d2-ac8a-c0c0bdaab65c',6,'019c496c-5e44-70d2-ac8a-c0c0bdaab65c.webp','land-o-lakes-inc-9w6Qb-dqBwE-unsplash.webp','image/webp',306042,'media/2026/02/019c496c-5e44-70d2-ac8a-c0c0bdaab65c.webp',NULL,NULL,NULL,1770758364,3,NULL,'r2');
|
|
192
|
+
INSERT INTO media VALUES('019c496d-5011-7981-89a0-b4373a695d78',6,'019c496d-5011-7981-89a0-b4373a695d78.webp','land-o-lakes-inc-k71TQkbVIgI-unsplash.webp','image/webp',597680,'media/2026/02/019c496d-5011-7981-89a0-b4373a695d78.webp',NULL,NULL,NULL,1770758426,2,NULL,'r2');
|
|
193
|
+
INSERT INTO media VALUES('019c496d-630c-70b4-9004-51a194746566',6,'019c496d-630c-70b4-9004-51a194746566.webp','thingsneverchange-CgHNmQ0c2w4-unsplash.webp','image/webp',358320,'media/2026/02/019c496d-630c-70b4-9004-51a194746566.webp',NULL,NULL,NULL,1770758431,1,NULL,'r2');
|
|
194
|
+
INSERT INTO media VALUES('019c496d-720f-70d2-98b8-3779457de73c',6,'019c496d-720f-70d2-98b8-3779457de73c.webp','willian-justen-de-vasconcellos-7jg7Y_Mlf2Q-unsplash.webp','image/webp',478956,'media/2026/02/019c496d-720f-70d2-98b8-3779457de73c.webp',NULL,NULL,NULL,1770758435,0,NULL,'r2');
|
|
195
|
+
INSERT INTO media VALUES('019c496e-6904-7f61-b14f-080035ffe23f',5,'019c496e-6904-7f61-b14f-080035ffe23f.webp','richard-stachmann-Es--yoQocSM-unsplash.webp','image/webp',381534,'media/2026/02/019c496e-6904-7f61-b14f-080035ffe23f.webp',NULL,NULL,NULL,1770758498,0,NULL,'r2');
|
package/template/vite.config.ts
CHANGED
|
@@ -193,7 +193,7 @@ export default defineConfig({
|
|
|
193
193
|
|
|
194
194
|
resolve: {
|
|
195
195
|
alias: {
|
|
196
|
-
// @
|
|
196
|
+
// @create-jant: @remove-start
|
|
197
197
|
// Monorepo development aliases
|
|
198
198
|
// - @lingui/react/macro: Prevents Vite dependency scan error. Source code imports
|
|
199
199
|
// from @lingui/react/macro (for SWC plugin), but we use Hono JSX. SWC rewrites
|
|
@@ -206,7 +206,7 @@ export default defineConfig({
|
|
|
206
206
|
"../../packages/core/src/i18n/index.ts",
|
|
207
207
|
),
|
|
208
208
|
"@jant/core": resolve(__dirname, "../../packages/core/src"),
|
|
209
|
-
// @
|
|
209
|
+
// @create-jant: @remove-end
|
|
210
210
|
},
|
|
211
211
|
},
|
|
212
212
|
});
|