diff --git a/scripts/run-registry.ts b/scripts/run-registry.ts index 33e032ec594b..380cd943f93a 100755 --- a/scripts/run-registry.ts +++ b/scripts/run-registry.ts @@ -119,13 +119,47 @@ const publish = async (packages: { name: string; location: string }[], url: stri const addUser = (url: string) => new Promise(async (res, rej) => { + const username = 'username'; + const password = 'password'; + const email = 'user@example.com'; + logger.log(`👤 add temp user to verdaccio`); try { - await execaCommand( - `npx npm-cli-adduser -r ${url} -a -u user -p password -e user@example.com` - ); - res(); + const npmExec = execa(`npm add user --registry ${url}`, { shell: true }); + + function checkStep(step: number, count: number) { + if (count > step) { + process.exit(1); + } + } + + let count = 0; + + npmExec.stdout.on('data', (data) => { + const str = data.toString(); + process.stdout.write(str); + if (str.match(/username/i)) { + checkStep(0, count); + process.stdout.write(`${username}\n`); + npmExec.stdin.write(username + '\n'); + } else if (str.match(/password/i)) { + checkStep(1, count); + process.stdout.write('\n'); + npmExec.stdin.write(password + '\n'); + } else if (str.match(/email/i)) { + checkStep(2, count); + process.stdout.write(`${email}\n`); + npmExec.stdin.write(email + '\n'); + npmExec.stdin.end(); + } else if (str.match(/.*err.*/i)) { + npmExec.stdin.end(); + } + count++; + }); + npmExec.on('exit', () => { + res(); + }); } catch (e) { rej(e); }