11import { execa } from "execa" ;
22import normalizeUrl from "normalize-url" ;
33import AggregateError from "aggregate-error" ;
4- import getError from "./get-error.js" ;
54import getRegistry from "./get-registry.js" ;
6- import setNpmrcAuth from "./set-npmrc-auth.js" ;
75
86export default async function ( npmrc , pkg , context ) {
97 const {
@@ -18,7 +16,7 @@ export default async function (npmrc, pkg, context) {
1816
1917 if ( normalizeUrl ( registry ) === normalizeUrl ( DEFAULT_NPM_REGISTRY ) ) {
2018 // 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 } ) ;
2220 // const whoamiResult = execa("npm", ["whoami", "--userconfig", npmrc, "--registry", registry], {
2321 // cwd,
2422 // env,
@@ -28,9 +26,9 @@ export default async function (npmrc, pkg, context) {
2826 // whoamiResult.stderr.pipe(stderr, { end: false });
2927 // await whoamiResult;
3028 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 ) => {
3432 if ( line . includes ( "warn This command requires you to be logged in to https://registry.npmjs.org/" ) ) {
3533 throw new AggregateError ( [ new Error ( 'no auth context' ) ] ) ;
3634 }
0 commit comments