create-fff-app 0.1.7 → 0.1.8
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/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -17,12 +17,29 @@ const bundledTemplate = join(import.meta.dir, '../template');
|
|
|
17
17
|
const monorepTemplate = join(import.meta.dir, '../../../template');
|
|
18
18
|
const TEMPLATE_DIR = existsSync(monorepTemplate) ? monorepTemplate : bundledTemplate;
|
|
19
19
|
const SKIP_DIRS = new Set(['obj', 'bin', 'node_modules', '.git', 'dist']);
|
|
20
|
+
const SKIP_EXTS = new Set(['.js', '.js.map']);
|
|
20
21
|
|
|
21
22
|
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
22
23
|
|
|
24
|
+
function transformContent(filename: string, content: string): string {
|
|
25
|
+
if (filename === 'package.json') {
|
|
26
|
+
// Replace monorepo file: reference with published npm version
|
|
27
|
+
content = content.replace(
|
|
28
|
+
/"@fff-stack\/fjsx-compiler":\s*"file:[^"]+"/g,
|
|
29
|
+
'"@fff-stack/fjsx-compiler": "^0.1.0"'
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return content;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function hasFjsx(dir: string): boolean {
|
|
36
|
+
try { return readdirSync(dir).some(f => f.endsWith('.fjsx')); } catch { return false; }
|
|
37
|
+
}
|
|
38
|
+
|
|
23
39
|
function copyDir(src: string, dest: string, projectName: string) {
|
|
24
40
|
const entries = readdirSync(src, { withFileTypes: true });
|
|
25
41
|
mkdirSync(dest, { recursive: true });
|
|
42
|
+
const fjsxDir = hasFjsx(src);
|
|
26
43
|
|
|
27
44
|
for (const entry of entries) {
|
|
28
45
|
if (SKIP_DIRS.has(entry.name)) continue;
|
|
@@ -33,8 +50,11 @@ function copyDir(src: string, dest: string, projectName: string) {
|
|
|
33
50
|
if (entry.isDirectory()) {
|
|
34
51
|
copyDir(srcPath, destPath, projectName);
|
|
35
52
|
} else {
|
|
53
|
+
// Skip FJSX-generated JS/map files in directories that contain .fjsx sources
|
|
54
|
+
const ext = entry.name.endsWith('.js.map') ? '.js.map' : entry.name.slice(entry.name.lastIndexOf('.'));
|
|
55
|
+
if (fjsxDir && SKIP_EXTS.has(ext)) continue;
|
|
36
56
|
const raw = readFileSync(srcPath, 'utf-8');
|
|
37
|
-
const content = raw.replace(/fff-stack-app/g, projectName);
|
|
57
|
+
const content = transformContent(entry.name, raw.replace(/fff-stack-app/g, projectName));
|
|
38
58
|
// npm strips .gitignore from published packages; stored as "gitignore"
|
|
39
59
|
const outName = entry.name === 'gitignore' ? '.gitignore' : entry.name;
|
|
40
60
|
const outPath = join(dirname(destPath), outName);
|
|
@@ -4,24 +4,23 @@ open Fable.Core
|
|
|
4
4
|
open Fable.Core.JsInterop
|
|
5
5
|
|
|
6
6
|
// ── Compiled FJSX page template modules ──────────────────────────────────────
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
7
|
+
// Paths are relative to THIS source file so Fable generates correct dist-relative
|
|
8
|
+
// imports. FJSX output goes to dist/server/Pages/ (4 dirs up from here, then dist/).
|
|
9
|
+
// Run: fjsx --dir src/server/Endpoints/Pages --out dist/server/Pages
|
|
10
10
|
|
|
11
|
-
[<ImportAll("
|
|
11
|
+
[<ImportAll("../../../../dist/server/Pages/Layout.js")>]
|
|
12
12
|
let private layoutMod : obj = jsNative
|
|
13
13
|
|
|
14
|
-
[<ImportAll("
|
|
14
|
+
[<ImportAll("../../../../dist/server/Pages/EmployeeList.js")>]
|
|
15
15
|
let private employeeListMod : obj = jsNative
|
|
16
16
|
|
|
17
|
-
[<ImportAll("
|
|
17
|
+
[<ImportAll("../../../../dist/server/Pages/EmployeeNew.js")>]
|
|
18
18
|
let private employeeNewMod : obj = jsNative
|
|
19
19
|
|
|
20
|
-
[<ImportAll("
|
|
20
|
+
[<ImportAll("../../../../dist/server/Pages/About.js")>]
|
|
21
21
|
let private aboutMod : obj = jsNative
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
[<ImportAll("./EmployeeEdit.js")>]
|
|
23
|
+
[<ImportAll("../../../../dist/server/Pages/EmployeeEdit.js")>]
|
|
25
24
|
let private employeeEditMod : obj = jsNative
|
|
26
25
|
// ── Render helpers ────────────────────────────────────────────────────────────
|
|
27
26
|
|