From 1e5e74788450bbcde374cc0abd25c1f10c7283bb Mon Sep 17 00:00:00 2001 From: anihil Date: Sat, 4 May 2024 02:01:46 +0200 Subject: [PATCH 1/5] Fixed: sync-macros clears all *.macros in hackmud directory --- src/syncMacros.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syncMacros.ts b/src/syncMacros.ts index 534b3c9..d1d8720 100644 --- a/src/syncMacros.ts +++ b/src/syncMacros.ts @@ -46,7 +46,7 @@ export async function syncMacros(hackmudPath: string) { } for (const user of users) - writeFile(resolvePath(hackmudPath, `${user}.macros`), macroFile) + await writeFile(resolvePath(hackmudPath, `${user}.macros`), macroFile) return { macrosSynced, usersSynced: users.length } } From fb07d21678bee68d1d824b9278e37c6b9c8ef356 Mon Sep 17 00:00:00 2001 From: anihil Date: Sat, 4 May 2024 02:52:34 +0200 Subject: [PATCH 2/5] Added scripts to package.json. On Windows requires to have GuiBash (MinGW) installed for command 'bash' to work or any other wrapper for 'bash' ex. Cygwin For Windows prerequisites: - NodeJS - PNPM - Git with GitBash --- package.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package.json b/package.json index 91427f1..185a01b 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,13 @@ "golf", "golfer" ], + "scripts": { + "build": "pnpm install", + "package": "bash scripts/package.sh", + "roolup": "bash -c ./rollup.config.js", + "clean": "bash -c 'rm -rf dist' && bash -c 'rm -rf node_modules'", + "hsm": "node dist/bin/hsm.js" + }, "homepage": "https://github.com/samualtnorman/hackmud-script-manager#readme", "bugs": "https://github.com/samualtnorman/hackmud-script-manager/issues", "license": "MIT", From feac84d3027b9fb628276b6af74fcb0951b0872b Mon Sep 17 00:00:00 2001 From: anihil Date: Sat, 4 May 2024 16:25:03 +0200 Subject: [PATCH 3/5] Remove previous changes --- package.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/package.json b/package.json index 185a01b..91427f1 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,6 @@ "golf", "golfer" ], - "scripts": { - "build": "pnpm install", - "package": "bash scripts/package.sh", - "roolup": "bash -c ./rollup.config.js", - "clean": "bash -c 'rm -rf dist' && bash -c 'rm -rf node_modules'", - "hsm": "node dist/bin/hsm.js" - }, "homepage": "https://github.com/samualtnorman/hackmud-script-manager#readme", "bugs": "https://github.com/samualtnorman/hackmud-script-manager/issues", "license": "MIT", From 25471b3de4196bc417d5d3f85fd614986229d041 Mon Sep 17 00:00:00 2001 From: anihil Date: Sat, 4 May 2024 16:32:55 +0200 Subject: [PATCH 4/5] Changed to use Promise.all instead of just awai --- src/syncMacros.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/syncMacros.ts b/src/syncMacros.ts index d1d8720..6dbe03e 100644 --- a/src/syncMacros.ts +++ b/src/syncMacros.ts @@ -45,8 +45,10 @@ export async function syncMacros(hackmudPath: string) { } } - for (const user of users) - await writeFile(resolvePath(hackmudPath, `${user}.macros`), macroFile) + //for (const user of users) + // await writeFile(resolvePath(hackmudPath, `${user}.macros`), macroFile) + + await Promise.all(users.map(async user => writeFile(resolvePath(hackmudPath, `${user}.macros`), macroFile))) return { macrosSynced, usersSynced: users.length } } From 18d5ec977253ab12d51cf5190744cc98e79761f7 Mon Sep 17 00:00:00 2001 From: anihil Date: Sat, 4 May 2024 16:34:16 +0200 Subject: [PATCH 5/5] Remove comment --- src/syncMacros.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/syncMacros.ts b/src/syncMacros.ts index 6dbe03e..69c9649 100644 --- a/src/syncMacros.ts +++ b/src/syncMacros.ts @@ -45,9 +45,6 @@ export async function syncMacros(hackmudPath: string) { } } - //for (const user of users) - // await writeFile(resolvePath(hackmudPath, `${user}.macros`), macroFile) - await Promise.all(users.map(async user => writeFile(resolvePath(hackmudPath, `${user}.macros`), macroFile))) return { macrosSynced, usersSynced: users.length }