Skip to content

Commit df6da7e

Browse files
committed
format link-deps and add todo
1 parent 3850576 commit df6da7e

1 file changed

Lines changed: 86 additions & 29 deletions

File tree

link-deps.cjs

Lines changed: 86 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* - PenguinMod-ApiModule (penguinmod)
44
* - PenguinMod-MarkDownNew (PenguinMod-MarkDown)
55
* - PenguinMod-SvelteUI
6-
*
6+
*
77
* How to use this:
88
* - Download all the specified repos, and change the hardcoded URLs to the ones on your system
99
* - Install all the dependencies for PM Home first
@@ -13,52 +13,109 @@
1313
* - If you get an error about paths not existing, its likely that you ran the script once as non-admin/sudo, and you need to reinstall the modules for pm home to fix it
1414
* - Run this script with `node link-deps.cjs` as administrator
1515
* - If you get an error about paths not existing, its likely that you ran the script once as non-admin/sudo, and you need to reinstall the modules for pm home to fix it
16-
*
16+
*
1717
* For SvelteUI specifically, you need to recompile with `npm run prepack` each time you make changes
1818
*/
1919
/** */
2020
const fs = require("fs");
2121
const path = require("path");
2222

23-
24-
25-
23+
// TODO: request paths via node:readline
2624

2725
// CONFIG
28-
const pathPenguinModApiModule = "C:/Users/Jeremy/Documents/Projects/PenguinMod/PenguinMod-ApiModule";
29-
const pathPenguinModMarkDownNew = "C:/Users/Jeremy/Documents/Projects/PenguinMod/PenguinMod-MarkDownNew";
30-
const pathPenguinModSvelteUI = "C:/Users/Jeremy/Documents/Projects/PenguinMod/PenguinMod-SvelteUI";
31-
const nodeModulesPathPenguinModApiModule = path.join(__dirname, "node_modules/penguinmod");
32-
const nodeModulesPathPenguinModMarkDownNew = path.join(__dirname, "node_modules/PenguinMod-MarkDown");
33-
const nodeModulesPathPenguinModSvelteUI = path.join(__dirname, "node_modules/PenguinMod-SvelteUI");
34-
35-
36-
26+
const pathPenguinModApiModule =
27+
"C:/Users/Jeremy/Documents/Projects/PenguinMod/PenguinMod-ApiModule";
28+
const pathPenguinModMarkDownNew =
29+
"C:/Users/Jeremy/Documents/Projects/PenguinMod/PenguinMod-MarkDownNew";
30+
const pathPenguinModSvelteUI =
31+
"C:/Users/Jeremy/Documents/Projects/PenguinMod/PenguinMod-SvelteUI";
32+
const nodeModulesPathPenguinModApiModule = path.join(
33+
__dirname,
34+
"node_modules/penguinmod",
35+
);
36+
const nodeModulesPathPenguinModMarkDownNew = path.join(
37+
__dirname,
38+
"node_modules/PenguinMod-MarkDown",
39+
);
40+
const nodeModulesPathPenguinModSvelteUI = path.join(
41+
__dirname,
42+
"node_modules/PenguinMod-SvelteUI",
43+
);
3744

3845
// script
39-
console.log("Linking with LOCAL Paths (make sure you configured them), run this script as administrator/sudo if you have an issue");
46+
console.log(
47+
"Linking with LOCAL Paths (make sure you configured them), run this script as administrator/sudo if you have an issue",
48+
);
4049

