@tiddlywiki/mws 0.2.4 → 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/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());
|