@batijs/cli 0.0.177 → 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/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 +1 -1
- package/dist/boilerplates/@batijs/firebase-auth/files/$package.json.js +1 -1
- 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/login/+guard.ts +5 -5
- package/dist/boilerplates/@batijs/firebase-auth/types/pages/login/+guard.d.ts +1 -1
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +1 -1
- 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 +2 -2
- 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 +2 -2
- 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/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/index.js +256 -256
- package/package.json +5 -5
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,230 +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 as readFile2, writeFile } from "fs/promises";
|
|
461
|
-
import path from "path";
|
|
462
|
-
import { transformAndFormat as transformAndFormat2 } from "@batijs/core";
|
|
463
|
-
import { readFile } from "fs/promises";
|
|
464
|
-
import { parseModule, transformAndFormat } from "@batijs/core";
|
|
465
|
-
async function mergeDts({
|
|
466
|
-
target,
|
|
467
|
-
fileContent,
|
|
468
|
-
filepath,
|
|
469
|
-
meta
|
|
470
|
-
}) {
|
|
471
|
-
const previousCode = await readFile(target, { encoding: "utf-8" });
|
|
472
|
-
const previousAst = parseModule(previousCode);
|
|
473
|
-
const currentAst = parseModule(fileContent);
|
|
474
|
-
for (const imp of previousAst.imports.$items) {
|
|
475
|
-
currentAst.imports[imp.local] = imp;
|
|
476
|
-
}
|
|
477
|
-
const index = currentAst.$ast.body.findIndex(
|
|
478
|
-
(node) => node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration"
|
|
479
|
-
);
|
|
480
|
-
for (const node of previousAst.$ast.body) {
|
|
481
|
-
if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
|
|
482
|
-
continue;
|
|
483
|
-
}
|
|
484
|
-
if (index === -1) {
|
|
485
|
-
currentAst.$ast.body.push(node);
|
|
486
|
-
} else {
|
|
487
|
-
currentAst.$ast.body.splice(index, 0, node);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
return transformAndFormat(currentAst.generate().code, meta, {
|
|
491
|
-
filepath
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
function queue() {
|
|
495
|
-
const tasks = [];
|
|
496
|
-
return {
|
|
497
|
-
add(task) {
|
|
498
|
-
tasks.push(task);
|
|
499
|
-
},
|
|
500
|
-
async run() {
|
|
501
|
-
let task;
|
|
502
|
-
while (task = tasks.shift()) {
|
|
503
|
-
await task();
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
var reIgnoreFile = /^(chunk-|asset-|#)/gi;
|
|
509
|
-
var isWin = process.platform === "win32";
|
|
510
|
-
function toDist(filepath, source, dist) {
|
|
511
|
-
const split = filepath.split(path.sep);
|
|
512
|
-
split[split.length - 1] = split[split.length - 1].replace(/^\$\$?(.*)\.[tj]sx?$/, "$1");
|
|
513
|
-
return split.join(path.sep).replace(source, dist);
|
|
514
|
-
}
|
|
515
|
-
async function safeWriteFile(destination, content) {
|
|
516
|
-
const destinationDir = path.dirname(destination);
|
|
517
|
-
await mkdir(destinationDir, {
|
|
518
|
-
recursive: true
|
|
519
|
-
});
|
|
520
|
-
await writeFile(destination, content, { encoding: "utf-8" });
|
|
521
|
-
}
|
|
522
|
-
async function* walk(dir) {
|
|
523
|
-
if (!existsSync(dir))
|
|
524
|
-
return;
|
|
525
|
-
for await (const d of await opendir(dir)) {
|
|
526
|
-
const entry = path.join(dir, d.name);
|
|
527
|
-
if (d.isDirectory()) {
|
|
528
|
-
yield* walk(entry);
|
|
529
|
-
} else if (d.isFile())
|
|
530
|
-
yield entry;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
function transformFileAfterExec(filepath, fileContent) {
|
|
534
|
-
if (fileContent === void 0 || fileContent === null)
|
|
535
|
-
return null;
|
|
536
|
-
const parsed = path.parse(filepath);
|
|
537
|
-
const toTest = [parsed.base, parsed.ext, parsed.name].filter(Boolean);
|
|
538
|
-
for (const ext of toTest) {
|
|
539
|
-
switch (ext) {
|
|
540
|
-
case ".ts":
|
|
541
|
-
case ".js":
|
|
542
|
-
case ".tsx":
|
|
543
|
-
case ".jsx":
|
|
544
|
-
case ".env":
|
|
545
|
-
case ".env.local":
|
|
546
|
-
case ".env.development":
|
|
547
|
-
case ".env.development.local":
|
|
548
|
-
case ".env.test":
|
|
549
|
-
case ".env.test.local":
|
|
550
|
-
case ".env.production":
|
|
551
|
-
case ".env.production.local":
|
|
552
|
-
case ".html":
|
|
553
|
-
case ".md":
|
|
554
|
-
return fileContent;
|
|
555
|
-
case ".json":
|
|
556
|
-
return JSON.stringify(fileContent, null, 2);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
throw new Error(`Unsupported file extension ${parsed.base} (${filepath})`);
|
|
560
|
-
}
|
|
561
|
-
async function importTransformer(p) {
|
|
562
|
-
const importFile = isWin ? "file://" + p : p;
|
|
563
|
-
const f = await import(importFile);
|
|
564
|
-
return f.default;
|
|
565
|
-
}
|
|
566
|
-
async function main(options, meta) {
|
|
567
|
-
const sources = Array.isArray(options.source) ? options.source : [options.source];
|
|
568
|
-
const targets = /* @__PURE__ */ new Set();
|
|
569
|
-
const priorityQ = queue();
|
|
570
|
-
const transformAndWriteQ = queue();
|
|
571
|
-
for (const source of sources) {
|
|
572
|
-
for await (const p of walk(source)) {
|
|
573
|
-
const target = toDist(p, source, options.dist);
|
|
574
|
-
const parsed = path.parse(p);
|
|
575
|
-
if (parsed.name.match(reIgnoreFile)) {
|
|
576
|
-
continue;
|
|
577
|
-
} else if (parsed.name.startsWith("$") && parsed.ext.match(/\.tsx?$/)) {
|
|
578
|
-
throw new Error(
|
|
579
|
-
`Typescript file needs to be compiled before it can be executed: '${p}'.
|
|
580
|
-
Please report this issue to https://github.com/batijs/bati`
|
|
581
|
-
);
|
|
582
|
-
} else if (parsed.name.startsWith("$") && parsed.ext.match(/\.jsx?$/)) {
|
|
583
|
-
transformAndWriteQ.add(async () => {
|
|
584
|
-
const transformer = await importTransformer(p);
|
|
585
|
-
const rf = () => {
|
|
586
|
-
return readFile2(target, { encoding: "utf-8" });
|
|
587
|
-
};
|
|
588
|
-
const fileContent = transformFileAfterExec(
|
|
589
|
-
target,
|
|
590
|
-
await transformer({
|
|
591
|
-
readfile: targets.has(target) ? rf : void 0,
|
|
592
|
-
meta,
|
|
593
|
-
source,
|
|
594
|
-
target
|
|
595
|
-
})
|
|
596
|
-
);
|
|
597
|
-
if (fileContent !== null) {
|
|
598
|
-
await safeWriteFile(target, fileContent);
|
|
599
|
-
targets.add(target);
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
} else {
|
|
603
|
-
priorityQ.add(async () => {
|
|
604
|
-
const code = await readFile2(p, { encoding: "utf-8" });
|
|
605
|
-
const filepath = path.relative(source, p);
|
|
606
|
-
let fileContent = await transformAndFormat2(code, meta, {
|
|
607
|
-
filepath
|
|
608
|
-
});
|
|
609
|
-
if (p.endsWith(".d.ts") && targets.has(target)) {
|
|
610
|
-
fileContent = await mergeDts({
|
|
611
|
-
fileContent,
|
|
612
|
-
target,
|
|
613
|
-
meta,
|
|
614
|
-
filepath
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
if (fileContent) {
|
|
618
|
-
await safeWriteFile(target, fileContent.trimStart());
|
|
619
|
-
targets.add(target);
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
await priorityQ.run();
|
|
626
|
-
await transformAndWriteQ.run();
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
// package.json
|
|
630
|
-
var package_default = {
|
|
631
|
-
name: "@batijs/cli",
|
|
632
|
-
version: "0.0.177",
|
|
633
|
-
type: "module",
|
|
634
|
-
scripts: {
|
|
635
|
-
"check-types": "tsc --noEmit",
|
|
636
|
-
prerelease: "rimraf ./dist",
|
|
637
|
-
prepublishOnly: "pnpm run build-cli",
|
|
638
|
-
"build-cli": "rimraf ./dist && tsup"
|
|
639
|
-
},
|
|
640
|
-
keywords: [],
|
|
641
|
-
description: "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
642
|
-
author: "Jo\xEBl Charles",
|
|
643
|
-
repository: "https://github.com/batijs/bati",
|
|
644
|
-
license: "MIT",
|
|
645
|
-
devDependencies: {
|
|
646
|
-
"@batijs/build": "workspace:*",
|
|
647
|
-
"@batijs/compile": "workspace:*",
|
|
648
|
-
"@types/node": "^18.19.14",
|
|
649
|
-
"@types/which": "^3.0.3",
|
|
650
|
-
citty: "^0.1.6",
|
|
651
|
-
colorette: "^2.0.20",
|
|
652
|
-
esbuild: "^0.20.2",
|
|
653
|
-
execa: "^8.0.1",
|
|
654
|
-
rimraf: "^5.0.5",
|
|
655
|
-
sift: "^17.1.2",
|
|
656
|
-
tsup: "^8.0.2",
|
|
657
|
-
typescript: "^5.4.5",
|
|
658
|
-
vite: "^5.2.8"
|
|
659
|
-
},
|
|
660
|
-
dependencies: {
|
|
661
|
-
"@batijs/core": "workspace:*",
|
|
662
|
-
"@batijs/features": "workspace:*"
|
|
663
|
-
},
|
|
664
|
-
bin: "./dist/index.js",
|
|
665
|
-
exports: {
|
|
666
|
-
".": "./dist/index.js"
|
|
667
|
-
},
|
|
668
|
-
files: [
|
|
669
|
-
"dist/"
|
|
670
|
-
]
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
// index.ts
|
|
674
|
-
import { withIcon } from "@batijs/core";
|
|
675
|
-
import { features, flags as coreFlags } from "@batijs/features";
|
|
676
|
-
import { execRules } from "@batijs/features/rules";
|
|
677
|
-
import { existsSync as existsSync2 } from "fs";
|
|
678
|
-
import { fileURLToPath } from "url";
|
|
679
|
-
import { dirname, join, parse } from "path";
|
|
680
|
-
import { access, constants, lstat, readdir, readFile as readFile3 } from "fs/promises";
|
|
681
|
-
|
|
682
640
|
// ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
683
641
|
import * as tty from "tty";
|
|
684
642
|
var {
|
|
@@ -794,32 +752,6 @@ var {
|
|
|
794
752
|
bgWhiteBright
|
|
795
753
|
} = createColors();
|
|
796
754
|
|
|
797
|
-
// rules.ts
|
|
798
|
-
import { RulesMessage } from "@batijs/features/rules";
|
|
799
|
-
function error(value) {
|
|
800
|
-
return {
|
|
801
|
-
type: "error",
|
|
802
|
-
value
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
function info(value) {
|
|
806
|
-
return {
|
|
807
|
-
type: "info",
|
|
808
|
-
value
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
var rulesMessages = {
|
|
812
|
-
[RulesMessage.ERROR_AUTH_R_SERVER]: error(
|
|
813
|
-
`A ${inverse(bold("Server"))} is required when using ${inverse(
|
|
814
|
-
bold("Auth")
|
|
815
|
-
)}. Check https://vite-plugin-ssr.com/integration#server-side-tools for details and https://batijs.dev for available servers`
|
|
816
|
-
),
|
|
817
|
-
[RulesMessage.ERROR_COMPILED_R_REACT]: error(
|
|
818
|
-
`${inverse(bold("React"))} is required when using ${inverse(bold("Compiled"))}.`
|
|
819
|
-
),
|
|
820
|
-
[RulesMessage.INFO_HATTIP]: info(`${inverse(bold("HatTip"))} is an experimental project`)
|
|
821
|
-
};
|
|
822
|
-
|
|
823
755
|
// ../../node_modules/.pnpm/sift@17.1.2/node_modules/sift/es5m/index.js
|
|
824
756
|
var extendStatics = function(d, b) {
|
|
825
757
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
@@ -1602,6 +1534,76 @@ var createDefaultQueryTester = function(query, options) {
|
|
|
1602
1534
|
return createOperationTester(op);
|
|
1603
1535
|
};
|
|
1604
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
|
+
|
|
1605
1607
|
// index.ts
|
|
1606
1608
|
var __filename = fileURLToPath(import.meta.url);
|
|
1607
1609
|
var __dirname = dirname(__filename);
|
|
@@ -1657,7 +1659,9 @@ function printOK(dist, flags) {
|
|
|
1657
1659
|
console.log(cmd3(`cd ${dist}`));
|
|
1658
1660
|
console.log(cmd3("pnpm install"));
|
|
1659
1661
|
console.log(cmd3("pnpm run dev"));
|
|
1660
|
-
console.log(
|
|
1662
|
+
console.log(
|
|
1663
|
+
"\n" + bold(book0("Be sure to check the ") + cyan("README.md") + " file for remaining steps and documentation.")
|
|
1664
|
+
);
|
|
1661
1665
|
}
|
|
1662
1666
|
var defaultDef = {
|
|
1663
1667
|
project: {
|
|
@@ -1775,11 +1779,7 @@ async function run() {
|
|
|
1775
1779
|
version: package_default.version,
|
|
1776
1780
|
description: package_default.description
|
|
1777
1781
|
},
|
|
1778
|
-
args: Object.assign(
|
|
1779
|
-
{},
|
|
1780
|
-
defaultDef,
|
|
1781
|
-
...coreFlags.map((k) => toArg(k, findDescription(k)))
|
|
1782
|
-
),
|
|
1782
|
+
args: Object.assign({}, defaultDef, ...coreFlags.map((k) => toArg(k, findDescription(k)))),
|
|
1783
1783
|
async run({ args }) {
|
|
1784
1784
|
await checkArguments(args);
|
|
1785
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": {
|