@@ -26,39 +26,47 @@ export async function setupWorkspaceDependencies(
2626
2727 const authPackageDir = path . join ( projectDir , "packages/auth" ) ;
2828 if ( await fs . pathExists ( authPackageDir ) ) {
29+ const authDeps : Record < string , string > = { } ;
30+ if ( options . database !== "none" && ( await fs . pathExists ( dbPackageDir ) ) ) {
31+ authDeps [ `@${ projectName } /db` ] = workspaceVersion ;
32+ }
33+
2934 await addPackageDependency ( {
3035 dependencies : commonDeps ,
3136 devDependencies : commonDevDeps ,
32- customDependencies : {
33- [ `@${ projectName } /db` ] : workspaceVersion ,
34- } ,
37+ customDependencies : authDeps ,
3538 projectDir : authPackageDir ,
3639 } ) ;
3740 }
3841
3942 const apiPackageDir = path . join ( projectDir , "packages/api" ) ;
4043 if ( await fs . pathExists ( apiPackageDir ) ) {
44+ const apiDeps : Record < string , string > = { } ;
45+ if ( options . auth !== "none" && ( await fs . pathExists ( authPackageDir ) ) ) {
46+ apiDeps [ `@${ projectName } /auth` ] = workspaceVersion ;
47+ }
48+ if ( options . database !== "none" && ( await fs . pathExists ( dbPackageDir ) ) ) {
49+ apiDeps [ `@${ projectName } /db` ] = workspaceVersion ;
50+ }
51+
4152 await addPackageDependency ( {
4253 dependencies : commonDeps ,
4354 devDependencies : commonDevDeps ,
44- customDependencies : {
45- [ `@${ projectName } /auth` ] : workspaceVersion ,
46- [ `@${ projectName } /db` ] : workspaceVersion ,
47- } ,
55+ customDependencies : apiDeps ,
4856 projectDir : apiPackageDir ,
4957 } ) ;
5058 }
5159
5260 const serverPackageDir = path . join ( projectDir , "apps/server" ) ;
5361 if ( await fs . pathExists ( serverPackageDir ) ) {
5462 const serverDeps : Record < string , string > = { } ;
55- if ( await fs . pathExists ( apiPackageDir ) ) {
63+ if ( options . api !== "none" && ( await fs . pathExists ( apiPackageDir ) ) ) {
5664 serverDeps [ `@${ projectName } /api` ] = workspaceVersion ;
5765 }
58- if ( await fs . pathExists ( authPackageDir ) ) {
66+ if ( options . auth !== "none" && ( await fs . pathExists ( authPackageDir ) ) ) {
5967 serverDeps [ `@${ projectName } /auth` ] = workspaceVersion ;
6068 }
61- if ( await fs . pathExists ( dbPackageDir ) ) {
69+ if ( options . database !== "none" && ( await fs . pathExists ( dbPackageDir ) ) ) {
6270 serverDeps [ `@${ projectName } /db` ] = workspaceVersion ;
6371 }
6472
@@ -74,10 +82,10 @@ export async function setupWorkspaceDependencies(
7482
7583 if ( await fs . pathExists ( webPackageDir ) ) {
7684 const webDeps : Record < string , string > = { } ;
77- if ( await fs . pathExists ( apiPackageDir ) ) {
85+ if ( options . api !== "none" && ( await fs . pathExists ( apiPackageDir ) ) ) {
7886 webDeps [ `@${ projectName } /api` ] = workspaceVersion ;
7987 }
80- if ( await fs . pathExists ( authPackageDir ) ) {
88+ if ( options . auth !== "none" && ( await fs . pathExists ( authPackageDir ) ) ) {
8189 webDeps [ `@${ projectName } /auth` ] = workspaceVersion ;
8290 }
8391
@@ -93,7 +101,7 @@ export async function setupWorkspaceDependencies(
93101
94102 if ( await fs . pathExists ( nativePackageDir ) ) {
95103 const nativeDeps : Record < string , string > = { } ;
96- if ( await fs . pathExists ( apiPackageDir ) ) {
104+ if ( options . api !== "none" && ( await fs . pathExists ( apiPackageDir ) ) ) {
97105 nativeDeps [ `@${ projectName } /api` ] = workspaceVersion ;
98106 }
99107
0 commit comments