@@ -76,3 +76,38 @@ t.test('doesnt set templateVersion on own repo', async (t) => {
7676 } )
7777 t . equal ( JSON . parse ( contents ) . templateVersion , undefined , 'did not get template version' )
7878} )
79+
80+ t . test ( 'only sets templateVersion on root pkg when configured' , async ( t ) => {
81+ const pkgWithWorkspaces = {
82+ 'package.json' : JSON . stringify ( {
83+ name : 'testpkg' ,
84+ templateOSS : {
85+ applyRootRepoFiles : false ,
86+ applyWorkspaceRepoFiles : true ,
87+ applyRootModuleFiles : false ,
88+
89+ workspaces : [ 'amazinga' ] ,
90+ } ,
91+ } ) ,
92+ workspace : {
93+ a : {
94+ 'package.json' : JSON . stringify ( {
95+ name : 'amazinga' ,
96+ } ) ,
97+ } ,
98+ } ,
99+ }
100+ const root = t . testdir ( pkgWithWorkspaces )
101+ await patchPackage ( root , root , {
102+ applyRootRepoFiles : false ,
103+ applyWorkspaceRepoFiles : true ,
104+ applyRootModuleFiles : false ,
105+ } )
106+
107+ const contents = JSON . parse ( await fs . readFile ( join ( root , 'package.json' ) , {
108+ encoding : 'utf8' ,
109+ } ) )
110+
111+ t . not ( contents . templateVersion , undefined , 'should set templateVersion' )
112+ t . equal ( contents . author , undefined , 'should not set other fields' )
113+ } )
0 commit comments