Skip to content

Commit c1d6ccc

Browse files
committed
feat(serverless): update generators to use new features
1 parent 697dbf9 commit c1d6ccc

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

packages/nx-serverless/src/generators/application/generator.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ describe('serverless generator', () => {
112112
externalDependencies: 'none',
113113
target: 'node',
114114
compiler: 'tsc',
115-
isolatedConfig: true,
116115
webpackConfig: 'apps/sample/webpack.config.js',
117116
},
118117
configurations: {

packages/nx-serverless/src/generators/application/lib/get-build-base-config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export function getBuildBaseConfig(options: NormalizedOptions): TargetConfigurat
1212
externalDependencies: 'none',
1313
target: 'node',
1414
compiler: 'tsc',
15-
isolatedConfig: true,
1615
webpackConfig: joinPathFragments(options.projectRoot, 'webpack.config.js'),
1716
},
1817
configurations: {

packages/nx-serverless/src/generators/init/generator.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
8868
function 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

Comments
 (0)