@@ -131,14 +131,22 @@ export async function getPackagePublicationStatus(
131131) : Promise < PackageStatus > {
132132 const info = await packageVersionExistsInRegistry ( data ) ;
133133
134- printChangelogStatus ( data , info ) ;
135-
136134 const hasChanges = info . hasChangesSinceLastVersion ;
137135
138136 if ( hasChanges != null && hasChanges ) {
139137 // the module code has changed since the current published version
140138 // We need to print this version.
141- console . log ( chalk . bold . underline ( data . name ) ) ;
139+ const name = chalk . bold . underline ( data . name ) ;
140+ const version = chalk . bold ( "v" + data . version ) ;
141+
142+ if ( info . canPublish ) {
143+ console . log ( chalk . greenBright ( `${ name } ${ version } will be published` ) ) ;
144+ } else {
145+ console . log ( chalk . yellowBright ( `${ name } has changes since ${ version } ` ) ) ;
146+ }
147+
148+ printChangelogStatus ( data , info ) ;
149+
142150 printChangeInfoForPublishedPackage (
143151 { name : data . name , version : info . lastVersion } ,
144152 true ,
@@ -178,26 +186,6 @@ async function packageVersionExistsInRegistry(pkg): Promise<PackageStatus> {
178186 // Show last version
179187 const lastVersion : string | null =
180188 info . versions [ info . versions . length - 1 ] ?? null ;
181- if ( canPublish ) {
182- msg += " will be published" ;
183- console . log ( chalk . greenBright ( msg ) ) ;
184- } else if ( incomplete ) {
185- msg += " has changes" ;
186- console . log ( chalk . yellowBright ( msg ) ) ;
187- }
188-
189- if ( printCurrentVersions ) {
190- if ( currentVersionExistsInRegistry ) {
191- // Print the publication date for the version
192- const time = getNiceTimeSincePublished ( info , pkg . version ) ;
193- msg += ` was published ${ time } ` ;
194- console . log ( chalk . blueBright ( msg ) ) ;
195- console . log ( ) ;
196- } else if ( lastVersion != null ) {
197- const time = getNiceTimeSincePublished ( info , lastVersion ) ;
198- console . log ( chalk . dim ( ` v${ lastVersion } was published ${ time } ` ) ) ;
199- }
200- }
201189
202190 let hasChanges : boolean | null = null ;
203191 if ( lastVersion != null ) {
@@ -278,27 +266,25 @@ function fetchTagIfNotExistsLocally(pkg) {
278266
279267function printChangeInfoForPublishedPackage ( pkg , showChanges = false ) {
280268 const cmd = buildModuleDiffCommand ( pkg ) ;
281- console . log ( `Changes since v${ pkg . version } ` ) ;
282269
283270 if ( showChanges ) {
271+ console . log ( chalk . italic ( "Summary:" ) ) ;
284272 const cmd = buildModuleDiffCommand ( pkg , "--stat --color" ) ;
285273 const res = execSync ( cmd ) . toString ( ) ;
286274 console . log ( chalk . dim ( res ) ) ;
287275 }
288276
289- console . log ( "Run the following command to see detailed changes:" ) ;
290- console . log ( chalk . dim ( cmd ) ) ;
277+ console . log ( chalk . italic ( "Detailed changes:\n" ) + chalk . dim ( cmd ) ) ;
291278
292279 // Check if is synced with the remote
293280 // TODO: this only works if the current branch is pushed to the remote
294- console . log ( "or view the changes in GitHub:" ) ;
295281 const repoUrl = "https://github.com/UW-Macrostrat/web-components" ;
296282 const tag = moduleString ( pkg , "-v" ) ;
297283 // Get head commit hash
298284 const headCommit = execSync ( "git rev-parse HEAD" ) . toString ( ) . trim ( ) ;
299285 const url = `${ repoUrl } /compare/${ tag } ...${ headCommit } ` ;
300- console . log ( chalk . dim ( url ) ) ;
301- console . log ( "" ) ;
286+ console . log ( chalk . italic ( "GitHub link:\n" ) + chalk . dim ( url ) ) ;
287+ console . log ( "\n " ) ;
302288}
303289
304290/* checks for unstaged changes */
@@ -337,10 +323,10 @@ function printChangelogStatus(pkg: PackageData, info: PackageStatus): void {
337323
338324 const changelog = info . currentVersionChangelogEntry ;
339325 if ( changelog != null ) {
340- console . log ( chalk . green ( `${ CHANGELOG } entry for v ${ pkg . version } :` ) ) ;
326+ console . log ( chalk . green ( `${ CHANGELOG } entry:` ) ) ;
341327 console . log ( changelog + "\n" ) ;
342328 } else {
343- console . log ( chalk . red ( `No ${ CHANGELOG } entry for v ${ pkg . version } ` ) ) ;
329+ console . log ( chalk . red ( `No ${ CHANGELOG } entry` ) ) ;
344330 }
345331}
346332
0 commit comments