1
1
import { execa } from "execa" ;
2
2
import normalizeUrl from "normalize-url" ;
3
3
import AggregateError from "aggregate-error" ;
4
- import getError from "./get-error.js" ;
5
4
import getRegistry from "./get-registry.js" ;
6
- import setNpmrcAuth from "./set-npmrc-auth.js" ;
7
5
8
6
export default async function ( npmrc , pkg , context ) {
9
7
const {
@@ -18,7 +16,7 @@ export default async function (npmrc, pkg, context) {
18
16
19
17
if ( normalizeUrl ( registry ) === normalizeUrl ( DEFAULT_NPM_REGISTRY ) ) {
20
18
// try {
21
- const publishDryRunResult = execa ( "npm" , [ "publish" , "--dry-run" , "--tag=semantic-release-auth-check" ] , { cwd, env, preferLocal : true } ) ;
19
+ const publishDryRunResult = execa ( "npm" , [ "publish" , "--dry-run" , "--tag=semantic-release-auth-check" ] , { cwd, env, preferLocal : true , lines : true } ) ;
22
20
// const whoamiResult = execa("npm", ["whoami", "--userconfig", npmrc, "--registry", registry], {
23
21
// cwd,
24
22
// env,
@@ -28,9 +26,9 @@ export default async function (npmrc, pkg, context) {
28
26
// whoamiResult.stderr.pipe(stderr, { end: false });
29
27
// await whoamiResult;
30
28
publishDryRunResult . stdout . pipe ( stdout , { end : false } ) ;
31
- publishDryRunResult . stderr . pipe ( stderr , { end : false , lines : true } ) ;
32
- const { stdout} = await publishDryRunResult ;
33
- stdout . forEach ( ( line ) => {
29
+ publishDryRunResult . stderr . pipe ( stderr , { end : false } ) ;
30
+ const { stdout : execaStdout } = await publishDryRunResult ;
31
+ execaStdout . forEach ( ( line ) => {
34
32
if ( line . includes ( "warn This command requires you to be logged in to https://registry.npmjs.org/" ) ) {
35
33
throw new AggregateError ( [ new Error ( 'no auth context' ) ] ) ;
36
34
}
0 commit comments