Skip to content

Commit 04aea64

Browse files
committed
improve docs preview
1 parent e54a319 commit 04aea64

22 files changed

+241
-91
lines changed

packages/angular-v10/angular-v10.webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class AngularV10Webpack extends AngularWebpack {
108108
sourceMap: optionValue(angularOptions.sourceMap, setup === WebpackSetup.Serve),
109109
outputHashing: optionValue(angularOptions.outputHashing, setup === WebpackSetup.Build ? OutputHashing.All : OutputHashing.None),
110110
watch: setup === WebpackSetup.Serve,
111-
allowedCommonJsDependencies: ['@teambit/harmony', 'graphql', ...(angularOptions.allowedCommonJsDependencies || [])],
111+
allowedCommonJsDependencies: ['@teambit/harmony', 'graphql', '@teambit/documenter.ng.content.copy-box', ...(angularOptions.allowedCommonJsDependencies || [])],
112112
};
113113

114114
const normalizedWorkspaceRoot = normalize(workspaceRoot);

packages/angular-v10/component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"react-dev-utils": "10.2.1",
4141
"remark": "~13.0.0",
4242
"remark-frontmatter": "~3.0.0",
43-
"remark-html": "~13.0.1",
43+
"remark-html": "13.0.1",
4444
"remark-loader": "~2.0.0",
4545
"remark-prism": "~1.3.6",
4646
"rxjs": "^6.6.3",

packages/angular-v11/angular-v11.webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class AngularV11Webpack extends AngularWebpack {
9595
sourceMap: optionValue(angularOptions.sourceMap, setup === WebpackSetup.Serve),
9696
outputHashing: optionValue(angularOptions.outputHashing, setup === WebpackSetup.Build ? OutputHashing.All : OutputHashing.None),
9797
watch: setup === WebpackSetup.Serve,
98-
allowedCommonJsDependencies: ['@teambit/harmony', 'graphql', ...(angularOptions.allowedCommonJsDependencies || [])],
98+
allowedCommonJsDependencies: ['@teambit/harmony', 'graphql', '@teambit/documenter.ng.content.copy-box', ...(angularOptions.allowedCommonJsDependencies || [])],
9999
};
100100

101101
const normalizedWorkspaceRoot = normalize(workspaceRoot);

packages/angular-v11/component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"react-dev-utils": "10.2.1",
3838
"remark": "~13.0.0",
3939
"remark-frontmatter": "~3.0.0",
40-
"remark-html": "~13.0.1",
40+
"remark-html": "13.0.1",
4141
"remark-loader": "~2.0.0",
4242
"remark-prism": "~1.3.6",
4343
"rxjs": "^6.6.3",

packages/angular-v12/angular-v12.webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class AngularV12Webpack extends AngularWebpack {
133133
sourceMap: optionValue(angularOptions.sourceMap, setup === WebpackSetup.Serve),
134134
outputHashing: optionValue(angularOptions.outputHashing, setup === WebpackSetup.Build ? OutputHashing.All : OutputHashing.None),
135135
watch: setup === WebpackSetup.Serve,
136-
allowedCommonJsDependencies: ['@teambit/harmony', 'graphql', ...(angularOptions.allowedCommonJsDependencies || [])],
136+
allowedCommonJsDependencies: ['@teambit/harmony', 'graphql', '@teambit/documenter.ng.content.copy-box', ...(angularOptions.allowedCommonJsDependencies || [])],
137137
};
138138
const normalizedWorkspaceRoot = normalize(workspaceRoot);
139139
const projectRoot = normalize('');

packages/angular-v12/component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"react-dev-utils": "10.2.1",
3737
"remark": "~13.0.0",
3838
"remark-frontmatter": "~3.0.0",
39-
"remark-html": "~13.0.1",
39+
"remark-html": "13.0.1",
4040
"remark-loader": "~4.0.0",
4141
"remark-prism": "~1.3.6",
4242
"rxjs": "^6.6.7",

packages/angular-v8/component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"react-dev-utils": "10.2.1",
4141
"remark": "~13.0.0",
4242
"remark-frontmatter": "~3.0.0",
43-
"remark-html": "~13.0.1",
43+
"remark-html": "13.0.1",
4444
"remark-loader": "~2.0.0",
4545
"remark-prism": "~1.3.6",
4646
"rxjs": "~6.4.0",

packages/angular-v9/component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"react-dev-utils": "10.2.1",
4141
"remark": "~13.0.0",
4242
"remark-frontmatter": "~3.0.0",
43-
"remark-html": "~13.0.1",
43+
"remark-html": "13.0.1",
4444
"remark-loader": "~2.0.0",
4545
"remark-prism": "~1.3.6",
4646
"rxjs": "^6.6.3",

packages/angular/angular.webpack.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Schema as BrowserBuilderSchema } from '@angular-devkit/build-angular/src/browser/schema';
22
import { Bundler, BundlerContext, DevServer, DevServerContext, Target } from '@teambit/bundler';
33
import { CACHE_ROOT } from '@teambit/legacy/dist/constants';
4+
import { ComponentID } from '@teambit/component';
45
import { PkgMain } from '@teambit/pkg';
56
import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';
67
import { Logger } from '@teambit/logger';
@@ -21,8 +22,7 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs-extra';
2122
import objectHash from 'object-hash';
2223
import { join, posix, resolve } from 'path';
2324
import { readConfigFile, sys } from 'typescript';
24-
import webpack, { Configuration } from 'webpack';
25-
import WsDevServer from 'webpack-dev-server';
25+
import { Configuration } from 'webpack';
2626

2727
export enum WebpackSetup {
2828
Serve = 'serve',
@@ -152,8 +152,16 @@ export abstract class AngularWebpack {
152152
}
153153

154154
async createDevServer(context: DevServerContext, transformers: WebpackConfigTransformer[] = []): Promise<DevServer> {
155-
// TODO(ocombe) find a better way to get the preview root path
156-
const rootPath = resolve(require.resolve('@teambit/angular'), '../../preview/');
155+
let rootPath: string;
156+
try {
157+
rootPath = this.workspace?.componentDir(ComponentID.fromString('teambit.angular/angular'), {
158+
ignoreScopeAndVersion: true,
159+
ignoreVersion: true
160+
}, { relative: false }) || '';
161+
rootPath = join(rootPath, 'preview');
162+
} catch(e) {
163+
rootPath = resolve(require.resolve('@teambit/angular'), '../../preview/');
164+
}
157165
const tsconfigPath = this.writeTsconfig(context, rootPath);
158166

159167
const defaultConfig: any = await this.getWebpackConfig(

packages/angular/preview/src/app/app.component.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)