@@ -8,6 +8,7 @@ import { JfrogCredentials } from './jfrog-credentials';
88import { Version } from './version' ;
99import { getJfrogUrl } from './configuration' ;
1010import { NpmPackage } from './types' ;
11+ import { existsSync } from 'node:fs' ;
1112
1213interface PackageJson {
1314 author : string ;
@@ -56,6 +57,9 @@ export class NxProject {
5657 this . isPublishable = true ;
5758 }
5859 } else {
60+ console . log ( `Path to app package.json ${ this . getPackageJsonPathInSource ( ) } ` ) ;
61+ this . hasPackageJson = existsSync ( this . getPackageJsonPathInSource ( ) ) ;
62+ console . log ( `App package.json exists ${ this . hasPackageJson } ` ) ;
5963 this . isPublishable = true ;
6064 }
6165 }
@@ -262,14 +266,22 @@ export class NxProject {
262266 console . log ( 'wrote .npmrc to: ' + npmrcPathInDist ) ;
263267 }
264268
269+ private getPackageJsonPath ( ) : string {
270+ let packageJsonPath = this . getPackageJsonPathInDist ( ) ;
271+ if ( ! existsSync ( packageJsonPath ) ) {
272+ packageJsonPath = this . getPackageJsonPathInSource ( ) ;
273+ }
274+ return packageJsonPath ;
275+ }
276+
265277 public setVersionOrGeneratePackageJsonInDist (
266278 version : Version ,
267279 registry : string
268280 ) {
269281 if ( this . hasPackageJson ) {
270282 try {
271283 this . packageJsonContent = JSON . parse (
272- fs . readFileSync ( this . getPackageJsonPathInDist ( ) ) . toString ( )
284+ fs . readFileSync ( this . getPackageJsonPath ( ) ) . toString ( )
273285 ) ;
274286 this . packageJsonContent . author = 'squad-fe' ;
275287 this . packageJsonContent . version = version . toString ( ) ;
0 commit comments