@paroicms/demo-app 0.41.26 → 0.42.1
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 +6 -6
- package/start.js +16 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/demo-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "ParoiCMS: demo app",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@paroicms/
|
|
17
|
-
"@paroicms/
|
|
18
|
-
"@paroicms/
|
|
19
|
-
"
|
|
15
|
+
"@paroicms/generator-site": "0.7.3",
|
|
16
|
+
"@paroicms/playground_demo1": "0.56.2",
|
|
17
|
+
"@paroicms/playground_demo2": "0.62.2",
|
|
18
|
+
"@paroicms/server": "1.91.1",
|
|
19
|
+
"arktype": "~2.1.20"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"start": "node start.js"
|
package/start.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
3
4
|
import { resolveModuleDirectory } from "@paroicms/public-server-lib";
|
|
4
5
|
import { start } from "@paroicms/server";
|
|
5
|
-
import {
|
|
6
|
-
import { join } from "path";
|
|
6
|
+
import { type } from "arktype";
|
|
7
7
|
|
|
8
8
|
const packageDir = resolveModuleDirectory(import.meta.url);
|
|
9
|
-
const { version, dependencies } = JSON.parse(
|
|
9
|
+
const { version, dependencies } = JSON.parse(
|
|
10
|
+
readFileSync(join(packageDir, "package.json"), "utf-8"),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const SiteValuesAT = type({
|
|
14
|
+
siteDir: "string",
|
|
15
|
+
version: "string",
|
|
16
|
+
"+": "ignore",
|
|
17
|
+
});
|
|
10
18
|
|
|
11
19
|
await start({
|
|
12
20
|
sitePackPlaces: {
|
|
13
21
|
playground: await loadSitePlaces(),
|
|
14
22
|
},
|
|
15
|
-
appVersion: version
|
|
23
|
+
appVersion: version,
|
|
16
24
|
});
|
|
17
25
|
|
|
18
26
|
async function loadSitePlaces() {
|
|
@@ -23,8 +31,7 @@ async function loadSitePlaces() {
|
|
|
23
31
|
if (!dependencyName.startsWith(packagePrefix)) continue;
|
|
24
32
|
const siteDependency = await import(dependencyName);
|
|
25
33
|
const values = siteDependency.default ?? siteDependency;
|
|
26
|
-
const siteDir =
|
|
27
|
-
const version = strVal(values.version);
|
|
34
|
+
const { siteDir, version } = SiteValuesAT.assert(values);
|
|
28
35
|
const domain = dependencyName.substring(packagePrefix.length);
|
|
29
36
|
sitePlaces.push({ siteDir, domain, version });
|
|
30
37
|
}
|
|
@@ -37,9 +44,7 @@ async function loadSitePlaces() {
|
|
|
37
44
|
async function loadGeneratorPackPlace() {
|
|
38
45
|
const siteDependency = await import("@paroicms/generator-site");
|
|
39
46
|
const values = siteDependency.default ?? siteDependency;
|
|
40
|
-
const siteDir =
|
|
41
|
-
const version = strVal(values.version);
|
|
42
|
-
// const domain = strVal(values.fqdn);
|
|
47
|
+
const { siteDir, version } = SiteValuesAT.assert(values);
|
|
43
48
|
const domain = "generator";
|
|
44
49
|
return { siteDir, version, domain };
|
|
45
|
-
}
|
|
50
|
+
}
|