4150
// nodeModulesPathPenguinModApiModule
42-
if (fs.existsSync(pathPenguinModApiModule) && fs.existsSync(nodeModulesPathPenguinModApiModule)) {
43-
fs.rmSync(nodeModulesPathPenguinModApiModule, { recursive: true, force: true });
51+
if (
52+
fs.existsSync(pathPenguinModApiModule) &&
53+
fs.existsSync(nodeModulesPathPenguinModApiModule)
54+
) {
55+
fs.rmSync(nodeModulesPathPenguinModApiModule, {
56+
recursive: true,
57+
force: true,
58+
});
4459
fs.symlinkSync(pathPenguinModApiModule, nodeModulesPathPenguinModApiModule);
45-
console.log("symlinked:", pathPenguinModApiModule, "to", nodeModulesPathPenguinModApiModule);
60+
console.log(
61+
"symlinked:",
62+
pathPenguinModApiModule,
63+
"to",
64+
nodeModulesPathPenguinModApiModule,
65+
);
4666
} else {
47-
console.warn("one of these is missing:", pathPenguinModApiModule, nodeModulesPathPenguinModApiModule);
67+
console.warn(
68+
"one of these is missing:",
69+
pathPenguinModApiModule,
70+
nodeModulesPathPenguinModApiModule,
71+
);
4872
}
4973
// nodeModulesPathPenguinModMarkDownNew
50-
if (fs.existsSync(pathPenguinModMarkDownNew) && fs.existsSync(nodeModulesPathPenguinModMarkDownNew)) {
51-
fs.rmSync(nodeModulesPathPenguinModMarkDownNew, { recursive: true, force: true });
52-
fs.symlinkSync(pathPenguinModMarkDownNew, nodeModulesPathPenguinModMarkDownNew);
53-
console.log("symlinked:", pathPenguinModMarkDownNew, "to", nodeModulesPathPenguinModMarkDownNew);
74+
if (
75+
fs.existsSync(pathPenguinModMarkDownNew) &&
76+
fs.existsSync(nodeModulesPathPenguinModMarkDownNew)
77+
) {
78+
fs.rmSync(nodeModulesPathPenguinModMarkDownNew, {
79+
recursive: true,
80+
force: true,
81+
});
82+
fs.symlinkSync(
83+
pathPenguinModMarkDownNew,
84+
nodeModulesPathPenguinModMarkDownNew,
85+
);
86+
console.log(
87+
"symlinked:",
88+
pathPenguinModMarkDownNew,
89+
"to",
90+
nodeModulesPathPenguinModMarkDownNew,
91+
);
5492
} else {
55-
console.warn("one of these is missing:", pathPenguinModMarkDownNew, nodeModulesPathPenguinModMarkDownNew);
93+
console.warn(
94+
"one of these is missing:",
95+
pathPenguinModMarkDownNew,
96+
nodeModulesPathPenguinModMarkDownNew,
97+
);
5698
}
5799
// nodeModulesPathPenguinModSvelteUI
58-
if (fs.existsSync(pathPenguinModSvelteUI) && fs.existsSync(nodeModulesPathPenguinModSvelteUI)) {
59-
fs.rmSync(nodeModulesPathPenguinModSvelteUI, { recursive: true, force: true });
100+
if (
101+
fs.existsSync(pathPenguinModSvelteUI) &&
102+
fs.existsSync(nodeModulesPathPenguinModSvelteUI)
103+
) {
104+
fs.rmSync(nodeModulesPathPenguinModSvelteUI, {
105+
recursive: true,
106+
force: true,
107+
});
60108
fs.symlinkSync(pathPenguinModSvelteUI, nodeModulesPathPenguinModSvelteUI);
61-
console.log("symlinked:", pathPenguinModSvelteUI, "to", nodeModulesPathPenguinModSvelteUI);
109+
console.log(
110+
"symlinked:",
111+
pathPenguinModSvelteUI,
112+
"to",
113+
nodeModulesPathPenguinModSvelteUI,
114+
);
62115
} else {
63-
console.warn("one of these is missing:", pathPenguinModSvelteUI, nodeModulesPathPenguinModSvelteUI);
64-
}
116+
console.warn(
117+
"one of these is missing:",
118+
pathPenguinModSvelteUI,
119+
nodeModulesPathPenguinModSvelteUI,
120+
);
121+
}

0 commit comments

Comments
 (0)