@batijs/cli 0.0.176 → 0.0.178
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/boilerplates/@batijs/auth0/files/$.env.js +19 -0
- package/dist/boilerplates/@batijs/auth0/files/$README.md.js +43 -0
- package/dist/boilerplates/@batijs/auth0/files/vike.d.ts +11 -0
- package/dist/boilerplates/@batijs/compiled/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/edgedb/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/eslint/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/express/files/$package.json.js +7 -3
- package/dist/boilerplates/@batijs/express/files/express-entry.ts +33 -11
- package/dist/boilerplates/@batijs/express/files/vike.d.ts +10 -0
- package/dist/boilerplates/@batijs/express/types/express-entry.d.ts +1 -1
- package/dist/boilerplates/@batijs/firebase-auth/files/$package.json.js +1 -7
- package/dist/boilerplates/@batijs/firebase-auth/files/firebase/$service-account.json.js +20 -0
- package/dist/boilerplates/@batijs/firebase-auth/files/libs/firebaseAdmin.ts +6 -6
- package/dist/boilerplates/@batijs/firebase-auth/files/libs/firebaseUI.ts +26 -26
- package/dist/boilerplates/@batijs/firebase-auth/files/pages/+firebaseApp.ts +2 -1
- package/dist/boilerplates/@batijs/firebase-auth/files/pages/login/+guard.ts +5 -5
- package/dist/boilerplates/@batijs/firebase-auth/files/{types.ts → vike.d.ts} +0 -9
- package/dist/boilerplates/@batijs/firebase-auth/types/pages/login/+guard.d.ts +1 -1
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +11 -3
- package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +37 -16
- package/dist/boilerplates/@batijs/h3/files/vike.d.ts +22 -0
- package/dist/boilerplates/@batijs/h3/types/h3-entry.d.ts +1 -6
- package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/prettier/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/react/files/$package.json.js +2 -2
- package/dist/boilerplates/@batijs/react/files/layouts/LayoutDefault.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/+config.ts +3 -3
- package/dist/boilerplates/@batijs/react/files/pages/_error/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/index/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+data.ts +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+title.ts +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/index/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/index/+data.ts +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/star-wars/index/+title.ts +1 -1
- package/dist/boilerplates/@batijs/react/types/pages/+config.d.ts +3 -3
- package/dist/boilerplates/@batijs/react/types/pages/star-wars/@id/+data.d.ts +1 -1
- package/dist/boilerplates/@batijs/react/types/pages/star-wars/@id/+title.d.ts +1 -1
- package/dist/boilerplates/@batijs/react/types/pages/star-wars/index/+data.d.ts +1 -1
- package/dist/boilerplates/@batijs/react/types/pages/star-wars/index/+title.d.ts +1 -1
- package/dist/boilerplates/@batijs/react-firebase-auth/files/pages/login/+Page.tsx +44 -44
- package/dist/boilerplates/@batijs/react-telefunc/files/pages/todo/+Page.tsx +2 -2
- package/dist/boilerplates/@batijs/react-telefunc/types/pages/todo/TodoList.d.ts +1 -1
- package/dist/boilerplates/@batijs/react-trpc/files/pages/todo-trpc/+Page.tsx +2 -2
- package/dist/boilerplates/@batijs/shared/files/tsconfig.json +2 -2
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +3 -3
- package/dist/boilerplates/@batijs/solid/files/components/Link.tsx +1 -1
- package/dist/boilerplates/@batijs/solid/files/layouts/LayoutDefault.tsx +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +3 -3
- package/dist/boilerplates/@batijs/solid/files/pages/index/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+data.ts +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+title.ts +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+data.ts +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+title.ts +1 -1
- package/dist/boilerplates/@batijs/solid/types/pages/+config.d.ts +2 -2
- package/dist/boilerplates/@batijs/solid/types/pages/star-wars/@id/+data.d.ts +1 -1
- package/dist/boilerplates/@batijs/solid/types/pages/star-wars/@id/+title.d.ts +1 -1
- package/dist/boilerplates/@batijs/solid/types/pages/star-wars/index/+data.d.ts +1 -1
- package/dist/boilerplates/@batijs/solid/types/pages/star-wars/index/+title.d.ts +1 -1
- package/dist/boilerplates/@batijs/solid-firebase-auth/files/pages/login/+Page.tsx +43 -43
- package/dist/boilerplates/@batijs/solid-telefunc/files/pages/todo/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/solid-trpc/files/pages/todo-trpc/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +7 -2
- package/dist/boilerplates/@batijs/tailwindcss/files/postcss.config.js +1 -1
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/trpc/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/trpc/files/trpc/client.ts +1 -1
- package/dist/boilerplates/@batijs/trpc/files/trpc/vite-plugin.ts +1 -1
- package/dist/boilerplates/@batijs/vercel/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/vue/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/index/+Page.vue +5 -11
- package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+Page.vue +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+data.ts +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+title.ts +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/star-wars/index/+Page.vue +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/star-wars/index/+data.ts +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/star-wars/index/+title.ts +1 -1
- package/dist/boilerplates/@batijs/vue/types/pages/star-wars/@id/+data.d.ts +1 -1
- package/dist/boilerplates/@batijs/vue/types/pages/star-wars/@id/+title.d.ts +1 -1
- package/dist/boilerplates/@batijs/vue/types/pages/star-wars/index/+data.d.ts +1 -1
- package/dist/boilerplates/@batijs/vue/types/pages/star-wars/index/+title.d.ts +1 -1
- package/dist/boilerplates/@batijs/vue-telefunc/files/pages/todo/+Page.vue +1 -1
- package/dist/boilerplates/@batijs/vue-trpc/files/pages/todo-trpc/+Page.vue +1 -1
- package/dist/boilerplates/boilerplates.json +11 -0
- package/dist/index.js +257 -217
- package/package.json +5 -5
- package/dist/boilerplates/@batijs/firebase-auth/files/firebase/service-account-example.json +0 -13
- package/dist/boilerplates/@batijs/firebase-auth/types/types.d.ts +0 -18
package/dist/index.js
CHANGED
|
@@ -4,6 +4,188 @@ import {
|
|
|
4
4
|
consola
|
|
5
5
|
} from "./chunk-P3F3WO2D.js";
|
|
6
6
|
|
|
7
|
+
// index.ts
|
|
8
|
+
import { existsSync as existsSync2 } from "fs";
|
|
9
|
+
import { access, constants, lstat, readdir, readFile as readFile3 } from "fs/promises";
|
|
10
|
+
import { dirname, join, parse } from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
|
|
13
|
+
// ../build/dist/index.js
|
|
14
|
+
import { existsSync } from "fs";
|
|
15
|
+
import { mkdir, opendir, readFile as readFile2, writeFile } from "fs/promises";
|
|
16
|
+
import path from "path";
|
|
17
|
+
import { transformAndFormat as transformAndFormat2 } from "@batijs/core";
|
|
18
|
+
import { readFile } from "fs/promises";
|
|
19
|
+
import { parseModule, transformAndFormat } from "@batijs/core";
|
|
20
|
+
async function mergeDts({
|
|
21
|
+
target,
|
|
22
|
+
fileContent,
|
|
23
|
+
filepath,
|
|
24
|
+
meta
|
|
25
|
+
}) {
|
|
26
|
+
const previousCode = await readFile(target, { encoding: "utf-8" });
|
|
27
|
+
const previousAst = parseModule(previousCode);
|
|
28
|
+
const currentAst = parseModule(fileContent);
|
|
29
|
+
for (const imp of previousAst.imports.$items) {
|
|
30
|
+
currentAst.imports[imp.local] = imp;
|
|
31
|
+
}
|
|
32
|
+
const index = currentAst.$ast.body.findIndex(
|
|
33
|
+
(node) => node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration"
|
|
34
|
+
);
|
|
35
|
+
for (const node of previousAst.$ast.body) {
|
|
36
|
+
if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (index === -1) {
|
|
40
|
+
currentAst.$ast.body.push(node);
|
|
41
|
+
} else {
|
|
42
|
+
currentAst.$ast.body.splice(index, 0, node);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return transformAndFormat(currentAst.generate().code, meta, {
|
|
46
|
+
filepath
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function queue() {
|
|
50
|
+
const tasks = [];
|
|
51
|
+
return {
|
|
52
|
+
add(task) {
|
|
53
|
+
tasks.push(task);
|
|
54
|
+
},
|
|
55
|
+
async run() {
|
|
56
|
+
let task;
|
|
57
|
+
while (task = tasks.shift()) {
|
|
58
|
+
await task();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
var reIgnoreFile = /^(chunk-|asset-|#)/gi;
|
|
64
|
+
var isWin = process.platform === "win32";
|
|
65
|
+
function toDist(filepath, source, dist) {
|
|
66
|
+
const split = filepath.split(path.sep);
|
|
67
|
+
split[split.length - 1] = split[split.length - 1].replace(/^\$\$?(.*)\.[tj]sx?$/, "$1");
|
|
68
|
+
return split.join(path.sep).replace(source, dist);
|
|
69
|
+
}
|
|
70
|
+
async function safeWriteFile(destination, content) {
|
|
71
|
+
const destinationDir = path.dirname(destination);
|
|
72
|
+
await mkdir(destinationDir, {
|
|
73
|
+
recursive: true
|
|
74
|
+
});
|
|
75
|
+
await writeFile(destination, content, { encoding: "utf-8" });
|
|
76
|
+
}
|
|
77
|
+
async function* walk(dir) {
|
|
78
|
+
if (!existsSync(dir))
|
|
79
|
+
return;
|
|
80
|
+
for await (const d of await opendir(dir)) {
|
|
81
|
+
const entry = path.join(dir, d.name);
|
|
82
|
+
if (d.isDirectory()) {
|
|
83
|
+
yield* walk(entry);
|
|
84
|
+
} else if (d.isFile())
|
|
85
|
+
yield entry;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function transformFileAfterExec(filepath, fileContent) {
|
|
89
|
+
if (fileContent === void 0 || fileContent === null)
|
|
90
|
+
return null;
|
|
91
|
+
const parsed = path.parse(filepath);
|
|
92
|
+
const toTest = [parsed.base, parsed.ext, parsed.name].filter(Boolean);
|
|
93
|
+
for (const ext of toTest) {
|
|
94
|
+
switch (ext) {
|
|
95
|
+
case ".ts":
|
|
96
|
+
case ".js":
|
|
97
|
+
case ".tsx":
|
|
98
|
+
case ".jsx":
|
|
99
|
+
case ".env":
|
|
100
|
+
case ".env.local":
|
|
101
|
+
case ".env.development":
|
|
102
|
+
case ".env.development.local":
|
|
103
|
+
case ".env.test":
|
|
104
|
+
case ".env.test.local":
|
|
105
|
+
case ".env.production":
|
|
106
|
+
case ".env.production.local":
|
|
107
|
+
case ".html":
|
|
108
|
+
case ".md":
|
|
109
|
+
return fileContent;
|
|
110
|
+
case ".json":
|
|
111
|
+
return JSON.stringify(fileContent, null, 2);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
throw new Error(`Unsupported file extension ${parsed.base} (${filepath})`);
|
|
115
|
+
}
|
|
116
|
+
async function importTransformer(p) {
|
|
117
|
+
const importFile = isWin ? "file://" + p : p;
|
|
118
|
+
const f = await import(importFile);
|
|
119
|
+
return f.default;
|
|
120
|
+
}
|
|
121
|
+
async function main(options, meta) {
|
|
122
|
+
const sources = Array.isArray(options.source) ? options.source : [options.source];
|
|
123
|
+
const targets = /* @__PURE__ */ new Set();
|
|
124
|
+
const priorityQ = queue();
|
|
125
|
+
const transformAndWriteQ = queue();
|
|
126
|
+
for (const source of sources) {
|
|
127
|
+
for await (const p of walk(source)) {
|
|
128
|
+
const target = toDist(p, source, options.dist);
|
|
129
|
+
const parsed = path.parse(p);
|
|
130
|
+
if (parsed.name.match(reIgnoreFile)) {
|
|
131
|
+
continue;
|
|
132
|
+
} else if (parsed.name.startsWith("$") && parsed.ext.match(/\.tsx?$/)) {
|
|
133
|
+
throw new Error(
|
|
134
|
+
`Typescript file needs to be compiled before it can be executed: '${p}'.
|
|
135
|
+
Please report this issue to https://github.com/batijs/bati`
|
|
136
|
+
);
|
|
137
|
+
} else if (parsed.name.startsWith("$") && parsed.ext.match(/\.jsx?$/)) {
|
|
138
|
+
transformAndWriteQ.add(async () => {
|
|
139
|
+
const transformer = await importTransformer(p);
|
|
140
|
+
const rf = () => {
|
|
141
|
+
return readFile2(target, { encoding: "utf-8" });
|
|
142
|
+
};
|
|
143
|
+
const fileContent = transformFileAfterExec(
|
|
144
|
+
target,
|
|
145
|
+
await transformer({
|
|
146
|
+
readfile: targets.has(target) ? rf : void 0,
|
|
147
|
+
meta,
|
|
148
|
+
source,
|
|
149
|
+
target
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
if (fileContent !== null) {
|
|
153
|
+
await safeWriteFile(target, fileContent);
|
|
154
|
+
targets.add(target);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
} else {
|
|
158
|
+
priorityQ.add(async () => {
|
|
159
|
+
const code = await readFile2(p, { encoding: "utf-8" });
|
|
160
|
+
const filepath = path.relative(source, p);
|
|
161
|
+
let fileContent = await transformAndFormat2(code, meta, {
|
|
162
|
+
filepath
|
|
163
|
+
});
|
|
164
|
+
if (p.endsWith(".d.ts") && targets.has(target)) {
|
|
165
|
+
fileContent = await mergeDts({
|
|
166
|
+
fileContent,
|
|
167
|
+
target,
|
|
168
|
+
meta,
|
|
169
|
+
filepath
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (fileContent) {
|
|
173
|
+
await safeWriteFile(target, fileContent.trimStart());
|
|
174
|
+
targets.add(target);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
await priorityQ.run();
|
|
181
|
+
await transformAndWriteQ.run();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// index.ts
|
|
185
|
+
import { withIcon } from "@batijs/core";
|
|
186
|
+
import { flags as coreFlags, features } from "@batijs/features";
|
|
187
|
+
import { execRules } from "@batijs/features/rules";
|
|
188
|
+
|
|
7
189
|
// ../../node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
|
|
8
190
|
function toArray(val) {
|
|
9
191
|
if (Array.isArray(val)) {
|
|
@@ -455,190 +637,6 @@ async function runMain(cmd, opts = {}) {
|
|
|
455
637
|
}
|
|
456
638
|
}
|
|
457
639
|
|
|
458
|
-
// ../build/dist/index.js
|
|
459
|
-
import { existsSync } from "fs";
|
|
460
|
-
import { mkdir, opendir, readFile, writeFile } from "fs/promises";
|
|
461
|
-
import path from "path";
|
|
462
|
-
import { transformAndFormat } from "@batijs/core";
|
|
463
|
-
function queue() {
|
|
464
|
-
const tasks = [];
|
|
465
|
-
return {
|
|
466
|
-
add(task) {
|
|
467
|
-
tasks.push(task);
|
|
468
|
-
},
|
|
469
|
-
async run() {
|
|
470
|
-
let task;
|
|
471
|
-
while (task = tasks.shift()) {
|
|
472
|
-
await task();
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
var reIgnoreFile = /^(chunk-|asset-|#)/gi;
|
|
478
|
-
var isWin = process.platform === "win32";
|
|
479
|
-
function toDist(filepath, source, dist) {
|
|
480
|
-
const split = filepath.split(path.sep);
|
|
481
|
-
split[split.length - 1] = split[split.length - 1].replace(/^\$\$?(.*)\.[tj]sx?$/, "$1");
|
|
482
|
-
return split.join(path.sep).replace(source, dist);
|
|
483
|
-
}
|
|
484
|
-
async function safeWriteFile(destination, content) {
|
|
485
|
-
const destinationDir = path.dirname(destination);
|
|
486
|
-
await mkdir(destinationDir, {
|
|
487
|
-
recursive: true
|
|
488
|
-
});
|
|
489
|
-
await writeFile(destination, content, { encoding: "utf-8" });
|
|
490
|
-
}
|
|
491
|
-
async function* walk(dir) {
|
|
492
|
-
if (!existsSync(dir))
|
|
493
|
-
return;
|
|
494
|
-
for await (const d of await opendir(dir)) {
|
|
495
|
-
const entry = path.join(dir, d.name);
|
|
496
|
-
if (d.isDirectory()) {
|
|
497
|
-
yield* walk(entry);
|
|
498
|
-
} else if (d.isFile())
|
|
499
|
-
yield entry;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
function transformFileAfterExec(filepath, fileContent) {
|
|
503
|
-
if (fileContent === void 0 || fileContent === null)
|
|
504
|
-
return null;
|
|
505
|
-
const parsed = path.parse(filepath);
|
|
506
|
-
const toTest = [parsed.base, parsed.ext, parsed.name].filter(Boolean);
|
|
507
|
-
for (const ext of toTest) {
|
|
508
|
-
switch (ext) {
|
|
509
|
-
case ".ts":
|
|
510
|
-
case ".js":
|
|
511
|
-
case ".tsx":
|
|
512
|
-
case ".jsx":
|
|
513
|
-
case ".env":
|
|
514
|
-
case ".env.local":
|
|
515
|
-
case ".env.development":
|
|
516
|
-
case ".env.development.local":
|
|
517
|
-
case ".env.test":
|
|
518
|
-
case ".env.test.local":
|
|
519
|
-
case ".env.production":
|
|
520
|
-
case ".env.production.local":
|
|
521
|
-
case ".html":
|
|
522
|
-
case ".md":
|
|
523
|
-
return fileContent;
|
|
524
|
-
case ".json":
|
|
525
|
-
return JSON.stringify(fileContent, null, 2);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
throw new Error(`Unsupported file extension ${parsed.base} (${filepath})`);
|
|
529
|
-
}
|
|
530
|
-
async function importTransformer(p) {
|
|
531
|
-
const importFile = isWin ? "file://" + p : p;
|
|
532
|
-
const f = await import(importFile);
|
|
533
|
-
return f.default;
|
|
534
|
-
}
|
|
535
|
-
async function main(options, meta) {
|
|
536
|
-
const sources = Array.isArray(options.source) ? options.source : [options.source];
|
|
537
|
-
const targets = /* @__PURE__ */ new Set();
|
|
538
|
-
const simpleCopyQ = queue();
|
|
539
|
-
const transformAndWriteQ = queue();
|
|
540
|
-
for (const source of sources) {
|
|
541
|
-
for await (const p of walk(source)) {
|
|
542
|
-
const target = toDist(p, source, options.dist);
|
|
543
|
-
const parsed = path.parse(p);
|
|
544
|
-
if (parsed.name.match(reIgnoreFile)) {
|
|
545
|
-
continue;
|
|
546
|
-
} else if (parsed.name.startsWith("$") && parsed.ext.match(/\.tsx?$/)) {
|
|
547
|
-
throw new Error(
|
|
548
|
-
`Typescript file needs to be compiled before it can be executed: '${p}'.
|
|
549
|
-
Please report this issue to https://github.com/magne4000/bati`
|
|
550
|
-
);
|
|
551
|
-
} else if (parsed.name.startsWith("$") && parsed.ext.match(/\.jsx?$/)) {
|
|
552
|
-
transformAndWriteQ.add(async () => {
|
|
553
|
-
const transformer = await importTransformer(p);
|
|
554
|
-
const rf = () => {
|
|
555
|
-
return readFile(target, { encoding: "utf-8" });
|
|
556
|
-
};
|
|
557
|
-
const fileContent = transformFileAfterExec(
|
|
558
|
-
target,
|
|
559
|
-
await transformer({
|
|
560
|
-
readfile: targets.has(target) ? rf : void 0,
|
|
561
|
-
meta,
|
|
562
|
-
source,
|
|
563
|
-
target
|
|
564
|
-
})
|
|
565
|
-
);
|
|
566
|
-
if (fileContent !== null) {
|
|
567
|
-
await safeWriteFile(target, fileContent);
|
|
568
|
-
targets.add(target);
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
} else {
|
|
572
|
-
transformAndWriteQ.add(async () => {
|
|
573
|
-
const code = await readFile(p, { encoding: "utf-8" });
|
|
574
|
-
const fileContent = await transformAndFormat(code, meta, {
|
|
575
|
-
filepath: path.relative(source, p)
|
|
576
|
-
});
|
|
577
|
-
if (fileContent) {
|
|
578
|
-
await safeWriteFile(target, fileContent);
|
|
579
|
-
targets.add(target);
|
|
580
|
-
}
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
await simpleCopyQ.run();
|
|
586
|
-
await transformAndWriteQ.run();
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
// package.json
|
|
590
|
-
var package_default = {
|
|
591
|
-
name: "@batijs/cli",
|
|
592
|
-
version: "0.0.176",
|
|
593
|
-
type: "module",
|
|
594
|
-
scripts: {
|
|
595
|
-
"check-types": "tsc --noEmit",
|
|
596
|
-
prerelease: "rimraf ./dist",
|
|
597
|
-
prepublishOnly: "pnpm run build-cli",
|
|
598
|
-
"build-cli": "rimraf ./dist && tsup"
|
|
599
|
-
},
|
|
600
|
-
keywords: [],
|
|
601
|
-
description: "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
602
|
-
author: "Jo\xEBl Charles",
|
|
603
|
-
repository: "https://github.com/batijs/bati",
|
|
604
|
-
license: "MIT",
|
|
605
|
-
devDependencies: {
|
|
606
|
-
"@batijs/build": "workspace:*",
|
|
607
|
-
"@batijs/compile": "workspace:*",
|
|
608
|
-
"@types/node": "^18.19.14",
|
|
609
|
-
"@types/which": "^3.0.3",
|
|
610
|
-
citty: "^0.1.6",
|
|
611
|
-
colorette: "^2.0.20",
|
|
612
|
-
esbuild: "^0.20.2",
|
|
613
|
-
execa: "^8.0.1",
|
|
614
|
-
rimraf: "^5.0.5",
|
|
615
|
-
sift: "^17.1.2",
|
|
616
|
-
tsup: "^8.0.2",
|
|
617
|
-
typescript: "^5.4.5",
|
|
618
|
-
vite: "^5.2.8"
|
|
619
|
-
},
|
|
620
|
-
dependencies: {
|
|
621
|
-
"@batijs/core": "workspace:*",
|
|
622
|
-
"@batijs/features": "workspace:*"
|
|
623
|
-
},
|
|
624
|
-
bin: "./dist/index.js",
|
|
625
|
-
exports: {
|
|
626
|
-
".": "./dist/index.js"
|
|
627
|
-
},
|
|
628
|
-
files: [
|
|
629
|
-
"dist/"
|
|
630
|
-
]
|
|
631
|
-
};
|
|
632
|
-
|
|
633
|
-
// index.ts
|
|
634
|
-
import { withIcon } from "@batijs/core";
|
|
635
|
-
import { features, flags as coreFlags } from "@batijs/features";
|
|
636
|
-
import { execRules } from "@batijs/features/rules";
|
|
637
|
-
import { existsSync as existsSync2 } from "fs";
|
|
638
|
-
import { fileURLToPath } from "url";
|
|
639
|
-
import { dirname, join, parse } from "path";
|
|
640
|
-
import { access, constants, lstat, readdir, readFile as readFile2 } from "fs/promises";
|
|
641
|
-
|
|
642
640
|
// ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
643
641
|
import * as tty from "tty";
|
|
644
642
|
var {
|
|
@@ -754,32 +752,6 @@ var {
|
|
|
754
752
|
bgWhiteBright
|
|
755
753
|
} = createColors();
|
|
756
754
|
|
|
757
|
-
// rules.ts
|
|
758
|
-
import { RulesMessage } from "@batijs/features/rules";
|
|
759
|
-
function error(value) {
|
|
760
|
-
return {
|
|
761
|
-
type: "error",
|
|
762
|
-
value
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
function info(value) {
|
|
766
|
-
return {
|
|
767
|
-
type: "info",
|
|
768
|
-
value
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
var rulesMessages = {
|
|
772
|
-
[RulesMessage.ERROR_AUTH_R_SERVER]: error(
|
|
773
|
-
`A ${inverse(bold("Server"))} is required when using ${inverse(
|
|
774
|
-
bold("Auth")
|
|
775
|
-
)}. Check https://vite-plugin-ssr.com/integration#server-side-tools for details and https://batijs.dev for available servers`
|
|
776
|
-
),
|
|
777
|
-
[RulesMessage.ERROR_COMPILED_R_REACT]: error(
|
|
778
|
-
`${inverse(bold("React"))} is required when using ${inverse(bold("Compiled"))}.`
|
|
779
|
-
),
|
|
780
|
-
[RulesMessage.INFO_HATTIP]: info(`${inverse(bold("HatTip"))} is an experimental project`)
|
|
781
|
-
};
|
|
782
|
-
|
|
783
755
|
// ../../node_modules/.pnpm/sift@17.1.2/node_modules/sift/es5m/index.js
|
|
784
756
|
var extendStatics = function(d, b) {
|
|
785
757
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
@@ -1562,6 +1534,76 @@ var createDefaultQueryTester = function(query, options) {
|
|
|
1562
1534
|
return createOperationTester(op);
|
|
1563
1535
|
};
|
|
1564
1536
|
|
|
1537
|
+
// package.json
|
|
1538
|
+
var package_default = {
|
|
1539
|
+
name: "@batijs/cli",
|
|
1540
|
+
version: "0.0.178",
|
|
1541
|
+
type: "module",
|
|
1542
|
+
scripts: {
|
|
1543
|
+
"check-types": "tsc --noEmit",
|
|
1544
|
+
prerelease: "rimraf ./dist",
|
|
1545
|
+
prepublishOnly: "pnpm run build-cli",
|
|
1546
|
+
"build-cli": "rimraf ./dist && tsup"
|
|
1547
|
+
},
|
|
1548
|
+
keywords: [],
|
|
1549
|
+
description: "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
1550
|
+
author: "Jo\xEBl Charles",
|
|
1551
|
+
repository: "https://github.com/batijs/bati",
|
|
1552
|
+
license: "MIT",
|
|
1553
|
+
devDependencies: {
|
|
1554
|
+
"@batijs/build": "workspace:*",
|
|
1555
|
+
"@batijs/compile": "workspace:*",
|
|
1556
|
+
"@types/node": "^18.19.14",
|
|
1557
|
+
"@types/which": "^3.0.3",
|
|
1558
|
+
citty: "^0.1.6",
|
|
1559
|
+
colorette: "^2.0.20",
|
|
1560
|
+
esbuild: "^0.20.2",
|
|
1561
|
+
execa: "^8.0.1",
|
|
1562
|
+
rimraf: "^5.0.5",
|
|
1563
|
+
sift: "^17.1.2",
|
|
1564
|
+
tsup: "^8.0.2",
|
|
1565
|
+
typescript: "^5.4.5",
|
|
1566
|
+
vite: "^5.2.8"
|
|
1567
|
+
},
|
|
1568
|
+
dependencies: {
|
|
1569
|
+
"@batijs/core": "workspace:*",
|
|
1570
|
+
"@batijs/features": "workspace:*"
|
|
1571
|
+
},
|
|
1572
|
+
bin: "./dist/index.js",
|
|
1573
|
+
exports: {
|
|
1574
|
+
".": "./dist/index.js"
|
|
1575
|
+
},
|
|
1576
|
+
files: [
|
|
1577
|
+
"dist/"
|
|
1578
|
+
]
|
|
1579
|
+
};
|
|
1580
|
+
|
|
1581
|
+
// rules.ts
|
|
1582
|
+
import { RulesMessage } from "@batijs/features/rules";
|
|
1583
|
+
function error(value) {
|
|
1584
|
+
return {
|
|
1585
|
+
type: "error",
|
|
1586
|
+
value
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
function info(value) {
|
|
1590
|
+
return {
|
|
1591
|
+
type: "info",
|
|
1592
|
+
value
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
var rulesMessages = {
|
|
1596
|
+
[RulesMessage.ERROR_AUTH_R_SERVER]: error(
|
|
1597
|
+
`A ${inverse(bold("Server"))} is required when using ${inverse(
|
|
1598
|
+
bold("Auth")
|
|
1599
|
+
)}. Check https://vite-plugin-ssr.com/integration#server-side-tools for details and https://batijs.dev for available servers`
|
|
1600
|
+
),
|
|
1601
|
+
[RulesMessage.ERROR_COMPILED_R_REACT]: error(
|
|
1602
|
+
`${inverse(bold("React"))} is required when using ${inverse(bold("Compiled"))}.`
|
|
1603
|
+
),
|
|
1604
|
+
[RulesMessage.INFO_HATTIP]: info(`${inverse(bold("HatTip"))} is an experimental project`)
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1565
1607
|
// index.ts
|
|
1566
1608
|
var __filename = fileURLToPath(import.meta.url);
|
|
1567
1609
|
var __dirname = dirname(__filename);
|
|
@@ -1575,7 +1617,7 @@ function boilerplatesDir() {
|
|
|
1575
1617
|
throw new Error("Missing boilerplates.json file. Run `pnpm run build`");
|
|
1576
1618
|
}
|
|
1577
1619
|
async function parseBoilerplates(dir) {
|
|
1578
|
-
return JSON.parse(await
|
|
1620
|
+
return JSON.parse(await readFile3(join(dir, "boilerplates.json"), "utf-8"));
|
|
1579
1621
|
}
|
|
1580
1622
|
function toArg(flag, description) {
|
|
1581
1623
|
if (!flag)
|
|
@@ -1617,7 +1659,9 @@ function printOK(dist, flags) {
|
|
|
1617
1659
|
console.log(cmd3(`cd ${dist}`));
|
|
1618
1660
|
console.log(cmd3("pnpm install"));
|
|
1619
1661
|
console.log(cmd3("pnpm run dev"));
|
|
1620
|
-
console.log(
|
|
1662
|
+
console.log(
|
|
1663
|
+
"\n" + bold(book0("Be sure to check the ") + cyan("README.md") + " file for remaining steps and documentation.")
|
|
1664
|
+
);
|
|
1621
1665
|
}
|
|
1622
1666
|
var defaultDef = {
|
|
1623
1667
|
project: {
|
|
@@ -1735,11 +1779,7 @@ async function run() {
|
|
|
1735
1779
|
version: package_default.version,
|
|
1736
1780
|
description: package_default.description
|
|
1737
1781
|
},
|
|
1738
|
-
args: Object.assign(
|
|
1739
|
-
{},
|
|
1740
|
-
defaultDef,
|
|
1741
|
-
...coreFlags.map((k) => toArg(k, findDescription(k)))
|
|
1742
|
-
),
|
|
1782
|
+
args: Object.assign({}, defaultDef, ...coreFlags.map((k) => toArg(k, findDescription(k)))),
|
|
1743
1783
|
async run({ args }) {
|
|
1744
1784
|
await checkArguments(args);
|
|
1745
1785
|
const sources = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.178",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"tsup": "^8.0.2",
|
|
20
20
|
"typescript": "^5.4.5",
|
|
21
21
|
"vite": "^5.2.8",
|
|
22
|
-
"@batijs/build": "0.0.
|
|
23
|
-
"@batijs/compile": "0.0.
|
|
22
|
+
"@batijs/build": "0.0.178",
|
|
23
|
+
"@batijs/compile": "0.0.178"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@batijs/core": "0.0.
|
|
27
|
-
"@batijs/features": "0.0.
|
|
26
|
+
"@batijs/core": "0.0.178",
|
|
27
|
+
"@batijs/features": "0.0.178"
|
|
28
28
|
},
|
|
29
29
|
"bin": "./dist/index.js",
|
|
30
30
|
"exports": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "",
|
|
3
|
-
"project_id": "",
|
|
4
|
-
"private_key_id": "",
|
|
5
|
-
"private_key": "",
|
|
6
|
-
"client_email": "",
|
|
7
|
-
"client_id": "",
|
|
8
|
-
"auth_uri": "",
|
|
9
|
-
"token_uri": "",
|
|
10
|
-
"auth_provider_x509_cert_url": "",
|
|
11
|
-
"client_x509_cert_url": "",
|
|
12
|
-
"universe_domain": ""
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { UserRecord } from "firebase-admin/auth";
|
|
2
|
-
import type { FirebaseApp } from "firebase/app";
|
|
3
|
-
declare global {
|
|
4
|
-
namespace Express {
|
|
5
|
-
interface Request {
|
|
6
|
-
user?: UserRecord | null;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
namespace Vike {
|
|
10
|
-
interface PageContext {
|
|
11
|
-
user?: UserRecord | null;
|
|
12
|
-
}
|
|
13
|
-
interface Config {
|
|
14
|
-
firebaseApp?: FirebaseApp;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {};
|