@stacksjs/cms 0.75.439 → 0.75.445
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/cms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.445",
|
|
6
6
|
"description": "Stacks cms utilities.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"prepublishOnly": "bun run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@stacksjs/database": "0.75.
|
|
62
|
-
"@stacksjs/error-handling": "0.75.
|
|
63
|
-
"@stacksjs/orm": "0.75.
|
|
64
|
-
"@stacksjs/path": "0.75.
|
|
65
|
-
"@stacksjs/sites": "0.75.
|
|
66
|
-
"@stacksjs/slug": "0.75.
|
|
67
|
-
"@stacksjs/stx": "0.2.
|
|
68
|
-
"@stacksjs/validation": "0.75.
|
|
61
|
+
"@stacksjs/database": "0.75.445",
|
|
62
|
+
"@stacksjs/error-handling": "0.75.445",
|
|
63
|
+
"@stacksjs/orm": "0.75.445",
|
|
64
|
+
"@stacksjs/path": "0.75.445",
|
|
65
|
+
"@stacksjs/sites": "0.75.445",
|
|
66
|
+
"@stacksjs/slug": "0.75.445",
|
|
67
|
+
"@stacksjs/stx": "0.2.789",
|
|
68
|
+
"@stacksjs/validation": "0.75.445",
|
|
69
69
|
"ts-medium-editor": "^0.2.0",
|
|
70
70
|
"ts-slug": "^0.2.1",
|
|
71
71
|
"ts-spreadsheets": "^0.2.5"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import process from"node:process";const[root,portArg,publicDir,siteJson]=process.argv.slice(2),port=Number(portArg),dbPath=process.env.DB_DATABASE_PATH;if(!root||!Number.isInteger(port)||port<=0||!publicDir||!siteJson)throw Error("usage: stx-cms-server.ts <root> <port> <publicDir> <siteJson>");if(process.env.DB_CONNECTION!=="sqlite"||!dbPath)throw Error("stx-cms-server.ts needs DB_CONNECTION=sqlite and DB_DATABASE_PATH");const site=JSON.parse(siteJson);(async()=>{const reader=Bun.stdin.stream().getReader();while(!(await reader.read()).done);process.exit(0)})();process.chdir(root);const{ensureDatabaseConfigLoaded,initializeDbConfig}=await import("@stacksjs/database");await ensureDatabaseConfigLoaded();initializeDbConfig({app:{env:"testing"},database:{default:"sqlite",connections:{sqlite:{database:dbPath,prefix:""}}}});const{registerDefaultBlocks}=await import("../../blocks/defaults"),{cmsPageFallback}=await import("../../public/fallback");registerDefaultBlocks();const{serve}=await import("bun-plugin-stx/serve");await serve({patterns:["resources/views/**/*.stx"],port,autoIncrementPort:!1,publicDir,quiet:!0,onResponse:async(req,response)=>{if(response.status!==404)return;return await cmsPageFallback(req,site)??void 0}});
|
package/dist/tests/setup.d.ts
DELETED
package/dist/tests/setup.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import{existsSync,unlinkSync}from"node:fs";import{tmpdir}from"node:os";import{join}from"node:path";import process from"node:process";const DB_PATH=join(tmpdir(),`stacks-cms-${process.pid}.sqlite`);process.env.DB_CONNECTION="sqlite";process.env.DB_DATABASE_PATH=DB_PATH;process.env.APP_ENV="testing";const{acquireDbConfigLock,db,ensureDatabaseConfigLoaded,initializeDbConfig}=await import("@stacksjs/database");async function forceConfig(){const releaseDbConfigLock=await acquireDbConfigLock();try{await ensureDatabaseConfigLoaded();initializeDbConfig({app:{env:"testing"},database:{default:"sqlite",connections:{sqlite:{database:DB_PATH,prefix:""}}}})}finally{releaseDbConfigLock()}}for(const suffix of["","-wal","-shm"])if(existsSync(`${DB_PATH}${suffix}`))unlinkSync(`${DB_PATH}${suffix}`);await forceConfig();await db.unsafe(`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS categorizables (
|
|
3
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
-
name VARCHAR(255) NOT NULL,
|
|
5
|
-
slug VARCHAR(255) NOT NULL,
|
|
6
|
-
description TEXT,
|
|
7
|
-
categorizable_type VARCHAR(255) NOT NULL,
|
|
8
|
-
is_active BOOLEAN NOT NULL DEFAULT 1,
|
|
9
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
-
updated_at TIMESTAMP
|
|
11
|
-
)
|
|
12
|
-
`).execute();await db.unsafe(`
|
|
13
|
-
CREATE TABLE IF NOT EXISTS categorizable_models (
|
|
14
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
15
|
-
category_id INTEGER NOT NULL,
|
|
16
|
-
categorizable_id INTEGER NOT NULL,
|
|
17
|
-
categorizable_type VARCHAR(255) NOT NULL,
|
|
18
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
19
|
-
updated_at TIMESTAMP
|
|
20
|
-
)
|
|
21
|
-
`).execute();await db.unsafe(`
|
|
22
|
-
CREATE TABLE IF NOT EXISTS taggable_models (
|
|
23
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
24
|
-
tag_id INTEGER NOT NULL,
|
|
25
|
-
taggable_id INTEGER NOT NULL,
|
|
26
|
-
taggable_type VARCHAR(255) NOT NULL,
|
|
27
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
28
|
-
updated_at TIMESTAMP
|
|
29
|
-
)
|
|
30
|
-
`).execute();await db.unsafe(`
|
|
31
|
-
CREATE TABLE IF NOT EXISTS tags (
|
|
32
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
33
|
-
name VARCHAR(255),
|
|
34
|
-
slug VARCHAR(255),
|
|
35
|
-
description TEXT,
|
|
36
|
-
post_count INTEGER DEFAULT 0,
|
|
37
|
-
color VARCHAR(255),
|
|
38
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
39
|
-
updated_at TIMESTAMP,
|
|
40
|
-
uuid VARCHAR(255)
|
|
41
|
-
)
|
|
42
|
-
`).execute();await db.unsafe(`
|
|
43
|
-
CREATE TABLE IF NOT EXISTS pages (
|
|
44
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
45
|
-
uuid VARCHAR(255),
|
|
46
|
-
site_id INTEGER,
|
|
47
|
-
author_id INTEGER,
|
|
48
|
-
parent_id INTEGER,
|
|
49
|
-
title VARCHAR(255) NOT NULL,
|
|
50
|
-
slug VARCHAR(255),
|
|
51
|
-
path VARCHAR(2048),
|
|
52
|
-
template VARCHAR(255) NOT NULL DEFAULT 'default',
|
|
53
|
-
blocks TEXT,
|
|
54
|
-
meta_description VARCHAR(320),
|
|
55
|
-
status VARCHAR(32) NOT NULL DEFAULT 'draft',
|
|
56
|
-
scheduled_at TIMESTAMP,
|
|
57
|
-
views INTEGER NOT NULL DEFAULT 0,
|
|
58
|
-
conversions INTEGER NOT NULL DEFAULT 0,
|
|
59
|
-
published_at TIMESTAMP,
|
|
60
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
61
|
-
updated_at TIMESTAMP
|
|
62
|
-
)
|
|
63
|
-
`).execute();await db.unsafe(`
|
|
64
|
-
CREATE UNIQUE INDEX IF NOT EXISTS pages_site_path_unique ON pages (site_id, path)
|
|
65
|
-
`).execute();await db.unsafe(`
|
|
66
|
-
CREATE TABLE IF NOT EXISTS page_revisions (
|
|
67
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
68
|
-
page_id INTEGER NOT NULL,
|
|
69
|
-
author_id INTEGER,
|
|
70
|
-
revision INTEGER NOT NULL,
|
|
71
|
-
title VARCHAR(255) NOT NULL,
|
|
72
|
-
blocks TEXT,
|
|
73
|
-
meta_description VARCHAR(320),
|
|
74
|
-
note VARCHAR(500),
|
|
75
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
76
|
-
updated_at TIMESTAMP
|
|
77
|
-
)
|
|
78
|
-
`).execute();await db.unsafe(`
|
|
79
|
-
CREATE TABLE IF NOT EXISTS redirects (
|
|
80
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
81
|
-
site_id INTEGER NOT NULL,
|
|
82
|
-
from_path VARCHAR(2048) NOT NULL,
|
|
83
|
-
to_path VARCHAR(2048) NOT NULL,
|
|
84
|
-
status_code INTEGER NOT NULL DEFAULT 301,
|
|
85
|
-
source VARCHAR(32) NOT NULL DEFAULT 'manual',
|
|
86
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
87
|
-
updated_at TIMESTAMP
|
|
88
|
-
)
|
|
89
|
-
`).execute();await db.unsafe(`
|
|
90
|
-
CREATE TABLE IF NOT EXISTS menus (
|
|
91
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
92
|
-
site_id INTEGER NOT NULL,
|
|
93
|
-
handle VARCHAR(64) NOT NULL,
|
|
94
|
-
name VARCHAR(255) NOT NULL,
|
|
95
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
96
|
-
updated_at TIMESTAMP
|
|
97
|
-
)
|
|
98
|
-
`).execute();await db.unsafe(`
|
|
99
|
-
CREATE TABLE IF NOT EXISTS menu_items (
|
|
100
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
101
|
-
menu_id INTEGER NOT NULL,
|
|
102
|
-
page_id INTEGER,
|
|
103
|
-
label VARCHAR(120) NOT NULL,
|
|
104
|
-
url VARCHAR(2048),
|
|
105
|
-
target VARCHAR(8) DEFAULT '_self',
|
|
106
|
-
parent_id INTEGER,
|
|
107
|
-
position INTEGER DEFAULT 0,
|
|
108
|
-
visibility VARCHAR(16) DEFAULT 'public',
|
|
109
|
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
110
|
-
updated_at TIMESTAMP
|
|
111
|
-
)
|
|
112
|
-
`).execute();const tableNames=["categorizables","categorizable_models","taggable_models","tags","pages","page_revisions","redirects","menus","menu_items"];export async function refreshDatabase(){await forceConfig();for(const table of tableNames)await db.unsafe(`DELETE FROM ${table}`).execute()}process.on("exit",()=>{for(const suffix of["","-wal","-shm"])try{if(existsSync(`${DB_PATH}${suffix}`))unlinkSync(`${DB_PATH}${suffix}`)}catch{}});
|