@joystick.js/cli-canary 0.0.0-canary.659 → 0.0.0-canary.660
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"child_process";import m from"fs";import _ from"../../../cli_log.js";import g from"../../../command_exists.js";import p from"../../../get_platform_safe_path.js";import l from"../../../get_process_id_from_port.js";import f from"../../../kill_port_process.js";import a from"../../../path_exists.js";const{rename:u,readdir:w,mkdir:y}=m.promises,b=()=>{_(` MongoDB is not installed on this computer.
|
|
2
2
|
|
|
3
3
|
Download MongoDB at https://www.mongodb.com/try/download/community
|
|
4
4
|
|
|
5
|
-
After you've installed MongoDB, run joystick start again, or, remove MongoDB from your config.databases array in your settings.development.json file to skip starting it up.`,{level:"danger",docs:"https://github.com/cheatcode/joystick#databases"})},
|
|
5
|
+
After you've installed MongoDB, run joystick start again, or, remove MongoDB from your config.databases array in your settings.development.json file to skip starting it up.`,{level:"danger",docs:"https://github.com/cheatcode/joystick#databases"})},h=async()=>{if(process.platform==="win32"){const o=await i();return o&&o.length>0}return g("mongod")},i=async()=>await w("C:\\Program Files\\MongoDB\\Server\\"),k=(o=[])=>process.platform==="win32"&&["6.0","7.0","8.0","9.0","10.0"].some(t=>o.includes(t))?"mongosh":"mongo",v=(o=2610,s=[])=>new Promise(t=>{const n=["--port",o,"--dbpath",p(`./.joystick/data/mongodb_${o}`),"--quiet","--replSet",`joystick_${o}`];e.spawn("mongod",n.filter(r=>!!r)).stdout.on("data",async r=>{if((r?.toString()).includes("Waiting for connections")){const c=k(s);e.exec(`${c} --eval "rs.initiate()" --verbose --port ${o}`,async(B,M,S)=>{const d=await l(o);return t(parseInt(d,10))})}})}),x=async(o=2610)=>{const s=await a(".joystick/data/mongodb"),t=await a(`.joystick/data/mongodb_${o}`);return s&&!t&&await u(".joystick/data/mongodb",`.joystick/data/mongodb_${o}`),t||await y(`.joystick/data/mongodb_${o}`,{recursive:!0}),t},j=async(o=2610)=>{const s=await h(),t=process.platform==="win32"?await i():null;s||(b(),process.exit(1)),await x(o);try{return await f(o),await v(o,t)}catch(n){console.warn(n),process.exit(1)}};var E=j;export{E as default};
|
package/package.json
CHANGED
|
@@ -68,12 +68,8 @@ const start_mongodb_process = (mongodb_port = 2610, mongodb_windows_versions = [
|
|
|
68
68
|
if (stdout.includes('Waiting for connections')) {
|
|
69
69
|
const mongo_command = get_mongo_command(mongodb_windows_versions);
|
|
70
70
|
child_process.exec(`${mongo_command} --eval "rs.initiate()" --verbose --port ${mongodb_port}`, async (error, _stdout, stderr) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} else {
|
|
74
|
-
const process_id = await get_process_id_from_port(mongodb_port);
|
|
75
|
-
return resolve(parseInt(process_id, 10));
|
|
76
|
-
}
|
|
71
|
+
const process_id = await get_process_id_from_port(mongodb_port);
|
|
72
|
+
return resolve(parseInt(process_id, 10));
|
|
77
73
|
});
|
|
78
74
|
}
|
|
79
75
|
});
|