Skip to content

Commit

Permalink
fix(capacitor): align default web-dir for esbuild executor
Browse files Browse the repository at this point in the history
Closes #1150
  • Loading branch information
pawel-twardziak committed Nov 3, 2024
1 parent ec70a9f commit 2516059
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
addProjectConfiguration,
joinPathFragments,
normalizePath,
readJson,
readProjectConfiguration,
Expand Down Expand Up @@ -32,6 +33,12 @@ describe('capacitor-project', () => {
addProjectConfiguration(appTree, options.project, {
root: projectRoot,
targets: {
build: {
executor: '',
options: {
outputPath: joinPathFragments('dist', projectRoot),
},
},
test: {
executor: '@nx/jest:jest',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,27 @@ export function normalizeOptions(
options: CapacitorConfigurationSchema
): NormalizedSchema {
const appName = options.appName ? options.appName : options.project;
const { root } = readProjectConfiguration(host, options.project);
const {
root,
targets: {
build: {
executor,
options: { outputPath, browser },
},
},
} = readProjectConfiguration(host, options.project);

const esbuildBrowser =
[
'@angular-devkit/build-angular:application',
'@nx/angular:application',
'@angular-devkit/build-angular:browser-esbuild',
'@nx/angular:browser-esbuild',
].includes(executor) && browser;

const webDir = options.webDir
? options.webDir
: joinPathFragments(`dist/${root}`);
: joinPathFragments(`${outputPath}${esbuildBrowser ? '/browser' : ''}`);

return {
...options,
Expand Down

0 comments on commit 2516059

Please sign in to comment.