@@ -20,7 +20,6 @@ export default async function serverlessInitGenerator(host: Tree, options: InitG
2020 const tasks : GeneratorCallback [ ] = [ ] ;
2121
2222 updateGitignore ( host ) ;
23- addCacheableOperation ( host ) ;
2423 setupTargetDefaults ( host ) ;
2524
2625 if ( ! options . unitTestRunner || options . unitTestRunner === 'jest' ) {
@@ -66,25 +65,6 @@ function updateGitignore(host: Tree) {
6665 }
6766}
6867
69- function addCacheableOperation ( tree : Tree ) {
70- const nxJson = readNxJson ( tree ) ;
71- if ( ! nxJson . tasksRunnerOptions || ! nxJson . tasksRunnerOptions . default ) {
72- return ;
73- }
74-
75- nxJson . tasksRunnerOptions . default . options ??= { } ;
76- nxJson . tasksRunnerOptions . default . options . cacheableOperations ??= [ ] ;
77-
78- if ( ! nxJson . tasksRunnerOptions . default . options . cacheableOperations . includes ( 'package' ) ) {
79- nxJson . tasksRunnerOptions . default . options . cacheableOperations . push ( 'package' ) ;
80- }
81- if ( ! nxJson . tasksRunnerOptions . default . options . cacheableOperations . includes ( 'deploy' ) ) {
82- nxJson . tasksRunnerOptions . default . options . cacheableOperations . push ( 'deploy' ) ;
83- }
84-
85- updateNxJson ( tree , nxJson ) ;
86- }
87-
8868function setupTargetDefaults ( tree : Tree ) {
8969 const nxJson = readNxJson ( tree ) ;
9070
@@ -103,15 +83,18 @@ function setupTargetDefaults(tree: Tree) {
10383 nxJson . targetDefaults ??= { } ;
10484 nxJson . targetDefaults . deploy ??= { } ;
10585 nxJson . targetDefaults . deploy . inputs ??= [ 'production' , '^production' , 'stage' ] ;
86+ nxJson . targetDefaults . deploy . cache ??= true ;
10687
10788 nxJson . targetDefaults . package ??= { } ;
10889 nxJson . targetDefaults . package . inputs ??= [ 'production' , '^production' , 'stage' ] ;
90+ nxJson . targetDefaults . package . cache ??= true ;
10991
11092 nxJson . targetDefaults . build ??= { } ;
11193 nxJson . targetDefaults . build . inputs ??= [ 'production' , '^production' , 'no-sls' , '^no-sls' ] ;
11294 if ( ! nxJson . targetDefaults . build . inputs . includes ( 'no-sls' ) ) {
11395 nxJson . targetDefaults . build . inputs . push ( 'no-sls' , '^no-sls' ) ;
11496 }
97+ nxJson . targetDefaults . build . cache ??= true ;
11598
11699 updateNxJson ( tree , nxJson ) ;
117100}
0 commit comments