8000 move addUser · avdim/github-script@2c26a29 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2c26a29

Browse files
committed
move addUser
1 parent 4fd36b8 commit 2c26a29

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

__test__/npm-api.test.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as fs from "fs";
22
import * as path from "path";
33
import {GenericContainer, StartedTestContainer} from "testcontainers";
4+
import {addUser} from "../src/npm-api";
45

56
const RegClient = require('npm-registry-client');
67

@@ -56,26 +57,6 @@ function testSkip(name: string, lambda: any) {
5657

5758
}
5859

59-
async function addUser(registryUrl: string, auth: any): Promise<unknown> {
60-
return await new Promise((resolve: (value?: unknown) => void, reject: (reason?: any) => void) => {
61-
const regClient = new RegClient();
62-
regClient.adduser(
63-
registryUrl,
64-
{
65-
auth: auth
66-
},
67-
(err: any, data: any) => {
68-
if (err) {
69-
console.log("err: ", err)
70-
reject(err)
71-
} else {
72-
resolve(data)
73-
}
74-
}
75-
)
76-
});
77-
}
78-
7960
async function publishAsync(registryUrl: string, tgzPath: string, moduleName: string, auth: any): Promise<unknown> {
8061
return await new Promise((resolve: (value?: unknown) => void, reject: (reason?: any) => void) => {
8162
const regClient = new RegClient();

src/npm-api.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const RegClient = require('npm-registry-client');
2+
3+
export async function addUser(registryUrl: string, auth: any): Promise<unknown> {
4+
return await new Promise((resolve: (value?: unknown) => void, reject: (reason?: any) => void) => {
5+
const regClient = new RegClient();
6+
regClient.adduser(
7+
registryUrl,
8+
{
9+
auth: auth
10+
},
11+
(err: any, data: any) => {
12+
if (err) {
13+
console.log("err: ", err)
14+
reject(err)
15+
} else {
16+
resolve(data)
17+
}
18+
}
19+
)
20+
});
21+
}

0 commit comments

Comments
 (0)
0