@@ -113,6 +113,9 @@ export class Nx extends BaseBuildTool {
113113 }
114114 const target = this . targets . get ( packagePath ) ?. find ( ( t ) => NPM_DEV_SCRIPTS . includes ( t . name ) )
115115 const executor = this . getExecutorFromTarget ( target )
116+ if ( ! executor ) {
117+ return null
118+ }
116119
117120 switch ( executor ) {
118121 case '@nxtensions/astro:dev' :
@@ -227,44 +230,45 @@ export class Nx extends BaseBuildTool {
227230 return [ ]
228231 }
229232
230- /** detect workspace pacakges with the project.json files */
233+ /** detect workspace packages with the project.json files */
231234 private async detectProjectJson ( ) : Promise < WorkspacePackage [ ] > {
232235 const fs = this . project . fs
233236 try {
234- const { workspaceLayout = { appsDir : 'apps' } } = await fs . readJSON < any > (
235- fs . join ( this . project . jsWorkspaceRoot , 'nx.json' ) ,
236- {
237- fail : true ,
238- } ,
239- )
240- // if an apps dir is specified get it.
241- if ( workspaceLayout ?. appsDir ?. length ) {
242- const identifyPkg : identifyPackageFn = async ( { entry, directory, packagePath } ) => {
243- // ignore e2e test applications as there is no need to deploy them
244- if ( entry === 'project.json' && ! packagePath . endsWith ( '-e2e' ) ) {
245- try {
246- // we need to check the project json for application types (we don't care about libraries)
247- const { projectType, name, targets } = await fs . readJSON ( fs . join ( directory , entry ) )
248- if ( projectType === 'application' ) {
249- const targetsWithName = Object . entries ( targets || { } ) . map ( ( [ name , target ] ) => ( { ...target , name } ) )
250- const forcedFramework = await this . detectFramework ( targetsWithName )
251- this . targets . set ( fs . join ( packagePath ) , targetsWithName )
252- return { name, path : fs . join ( packagePath ) , forcedFramework } as WorkspacePackage
253- }
254- } catch {
255- // noop
237+ const { workspaceLayout } = await fs . readJSON < any > ( fs . join ( this . project . jsWorkspaceRoot , 'nx.json' ) , {
238+ fail : true ,
239+ } )
240+ const appDirs = workspaceLayout ?. appsDir ? [ workspaceLayout . appsDir ] : [ 'apps' , 'packages' ]
241+ const identifyPkg : identifyPackageFn = async ( { entry, directory, packagePath } ) => {
242+ // ignore e2e test applications as there is no need to deploy them
243+ if ( entry === 'project.json' && ! packagePath . endsWith ( '-e2e' ) ) {
244+ try {
245+ // we need to check the project json for application types (we don't care about libraries)
246+ const { projectType, name, targets } = await fs . readJSON ( fs . join ( directory , entry ) )
247+ if ( projectType === 'application' ) {
248+ const targetsWithName = Object . entries ( targets || { } ) . map ( ( [ name , target ] ) => ( { ...target , name } ) )
249+ const forcedFramework = await this . detectFramework ( targetsWithName )
250+ this . targets . set ( fs . join ( packagePath ) , targetsWithName )
251+ return { name, path : fs . join ( packagePath ) , forcedFramework } as WorkspacePackage
256252 }
253+ } catch {
254+ // noop
257255 }
258- return null
259256 }
260-
261- return findPackages (
262- this . project ,
263- workspaceLayout . appsDir ,
264- identifyPkg ,
265- '*' , // only check for one level
266- )
257+ return null
267258 }
259+
260+ const pkgs = await Promise . all (
261+ appDirs . map ( async ( appDir ) =>
262+ findPackages (
263+ this . project ,
264+ appDir ,
265+ identifyPkg ,
266+ '*' , // only check for one level
267+ ) . catch ( ( ) => [ ] ) ,
268+ ) ,
269+ )
270+
271+ return pkgs . flat ( )
268272 } catch {
269273 // noop
270274 }
0 commit comments