@tiddlywiki/mws 0.2.3 → 0.2.5
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/metafile-esm.json +1 -1
- package/dist/mws.js +401 -354
- package/dist/mws.js.map +1 -1
- package/mws.run.mjs +2 -40
- package/package.json +1 -1
- package/prisma/migrations/20260731035054_rb_pk/migration.sql +25 -0
- package/public/admin-vanilla.json +1 -1
- package/scripts/scripts.mjs +2 -2
package/mws.run.mjs
CHANGED
|
@@ -4,47 +4,9 @@ import { existsSync, readFileSync, } from "fs";
|
|
|
4
4
|
|
|
5
5
|
const cwd = process.cwd();
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const pkg = existsSync(`${cwd}/package.json`) && tryParseJSON(readFileSync(`${cwd}/package.json`, "utf8")) || null;
|
|
9
|
-
|
|
10
|
-
if (pkg && pkg.name === "@tiddlywiki/mws" && existsSync(`${cwd}/mws.dev.mjs`)) {
|
|
7
|
+
if (existsSync(`${cwd}/mws.dev.mjs`)) {
|
|
11
8
|
console.error("This appears to be a development version of MWS.");
|
|
12
9
|
process.exit(1);
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
if (pkg.version !== "0.2.0") {
|
|
17
|
-
console.log([
|
|
18
|
-
"=======================================================================================",
|
|
19
|
-
"The data folder you are trying to open appears to be from a different version of MWS.",
|
|
20
|
-
"",
|
|
21
|
-
"Folder: " + process.cwd(),
|
|
22
|
-
"Version: " + pkg.version,
|
|
23
|
-
"",
|
|
24
|
-
"To prevent data loss the program will now exit.",
|
|
25
|
-
"=======================================================================================",
|
|
26
|
-
].join("\n"));
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
// need absolute path because of cwd
|
|
30
|
-
import(`file://${cwd}/node_modules/@tiddlywiki/mws/dist/mws.js`)
|
|
31
|
-
.then(mws => mws.default(pkg.version))
|
|
32
|
-
.catch(console.error);
|
|
33
|
-
} else {
|
|
34
|
-
console.error("This does not appear to be a valid MWS data folder.");
|
|
35
|
-
console.error("Please run this command in the root of your MWS data folder.");
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @param {string} file
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
function tryParseJSON(file) {
|
|
45
|
-
try {
|
|
46
|
-
return JSON.parse(file);
|
|
47
|
-
} catch (e) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
12
|
+
import("./dist/mws.js").then(mws => mws.default());
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- The primary key for the `recipe_bag` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- RedefineTables
|
|
8
|
+
PRAGMA defer_foreign_keys=ON;
|
|
9
|
+
PRAGMA foreign_keys=OFF;
|
|
10
|
+
CREATE TABLE "new_recipe_bag" (
|
|
11
|
+
"recipe_id" TEXT NOT NULL,
|
|
12
|
+
"bag_id" TEXT NOT NULL,
|
|
13
|
+
"priority" INTEGER NOT NULL,
|
|
14
|
+
"is_writable" BOOLEAN NOT NULL,
|
|
15
|
+
"prefix" TEXT NOT NULL,
|
|
16
|
+
|
|
17
|
+
PRIMARY KEY ("recipe_id", "bag_id", "is_writable", "prefix"),
|
|
18
|
+
CONSTRAINT "recipe_bag_recipe_id_fkey" FOREIGN KEY ("recipe_id") REFERENCES "recipe" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
|
19
|
+
CONSTRAINT "recipe_bag_bag_id_fkey" FOREIGN KEY ("bag_id") REFERENCES "bag" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
20
|
+
);
|
|
21
|
+
INSERT INTO "new_recipe_bag" ("bag_id", "is_writable", "prefix", "priority", "recipe_id") SELECT "bag_id", "is_writable", "prefix", "priority", "recipe_id" FROM "recipe_bag";
|
|
22
|
+
DROP TABLE "recipe_bag";
|
|
23
|
+
ALTER TABLE "new_recipe_bag" RENAME TO "recipe_bag";
|
|
24
|
+
PRAGMA foreign_keys=ON;
|
|
25
|
+
PRAGMA defer_foreign_keys=OFF;
|