@effindomv2/create-fui-as-app 0.1.29 → 0.1.31
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/src/scaffold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdirSync, readdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
|
-
import { createTemplateFiles } from "./templates.js";
|
|
3
|
+
import { copyTemplateBinaryAssets, createTemplateFiles } from "./templates.js";
|
|
4
4
|
function normalizePackageName(value) {
|
|
5
5
|
return value
|
|
6
6
|
.trim()
|
|
@@ -27,6 +27,7 @@ export function createProject(options) {
|
|
|
27
27
|
mkdirSync(dirname(absolutePath), { recursive: true });
|
|
28
28
|
writeFileSync(absolutePath, contents, "utf8");
|
|
29
29
|
}
|
|
30
|
+
copyTemplateBinaryAssets(options.template ?? "hello", options.targetDirectory);
|
|
30
31
|
}
|
|
31
32
|
function parseCliOptions(argv) {
|
|
32
33
|
let requestedPath = null;
|
package/dist/src/templates.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export interface TemplateContext {
|
|
|
4
4
|
readonly packageName: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function createTemplateFiles(template: TemplateName, context: TemplateContext): Map<string, string>;
|
|
7
|
+
export declare function copyTemplateBinaryAssets(template: TemplateName, destinationDirectory: string): void;
|
package/dist/src/templates.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
1
|
+
import { copyFileSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { FUI_AS_VERSION, RUNTIME_VERSION } from "./versions.js";
|
|
5
5
|
const TEMPLATE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "templates");
|
|
6
|
+
const BINARY_TEMPLATE_FILES = new Set(["favicon.ico"]);
|
|
6
7
|
const SHARED_LOADING_OVERLAY_STYLES = `.effindom-loading-overlay {
|
|
7
8
|
position: absolute;
|
|
8
9
|
inset: 0;
|
|
@@ -86,6 +87,9 @@ function collectTemplateFiles(root, relativePath = "") {
|
|
|
86
87
|
}
|
|
87
88
|
continue;
|
|
88
89
|
}
|
|
90
|
+
if (BINARY_TEMPLATE_FILES.has(nestedRelativePath)) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
89
93
|
output.set(nestedRelativePath, readFileSync(nestedAbsolutePath, "utf8"));
|
|
90
94
|
}
|
|
91
95
|
return output;
|
|
@@ -112,3 +116,10 @@ export function createTemplateFiles(template, context) {
|
|
|
112
116
|
}
|
|
113
117
|
return output;
|
|
114
118
|
}
|
|
119
|
+
export function copyTemplateBinaryAssets(template, destinationDirectory) {
|
|
120
|
+
for (const binaryFile of BINARY_TEMPLATE_FILES) {
|
|
121
|
+
const sourcePath = resolve(TEMPLATE_ROOT, template, binaryFile);
|
|
122
|
+
const destinationPath = resolve(destinationDirectory, binaryFile);
|
|
123
|
+
copyFileSync(sourcePath, destinationPath);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -35,6 +35,7 @@ test("createProject writes hello-world scaffold including AssemblyScript tsconfi
|
|
|
35
35
|
assert.equal(readFileSync(join(target, "src", "host", "host-services.ts"), "utf8").includes("appHostServices"), true);
|
|
36
36
|
assert.equal(readFileSync(join(target, "src", "host", "generated", "HostEvents.ts"), "utf8").includes("onAppClockTick"), true);
|
|
37
37
|
assert.equal(readFileSync(join(target, "src", "host", "generated", "HostServices.ts"), "utf8").includes("appClockNowUnixSeconds"), true);
|
|
38
|
+
assert.deepEqual(readFileSync(join(target, "favicon.ico")), readFileSync(join(process.cwd(), "templates", "hello", "favicon.ico")));
|
|
38
39
|
}
|
|
39
40
|
finally {
|
|
40
41
|
rmSync(root, { recursive: true, force: true });
|
|
@@ -73,6 +74,7 @@ test("createProject writes mvc scaffold when template is mvc", () => {
|
|
|
73
74
|
assert.equal(routeShell.includes("FUI-AS Routed Demo"), false);
|
|
74
75
|
assert.equal(routeShell.includes('class="app-shell"'), true);
|
|
75
76
|
assert.equal(routeShell.includes('data-effindom-canvas-size-source'), true);
|
|
77
|
+
assert.deepEqual(readFileSync(join(target, "favicon.ico")), readFileSync(join(process.cwd(), "templates", "mvc", "favicon.ico")));
|
|
76
78
|
}
|
|
77
79
|
finally {
|
|
78
80
|
rmSync(root, { recursive: true, force: true });
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|