From 9b204f9afcfa7656ef88e81419aedf97b79aa6a5 Mon Sep 17 00:00:00 2001 From: Olivier Combe Date: Mon, 5 Feb 2024 17:18:12 +0100 Subject: [PATCH] fix: app build returned result --- .../angular-app-type/angular-build-result.ts | 9 -------- .../angular-app-type/angular.application.ts | 23 ++++++++++++------- 2 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 angular/app-types/angular-app-type/angular-build-result.ts diff --git a/angular/app-types/angular-app-type/angular-build-result.ts b/angular/app-types/angular-app-type/angular-build-result.ts deleted file mode 100644 index 96f88879..00000000 --- a/angular/app-types/angular-app-type/angular-build-result.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { AppBuildResult } from '@teambit/application'; - -export type AngularAppBuildResult = { - /** - * the directory which includes the built application public assets. - * when using ssr, public dir is undefined. - */ - publicDir?: string; -} & AppBuildResult; diff --git a/angular/app-types/angular-app-type/angular.application.ts b/angular/app-types/angular-app-type/angular.application.ts index a2ba4b8a..844227ee 100644 --- a/angular/app-types/angular-app-type/angular.application.ts +++ b/angular/app-types/angular-app-type/angular.application.ts @@ -8,6 +8,7 @@ import { import { AngularPreview } from '@bitdev/angular.dev-services.preview.preview'; import { AppBuildContext, + AppBuildResult, AppContext, Application, ApplicationInstance, @@ -28,7 +29,6 @@ import objectHash from 'object-hash'; import { join } from 'path'; import { readConfigFile, sys } from 'typescript'; import { AngularAppOptions } from './angular-app-options'; -import { AngularAppBuildResult } from './angular-build-result'; import { buildApplication } from './application.bundler'; import { serveApplication } from './application.dev-server'; import { expandIncludeExclude, JsonObject } from './utils'; @@ -103,7 +103,7 @@ export class AngularApp implements Application { angularServeOptions, angularBuildOptions, ngEnvOptions: this.options.ngEnvOptions, - sourceRoot: this.options.sourceRoot, + sourceRoot: this.options.sourceRoot }); } @@ -154,9 +154,9 @@ export class AngularApp implements Application { // const vite = await loadEsmModule('vite'); // const dotenv = vite.loadEnv(mode, rootDir); return { - ...overrides, + ...overrides // ...dotenv - } + }; } // TODO: fix return type once bit has a new stable version @@ -208,7 +208,7 @@ export class AngularApp implements Application { }; } - async build(context: AppBuildContext): Promise { + async build(context: AppBuildContext): Promise { const { capsule } = context; const depsResolver = context.getAspect(DependencyResolverAspect.id); assert(depsResolver, 'Dependency resolver is not defined'); @@ -236,8 +236,8 @@ export class AngularApp implements Application { tempFolder: tempFolder, entryServer, envVars: { - 'process.env': envVars - } + 'process.env': envVars + } }); } else { let bundler: Bundler; @@ -253,7 +253,14 @@ export class AngularApp implements Application { await bundler.run(); } return { - publicDir: outputPath + artifacts: [{ + name: this.name, + globPatterns: [outputPath], + }], + metadata: { + publicDir: appOptions.ssr ? join(outputPath, 'browser') : outputPath, + ssrPublicDir: appOptions.ssr ? join(outputPath, 'server') : undefined + } }; }