From 48365b3f7508200f1255ccba08bb8866ce99c28c Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Fri, 23 Feb 2024 23:58:23 +0100 Subject: [PATCH 1/2] feat: ignore empty lines --- packages/usersplit/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/usersplit/index.ts b/packages/usersplit/index.ts index 9ba96ce..09becc2 100644 --- a/packages/usersplit/index.ts +++ b/packages/usersplit/index.ts @@ -45,6 +45,9 @@ async function main({ }); for (const line of lines) { + if (!line) { + continue; + } const [group, admin, username, password] = line.split(' '); let dbAdmin = await prisma.admin.findUnique({ where: { From e0f455dd76cd76c97a8f22b281c0239c1bfbd64e Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sat, 24 Feb 2024 15:13:32 +0100 Subject: [PATCH 2/2] feat: trim superadmin password --- packages/usersplit/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/usersplit/index.ts b/packages/usersplit/index.ts index 09becc2..81f1f1f 100644 --- a/packages/usersplit/index.ts +++ b/packages/usersplit/index.ts @@ -16,7 +16,7 @@ async function main({ outputFile: string; superadminFile: string; }) { - const superadminPassword = fs.readFileSync(path.join(__dirname, superadminFile), 'utf8'); + const superadminPassword = fs.readFileSync(path.join(__dirname, superadminFile), 'utf8').trim(); const lines = fs.readFileSync(path.join(__dirname, usersFile), 'utf8').split('\n'); const passwords = fs.readFileSync(path.join(__dirname, passwordsFile), 'utf8').split('\n');