@joystick.js/cli-canary 0.0.0-canary.656 → 0.0.0-canary.657
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 i from"child_process";import g from"fs";import p from"../../../cli_log.js";import l from"../../../command_exists.js";import f from"../../../get_platform_safe_path.js";import
|
|
1
|
+
import i from"child_process";import g from"fs";import p from"../../../cli_log.js";import l from"../../../command_exists.js";import f from"../../../get_platform_safe_path.js";import u from"../../../get_process_id_from_port.js";import w from"../../../kill_port_process.js";import c from"../../../path_exists.js";const{rename:y,readdir:b,mkdir:h}=g.promises,k=()=>{p(` 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"})},v=async()=>{if(process.platform==="win32"){const o=await d();return o&&o.length>0}return l("mongod")},d=async()=>await b("C:\\Program Files\\MongoDB\\Server\\"),x=(o=[])=>process.platform==="win32"&&["6.0","7.0","8.0","9.0","10.0"].some(t=>o.includes(t))?"mongosh":"mongo",j=(o=2610,s=[])=>new Promise(t=>{const n=["--port",o,"--dbpath",f(`./.joystick/data/mongodb_${o}`),"--quiet","--replSet",`joystick_${o}`];i.spawn("mongod",n.filter(a=>!!a)).stdout.on("data",async a=>{if((a?.toString()).includes("Waiting for connections")){const m=x(s);i.exec(`${m} --eval "rs.initiate()" --verbose --port ${o}`,async(e,S,r)=>{if(e||r)console.warn(e||r);else{const _=await
|
|
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"})},v=async()=>{if(process.platform==="win32"){const o=await d();return o&&o.length>0}return l("mongod")},d=async()=>await b("C:\\Program Files\\MongoDB\\Server\\"),x=(o=[])=>process.platform==="win32"&&["6.0","7.0","8.0","9.0","10.0"].some(t=>o.includes(t))?"mongosh":"mongo",j=(o=2610,s=[])=>new Promise(t=>{const n=["--port",o,"--dbpath",f(`./.joystick/data/mongodb_${o}`),"--quiet","--replSet",`joystick_${o}`];i.spawn("mongod",n.filter(a=>!!a)).stdout.on("data",async a=>{if((a?.toString()).includes("Waiting for connections")){const m=x(s);i.exec(`${m} --eval "rs.initiate()" --verbose --port ${o}`,async(e,S,r)=>{if(e||r)console.warn(e||r);else{const _=await u(o);return t(parseInt(_,10))}})}})}),$=async(o=2610)=>{const s=await c(".joystick/data/mongodb"),t=await c(`.joystick/data/mongodb_${o}`);return s&&!t&&await y(".joystick/data/mongodb",`.joystick/data/mongodb_${o}`),t||await h(`.joystick/data/mongodb_${o}`,{recursive:!0}),t},D=async(o=2610)=>{const s=await v(),t=process.platform==="win32"?await d():null;s||(k(),process.exit(1)),await $(o);try{return await w(o),await j(o,t)}catch(n){console.warn(n),process.exit(1)}};var E=D;export{E as default};
|
package/package.json
CHANGED
|
@@ -100,7 +100,7 @@ const setup_data_directory = async (mongodb_port = 2610) => {
|
|
|
100
100
|
|
|
101
101
|
const start_mongodb = async (mongodb_port = 2610) => {
|
|
102
102
|
const mongodb_exists = await check_if_mongodb_exists();
|
|
103
|
-
const
|
|
103
|
+
const mongodb_windows_versions = process.platform === 'win32' ? await get_mongodb_windows_versions() : null;
|
|
104
104
|
|
|
105
105
|
if (!mongodb_exists) {
|
|
106
106
|
warn_mongodb_not_installed();
|