@@ -2,6 +2,7 @@ import { Octokit } from "@octokit/core";
22import dotenv from "dotenv" ;
33import log from "loglevel" ;
44import { join } from "path" ;
5+ import prompts from "prompts" ;
56
67import { changelogData } from "./changelogData" ;
78import { clean } from "./clean" ;
@@ -13,6 +14,7 @@ import {
1314 replaceTag ,
1415 run ,
1516 uncommittedFiles ,
17+ updateRmdMajorVersion ,
1618 verify ,
1719} from "./utils" ;
1820import { initBlog } from "./utils/initBlog" ;
@@ -66,6 +68,16 @@ async function continueOrRollback(autoConfirm: boolean): Promise<void> {
6668 log . info ( ) ;
6769}
6870
71+ async function getOneTimePassword ( ) : Promise < string > {
72+ const { otp } = await prompts ( {
73+ type : "text" ,
74+ name : "otp" ,
75+ message : "Enter the one time password required to publishing to npm" ,
76+ } ) ;
77+
78+ return otp ;
79+ }
80+
6981interface Options {
7082 clean : boolean ;
7183 type : ReleaseType ;
@@ -139,6 +151,8 @@ A token can be created at:
139151 await continueOrRollback ( autoYes ) ;
140152 }
141153
154+ const version = await updateRmdMajorVersion ( ) ;
155+
142156 git ( "add -u" ) ;
143157 await replaceTag ( ) ;
144158
@@ -147,7 +161,9 @@ A token can be created at:
147161 distTag = " --dist-tag next" ;
148162 }
149163
150- run ( `npx lerna publish from-package${ distTag } ${ yes } ` ) ;
164+ const otp = await getOneTimePassword ( ) ;
165+
166+ run ( `npx lerna publish from-package${ distTag } ${ yes } --otp=${ otp } ` ) ;
151167 await continueOrRollback ( autoYes ) ;
152168
153169 if ( ! prerelease ) {
@@ -167,7 +183,6 @@ A token can be created at:
167183${ percentChanged }
168184\`\`\`
169185` ;
170- const version = await getLernaVersion ( ) ;
171186 const octokit = new Octokit ( { auth : GITHUB_TOKEN } ) ;
172187 const response = await octokit . request (
173188 "POST /repos/{owner}/{repo}/releases" ,
0 commit comments