create-fluixi 1.0.0-alpha.108 → 1.0.0-alpha.110
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 +69 -17
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// ../compiler/dist/
|
|
3
|
+
// ../compiler/dist/chunk-RTVBP53W.mjs
|
|
4
4
|
var REACTIVE_MODULE = "@fluixi/reactive/signal";
|
|
5
5
|
var INTRINSICS = {
|
|
6
6
|
$signal: { export: "signal", module: REACTIVE_MODULE, returns: "signal-handle" },
|
|
@@ -43,23 +43,13 @@ var TAG_INTRINSICS = {
|
|
|
43
43
|
var INTRINSIC_CALL = new RegExp(`\\$(?:${Object.keys(INTRINSICS).map((n) => n.slice(1)).join("|")})\\s*\\(`);
|
|
44
44
|
|
|
45
45
|
// src/index.ts
|
|
46
|
-
import { cpSync, renameSync, readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync3 } from "node:fs";
|
|
46
|
+
import { cpSync, renameSync, readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync3, rmSync } from "node:fs";
|
|
47
47
|
import { resolve, basename, join as join2 } from "node:path";
|
|
48
48
|
import { fileURLToPath } from "node:url";
|
|
49
49
|
|
|
50
|
-
// ../cli/dist/
|
|
51
|
-
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
52
|
-
import { dirname as dirname2, join, relative } from "node:path";
|
|
50
|
+
// ../cli/dist/chunk-YUGMW4KS.mjs
|
|
53
51
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
54
52
|
import { dirname } from "node:path";
|
|
55
|
-
import { createInterface } from "node:readline/promises";
|
|
56
|
-
import { emitKeypressEvents } from "node:readline";
|
|
57
|
-
import { stdin as input, stdout as output, exit, env } from "node:process";
|
|
58
|
-
var __defProp = Object.defineProperty;
|
|
59
|
-
var __export = (target, all) => {
|
|
60
|
-
for (var name in all)
|
|
61
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
62
|
-
};
|
|
63
53
|
function closing(text, open) {
|
|
64
54
|
let depth = 0;
|
|
65
55
|
for (let i = open; i < text.length; i++) {
|
|
@@ -174,6 +164,15 @@ ${add.map(([k, v]) => `${k}=${v}`).join("\n")}
|
|
|
174
164
|
${block}` : block);
|
|
175
165
|
log.push({ kind: text ? "updated" : "created", file, detail: add.map(([k]) => k).join(", ") });
|
|
176
166
|
}
|
|
167
|
+
|
|
168
|
+
// ../cli/dist/chunk-7P6ASYW6.mjs
|
|
169
|
+
var __defProp = Object.defineProperty;
|
|
170
|
+
var __export = (target, all) => {
|
|
171
|
+
for (var name in all)
|
|
172
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// ../cli/dist/chunk-E6XR4RAN.mjs
|
|
177
176
|
var templates_exports = {};
|
|
178
177
|
__export(templates_exports, {
|
|
179
178
|
AUTH_READER: () => AUTH_READER,
|
|
@@ -403,6 +402,10 @@ export const GET = handler;
|
|
|
403
402
|
export const POST = handler;
|
|
404
403
|
export default handler;
|
|
405
404
|
`;
|
|
405
|
+
|
|
406
|
+
// ../cli/dist/chunk-RJL4DDKJ.mjs
|
|
407
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
408
|
+
import { dirname as dirname2, join, relative } from "node:path";
|
|
406
409
|
var ScaffoldError = class extends Error {
|
|
407
410
|
};
|
|
408
411
|
function importPath(from, to) {
|
|
@@ -504,6 +507,11 @@ function setupBetterAuth(root, dependencySpec = "alpha") {
|
|
|
504
507
|
notes: []
|
|
505
508
|
};
|
|
506
509
|
}
|
|
510
|
+
|
|
511
|
+
// ../cli/dist/chunk-K2PDBXFB.mjs
|
|
512
|
+
import { createInterface } from "node:readline/promises";
|
|
513
|
+
import { emitKeypressEvents } from "node:readline";
|
|
514
|
+
import { stdin as input, stdout as output, exit, env } from "node:process";
|
|
507
515
|
var COLOR = env.NO_COLOR || env.FORCE_COLOR === "0" ? false : (!!output.isTTY || !!env.FORCE_COLOR) && env.TERM !== "dumb";
|
|
508
516
|
var sgr = (o, x) => (s) => COLOR ? `\x1B[${o}m${s}\x1B[${x}m` : `${s}`;
|
|
509
517
|
var c = { bold: sgr(1, 22), green: sgr(32, 39), cyan: sgr(36, 39), gray: sgr(90, 39) };
|
|
@@ -648,6 +656,7 @@ Scaffold a Fluixi app in dir. What is not given is asked for.
|
|
|
648
656
|
|
|
649
657
|
--ssr | --spa rendered on the server or in the browser, both with @fluixi/start
|
|
650
658
|
--jsx | --html template syntax
|
|
659
|
+
--document the page shell as a component (src/document.tsx) instead of index.html
|
|
651
660
|
--ui | --no-ui @fluixi-ui components
|
|
652
661
|
--fluixi-css | --tailwind | --no-css
|
|
653
662
|
--auth=oauth2|better-auth authentication; --no-auth for none
|
|
@@ -658,7 +667,7 @@ Scaffold a Fluixi app in dir. What is not given is asked for.
|
|
|
658
667
|
npm keeps options for itself unless they follow --:
|
|
659
668
|
npm create fluixi@alpha -- my-app --spa
|
|
660
669
|
`;
|
|
661
|
-
var FLAGS = /* @__PURE__ */ new Set(["--ssr", "--spa", "--jsx", "--html", "--ui", "--no-ui", "--tailwind", "--fluixi-css", "--no-css", "--no-auth", "--help", "-h"]);
|
|
670
|
+
var FLAGS = /* @__PURE__ */ new Set(["--ssr", "--spa", "--jsx", "--html", "--document", "--ui", "--no-ui", "--tailwind", "--fluixi-css", "--no-css", "--no-auth", "--help", "-h"]);
|
|
662
671
|
var VALUED = ["auth", "provider", "tokens"];
|
|
663
672
|
var option = (args, name) => {
|
|
664
673
|
const i = args.indexOf(`--${name}`);
|
|
@@ -679,9 +688,9 @@ function addDeps(pkg, section, deps) {
|
|
|
679
688
|
Object.entries({ ...pkg[section] ?? {}, ...deps }).sort(([a], [b]) => a.localeCompare(b))
|
|
680
689
|
);
|
|
681
690
|
}
|
|
682
|
-
function styleSheet(ui, css) {
|
|
691
|
+
function styleSheet(ui, css, shell) {
|
|
683
692
|
const darkVariant = `@custom-variant dark (&:where([data-theme='dark'], [data-theme='dark'] *));`;
|
|
684
|
-
const sources = `@source '.';
|
|
693
|
+
const sources = shell === "document" ? `@source '.';` : `@source '.';
|
|
685
694
|
@source '../index.html';`;
|
|
686
695
|
const theme = `@theme {
|
|
687
696
|
/* Design tokens. A --color-* scale here drives the whole app. */
|
|
@@ -738,6 +747,47 @@ function importStyles(target, ui, css) {
|
|
|
738
747
|
].join("\n");
|
|
739
748
|
writeFileSync3(file, head + readFileSync3(file, "utf8"));
|
|
740
749
|
}
|
|
750
|
+
function writeDocument(target, format) {
|
|
751
|
+
const index = join2(target, "index.html");
|
|
752
|
+
const title = /<title>([^<]*)<\/title>/.exec(readFileSync3(index, "utf8"))?.[1] ?? "Fluixi";
|
|
753
|
+
const head = `<meta charset="UTF-8" />
|
|
754
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
755
|
+
<title>${title}</title>`;
|
|
756
|
+
const source = format === "html" ? `import { html } from '@fluixi/core';
|
|
757
|
+
import { Html, Head, Main, Scripts } from '@fluixi/start/document';
|
|
758
|
+
|
|
759
|
+
// Rendered on the server for each request; only the app inside Main hydrates.
|
|
760
|
+
export default function Document() {
|
|
761
|
+
return html\`<\${Html} lang="en">
|
|
762
|
+
<\${Head}>
|
|
763
|
+
${head}
|
|
764
|
+
</\${Head}>
|
|
765
|
+
<body>
|
|
766
|
+
<\${Main} />
|
|
767
|
+
<\${Scripts} />
|
|
768
|
+
</body>
|
|
769
|
+
</\${Html}>\`;
|
|
770
|
+
}
|
|
771
|
+
` : `import { Html, Head, Main, Scripts } from '@fluixi/start/document';
|
|
772
|
+
|
|
773
|
+
// Rendered on the server for each request; only the app inside Main hydrates.
|
|
774
|
+
export default function Document() {
|
|
775
|
+
return (
|
|
776
|
+
<Html lang="en">
|
|
777
|
+
<Head>
|
|
778
|
+
${head}
|
|
779
|
+
</Head>
|
|
780
|
+
<body>
|
|
781
|
+
<Main />
|
|
782
|
+
<Scripts />
|
|
783
|
+
</body>
|
|
784
|
+
</Html>
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
`;
|
|
788
|
+
writeFileSync3(join2(target, "src", format === "html" ? "document.ts" : "document.tsx"), source);
|
|
789
|
+
rmSync(index);
|
|
790
|
+
}
|
|
741
791
|
async function main() {
|
|
742
792
|
const args = argv.slice(2);
|
|
743
793
|
if (args.includes("--help") || args.includes("-h")) {
|
|
@@ -746,6 +796,7 @@ async function main() {
|
|
|
746
796
|
}
|
|
747
797
|
let dir = args.find((a) => !a.startsWith("-"));
|
|
748
798
|
let mode = args.includes("--spa") ? "spa" : args.includes("--ssr") ? "ssr" : void 0;
|
|
799
|
+
const document = args.includes("--document");
|
|
749
800
|
let format = args.includes("--html") ? "html" : args.includes("--jsx") ? "jsx" : void 0;
|
|
750
801
|
let ui = args.includes("--ui") ? "fluixi-ui" : args.includes("--no-ui") ? "none" : void 0;
|
|
751
802
|
let css = args.includes("--tailwind") ? "tailwind" : args.includes("--fluixi-css") ? "fluixi-css" : args.includes("--no-css") ? "none" : void 0;
|
|
@@ -830,6 +881,7 @@ ${BAR2}
|
|
|
830
881
|
}
|
|
831
882
|
const template = `../template-${mode}${format === "html" ? "-html" : ""}`;
|
|
832
883
|
cpSync(here(template), target, { recursive: true });
|
|
884
|
+
if (document) writeDocument(target, format);
|
|
833
885
|
const gi = join2(target, "_gitignore");
|
|
834
886
|
if (existsSync3(gi)) renameSync(gi, join2(target, ".gitignore"));
|
|
835
887
|
writeFileSync3(join2(target, "fluixi.d.ts"), INTRINSICS_DTS);
|
|
@@ -858,7 +910,7 @@ ${BAR2}
|
|
|
858
910
|
}
|
|
859
911
|
if (ui === "fluixi-ui" || css !== "none") {
|
|
860
912
|
if (css === "fluixi-css") writeFileSync3(join2(target, "src", "layers.css"), LAYERS_CSS);
|
|
861
|
-
const sheet = styleSheet(ui, css);
|
|
913
|
+
const sheet = styleSheet(ui, css, document ? "document" : "index");
|
|
862
914
|
writeFileSync3(join2(target, "src", "styles.css"), sheet);
|
|
863
915
|
importStyles(target, ui, css);
|
|
864
916
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-fluixi",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.110",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Ibrahima Touré",
|
|
6
6
|
"description": "Scaffold a new Fluixi app — `npm create fluixi <dir>`.",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"esbuild": "^0.24.0",
|
|
31
31
|
"vitest": "^5.0.3",
|
|
32
|
-
"@fluixi/cli": "1.0.0-alpha.
|
|
33
|
-
"@fluixi/compiler": "1.0.0-alpha.
|
|
32
|
+
"@fluixi/cli": "1.0.0-alpha.110",
|
|
33
|
+
"@fluixi/compiler": "1.0.0-alpha.110"
|
|
34
34
|
},
|
|
35
35
|
"nx": {
|
|
36
36
|
"targets": {
|