Skip to content

Commit 36e4e16

Browse files
committed
feat(nf): update schematic
1 parent 2afe44c commit 36e4e16

File tree

7 files changed

+141
-95
lines changed

7 files changed

+141
-95
lines changed

libs/native-federation-core/src/lib/core/build-adapter.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { MappedPath } from '../utils/mapped-paths';
22
export type BuildKind = 'shared-package' | 'shared-mapping' | 'exposed';
33
export interface BuildAdapterOptions {
4-
entryPoint: string;
5-
tsConfigPath?: string;
6-
external: Array<string>;
7-
outfile: string;
8-
mappedPaths: MappedPath[];
9-
packageName?: string;
10-
esm?: boolean;
11-
dev?: boolean;
12-
watch?: boolean;
13-
kind: BuildKind;
4+
entryPoint: string;
5+
tsConfigPath?: string;
6+
external: Array<string>;
7+
outfile: string;
8+
mappedPaths: MappedPath[];
9+
packageName?: string;
10+
esm?: boolean;
11+
dev?: boolean;
12+
watch?: boolean;
13+
kind: BuildKind;
1414
}
1515
export type BuildAdapter = (options: BuildAdapterOptions) => Promise<void>;
1616
export declare function setBuildAdapter(buildAdapter: BuildAdapter): void;

libs/native-federation-core/src/lib/core/build-adapter.js

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { LogLevels } from 'npmlog';
22
export declare const logger: {
3-
error: (msg: any) => void;
4-
warn: (msg: any) => void;
5-
notice: (msg: any) => void;
6-
info: (msg: any) => void;
7-
verbose: (msg: any) => void;
8-
debug: (msg: any) => void;
3+
error: (msg: any) => void;
4+
warn: (msg: any) => void;
5+
notice: (msg: any) => void;
6+
info: (msg: any) => void;
7+
verbose: (msg: any) => void;
8+
debug: (msg: any) => void;
99
};
1010
export declare const setLogLevel: (level: LogLevels | 'debug') => void;

libs/native-federation-core/src/lib/utils/logger.js

Lines changed: 48 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
export interface MappedPath {
2-
key: string;
3-
path: string;
2+
key: string;
3+
path: string;
44
}
55
export interface GetMappedPathsOptions {
6-
rootTsConfigPath: string;
7-
sharedMappings?: string[];
8-
rootPath?: string;
6+
rootTsConfigPath: string;
7+
sharedMappings?: string[];
8+
rootPath?: string;
99
}
10-
export declare function getMappedPaths({ rootTsConfigPath, sharedMappings, rootPath, }: GetMappedPathsOptions): Array<MappedPath>;
10+
export declare function getMappedPaths({
11+
rootTsConfigPath,
12+
sharedMappings,
13+
rootPath,
14+
}: GetMappedPathsOptions): Array<MappedPath>;

libs/native-federation-core/src/lib/utils/mapped-paths.js

Lines changed: 44 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/native-federation/src/schematics/init/schematic.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ function updateWorkspaceConfig(
8383
workspace: any,
8484
workspaceFileName: string
8585
) {
86-
8786
const { projectConfig, projectName, port } = options;
8887

8988
if (!projectConfig?.architect?.build || !projectConfig?.architect?.serve) {
@@ -94,18 +93,20 @@ function updateWorkspaceConfig(
9493

9594
const originalBuild = projectConfig.architect.build;
9695

97-
if (originalBuild.builder !== '@angular-devkit/build-angular:browser-esbuild') {
96+
if (
97+
originalBuild.builder !== '@angular-devkit/build-angular:browser-esbuild'
98+
) {
9899
console.log('Switching project to esbuild ...');
99100
originalBuild.builder = '@angular-devkit/build-angular:browser-esbuild';
100101
}
101102

102103
projectConfig.architect.esbuild = originalBuild;
103-
104-
projectConfig.architect.build = {
104+
105+
projectConfig.architect.build = {
105106
builder: '@angular-architects/native-federation:build',
106-
'options': {
107-
'target': `${projectName}:esbuild:production`
108-
}
107+
options: {
108+
target: `${projectName}:esbuild:production`,
109+
},
109110
};
110111

111112
projectConfig.architect['serve-original'] = projectConfig.architect.serve;
@@ -117,7 +118,7 @@ function updateWorkspaceConfig(
117118
rebuildDelay: 0,
118119
dev: true,
119120
devServerPort: port,
120-
}
121+
},
121122
};
122123

123124
// projectConfig.architect.serve.builder = serveBuilder;
@@ -142,11 +143,12 @@ function normalizeOptions(
142143
}
143144

144145
if (!options.project) {
145-
console.log('Using first configured project as default project: ' + projects[0]);
146+
console.log(
147+
'Using first configured project as default project: ' + projects[0]
148+
);
146149
options.project = projects[0];
147150
}
148151

149-
150152
const projectName = options.project;
151153
const projectConfig = workspace.projects[projectName];
152154

@@ -181,8 +183,7 @@ function normalizeOptions(
181183
function updatePolyfills(tree, polyfills: any) {
182184
if (typeof polyfills === 'string') {
183185
updatePolyfillsFile(tree, polyfills);
184-
}
185-
else {
186+
} else {
186187
updatePolyfillsArray(tree, polyfills);
187188
}
188189
}

0 commit comments

Comments
 (0)