diff --git a/angular/app-types/angular-app-type/angular-app-options.ts b/angular/app-types/angular-app-type/angular-app-options.ts index 96c8fb6..f453037 100644 --- a/angular/app-types/angular-app-type/angular-app-options.ts +++ b/angular/app-types/angular-app-type/angular-app-options.ts @@ -4,9 +4,9 @@ import { BrowserOptions, DevServerOptions } from '@bitdev/angular.dev-services.common'; +import { AppDeployContext } from '@teambit/application'; import { Bundler } from '@teambit/bundler'; import { WebpackConfigTransformer } from '@teambit/webpack'; -import { AngularDeployContext } from './deploy-context'; export type AngularAppOptions = { /** @@ -37,7 +37,7 @@ export type AngularAppOptions = { /** * Deploy function. */ - deploy?: (context: AngularDeployContext) => Promise; + deploy?: (context: AppDeployContext) => Promise; /** * Ranges of ports to use to run the app server. 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 96f8887..0000000 --- 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 a2ba4b8..844227e 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 + } }; } diff --git a/angular/app-types/angular-app-type/deploy-context.ts b/angular/app-types/angular-app-type/deploy-context.ts deleted file mode 100644 index 4fb15ab..0000000 --- a/angular/app-types/angular-app-type/deploy-context.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { AppDeployContext } from '@teambit/application'; -import { AngularAppBuildResult } from './angular-build-result'; - -export type AngularDeployContext = AngularAppBuildResult & AppDeployContext;