mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
install: goodbye, mongosh
This commit is contained in:
1 parent
002af33ed5
commit
0d122bb703
1 file changed
+15
-7
+15
-7
@@ -191,7 +191,7 @@ function removeOptionalEsbuildDeps() {
|
||||
if (!yarnGlobalPath) return false;
|
||||
const pkgjson = `${yarnGlobalPath}/package.json`;
|
||||
const data = existsSync(pkgjson) ? require(pkgjson) : {};
|
||||
data.resolutions = data.resolutions || {};
|
||||
data.resolutions ||= {};
|
||||
Object.assign(data.resolutions, Object.fromEntries([
|
||||
'@esbuild/linux-loong64',
|
||||
'esbuild-windows-32',
|
||||
@@ -326,12 +326,20 @@ connect-timeout = 10`);
|
||||
operations: [
|
||||
'pm2 start mongod',
|
||||
() => sleep(3000),
|
||||
() => writeFileSync(tmpFile, `db.createUser(${JSON.stringify({
|
||||
user: 'hydro',
|
||||
pwd: password,
|
||||
roles: [{ role: 'readWrite', db: 'hydro' }],
|
||||
})})`),
|
||||
[`mongosh 127.0.0.1:27017/hydro ${tmpFile}`, { retry: true }],
|
||||
async () => {
|
||||
// eslint-disable-next-line import/no-absolute-path
|
||||
const { MongoClient } = require('/usr/local/share/.config/yarn/global/node_modules/mongodb');
|
||||
const client = await MongoClient.connect('mongodb://127.0.0.1', {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
readPreference: 'nearest',
|
||||
writeConcern: 'majority',
|
||||
});
|
||||
await client.db('hydro').addUser('hydro', password, {
|
||||
roles: [{ role: 'readWrite', db: 'hydro' }],
|
||||
});
|
||||
await client.close();
|
||||
},
|
||||
() => writeFileSync(`${process.env.HOME}/.hydro/config.json`, JSON.stringify({
|
||||
uri: `mongodb://hydro:${password}@127.0.0.1:27017/hydro`,
|
||||
})),
|
||||
|
||||
Reference in new issue
Block a user