@@ -20,7 +20,6 @@ export default async function serverlessInitGenerator(host: Tree, options: InitG
20
20
const tasks : GeneratorCallback [ ] = [ ] ;
21
21
22
22
updateGitignore ( host ) ;
23
- addCacheableOperation ( host ) ;
24
23
setupTargetDefaults ( host ) ;
25
24
26
25
if ( ! options . unitTestRunner || options . unitTestRunner === 'jest' ) {
@@ -66,25 +65,6 @@ function updateGitignore(host: Tree) {
66
65
}
67
66
}
68
67
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
-
88
68
function setupTargetDefaults ( tree : Tree ) {
89
69
const nxJson = readNxJson ( tree ) ;
90
70
@@ -103,15 +83,18 @@ function setupTargetDefaults(tree: Tree) {
103
83
nxJson . targetDefaults ??= { } ;
104
84
nxJson . targetDefaults . deploy ??= { } ;
105
85
nxJson . targetDefaults . deploy . inputs ??= [ 'production' , '^production' , 'stage' ] ;
86
+ nxJson . targetDefaults . deploy . cache ??= true ;
106
87
107
88
nxJson . targetDefaults . package ??= { } ;
108
89
nxJson . targetDefaults . package . inputs ??= [ 'production' , '^production' , 'stage' ] ;
90
+ nxJson . targetDefaults . package . cache ??= true ;
109
91
110
92
nxJson . targetDefaults . build ??= { } ;
111
93
nxJson . targetDefaults . build . inputs ??= [ 'production' , '^production' , 'no-sls' , '^no-sls' ] ;
112
94
if ( ! nxJson . targetDefaults . build . inputs . includes ( 'no-sls' ) ) {
113
95
nxJson . targetDefaults . build . inputs . push ( 'no-sls' , '^no-sls' ) ;
114
96
}
97
+ nxJson . targetDefaults . build . cache ??= true ;
115
98
116
99
updateNxJson ( tree , nxJson ) ;
117
100
}
0 commit comments