Skip to content

Commit 94339c5

Browse files
committed
fix: exit process on error
1 parent 9001e9f commit 94339c5

File tree

6 files changed

+74
-82
lines changed

6 files changed

+74
-82
lines changed

libs/native-federation-core/src/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export {
1111
BuildAdapterOptions,
1212
BuildResult,
1313
BuildKind,
14-
EntryPoint
14+
EntryPoint,
1515
} from './lib/core/build-adapter';
1616
export { withNativeFederation } from './lib/config/with-native-federation';
1717
export { buildForFederation } from './lib/core/build-for-federation';

libs/native-federation/docs/share-faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ The skip list can contain a RegExp for excluding several entry points starting w
5050

5151
```typescript
5252
skip: [
53-
'this-package', // string-based entry
54-
'that-package', // another string-based one
55-
/^my-package/ // RegExp
56-
]
53+
'this-package', // string-based entry
54+
'that-package', // another string-based one
55+
/^my-package/, // RegExp
56+
];
5757
```

libs/native-federation/src/builders/build/builder.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ export async function* runBuilder(
228228

229229
try {
230230
await buildForFederation(config, fedOptions, externals);
231-
}
232-
catch(e) {
231+
} catch (e) {
233232
process.exit(1);
234233
}
235234

libs/native-federation/src/plugin/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ const configureDevServer = async (
6060
server.middlewares.use(serveFromDist(dist, fedInfo));
6161
};
6262

63-
const serveFromDist = (
64-
dist: string,
65-
fedInfoRef: FedInfoRef
66-
) => {
63+
const serveFromDist = (dist: string, fedInfoRef: FedInfoRef) => {
6764
const fedFiles = new Set([
6865
...fedInfoRef.federationInfo.shared.map((s) =>
6966
path.join('/', s.outFileName)

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

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
1414
import { strings } from '@angular-devkit/core';
1515
import { MfSchematicSchema } from './schema';
1616

17-
import { patchAngularBuildPackageJson, privateEntrySrc } from '../../utils/patch-angular-build';
17+
import {
18+
patchAngularBuildPackageJson,
19+
privateEntrySrc,
20+
} from '../../utils/patch-angular-build';
1821

1922
import {
2023
addPackageJsonDependency,
@@ -45,16 +48,16 @@ export function updatePackageJson(tree: Tree): void {
4548
}
4649

4750
let postInstall = (packageJson['scripts']?.['postinstall'] || '') as string;
48-
51+
4952
if (!postInstall) {
5053
return;
5154
}
52-
55+
5356
if (postInstall.includes(scriptCall)) {
5457
postInstall = postInstall.replace(scriptCall, '');
5558
}
5659
if (postInstall.endsWith(' && ')) {
57-
postInstall = postInstall.substring(0, postInstall.length-4)
60+
postInstall = postInstall.substring(0, postInstall.length - 4);
5861
}
5962

6063
packageJson['scripts']['postinstall'] = postInstall;
@@ -125,19 +128,10 @@ export function patchAngularBuild(tree) {
125128
return;
126129
}
127130

128-
const packageJson = JSON.parse(
129-
tree.read(packagePath)
130-
);
131+
const packageJson = JSON.parse(tree.read(packagePath));
131132
patchAngularBuildPackageJson(packageJson);
132-
tree.overwrite(
133-
packagePath,
134-
JSON.stringify(packageJson, null, 2)
135-
);
136-
tree.overwrite(
137-
privatePath,
138-
privateEntrySrc
139-
);
140-
133+
tree.overwrite(packagePath, JSON.stringify(packageJson, null, 2));
134+
tree.overwrite(privatePath, privateEntrySrc);
141135
}
142136

143137
function updateWorkspaceConfig(

libs/native-federation/src/utils/create-compiler-options.ts

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,67 @@
22
// Currently, this type cannot be accessed from the outside
33

44
export function createCompilerPluginOptions(
5-
options: any,
6-
target: string[],
7-
sourceFileCache?: any,
8-
): {
9-
pluginOptions: any[0];
10-
styleOptions: any[1];
11-
} {
12-
const {
13-
workspaceRoot,
14-
optimizationOptions,
15-
sourcemapOptions,
5+
options: any,
6+
target: string[],
7+
sourceFileCache?: any
8+
): {
9+
pluginOptions: any[0];
10+
styleOptions: any[1];
11+
} {
12+
const {
13+
workspaceRoot,
14+
optimizationOptions,
15+
sourcemapOptions,
16+
tsconfig,
17+
outputNames,
18+
fileReplacements,
19+
externalDependencies,
20+
preserveSymlinks,
21+
stylePreprocessorOptions,
22+
advancedOptimizations,
23+
inlineStyleLanguage,
24+
jit,
25+
cacheOptions,
26+
tailwindConfiguration,
27+
postcssConfiguration,
28+
publicPath,
29+
} = options;
30+
31+
return {
32+
// JS/TS options
33+
pluginOptions: {
34+
sourcemap:
35+
!!sourcemapOptions.scripts &&
36+
(sourcemapOptions.hidden ? 'external' : true),
37+
thirdPartySourcemaps: sourcemapOptions.vendor,
1638
tsconfig,
17-
outputNames,
39+
jit,
40+
advancedOptimizations,
1841
fileReplacements,
42+
sourceFileCache,
43+
loadResultCache: sourceFileCache?.loadResultCache,
44+
incremental: !!options.watch,
45+
},
46+
// Component stylesheet options
47+
styleOptions: {
48+
workspaceRoot,
49+
inlineFonts: !!optimizationOptions.fonts.inline,
50+
optimization: !!optimizationOptions.styles.minify,
51+
sourcemap:
52+
// Hidden component stylesheet sourcemaps are inaccessible which is effectively
53+
// the same as being disabled. Disabling has the advantage of avoiding the overhead
54+
// of sourcemap processing.
55+
sourcemapOptions.styles && !sourcemapOptions.hidden ? 'linked' : false,
56+
outputNames,
57+
includePaths: stylePreprocessorOptions?.includePaths,
1958
externalDependencies,
20-
preserveSymlinks,
21-
stylePreprocessorOptions,
22-
advancedOptimizations,
59+
target,
2360
inlineStyleLanguage,
24-
jit,
25-
cacheOptions,
61+
preserveSymlinks,
2662
tailwindConfiguration,
2763
postcssConfiguration,
64+
cacheOptions,
2865
publicPath,
29-
} = options;
30-
31-
return {
32-
// JS/TS options
33-
pluginOptions: {
34-
sourcemap: !!sourcemapOptions.scripts && (sourcemapOptions.hidden ? 'external' : true),
35-
thirdPartySourcemaps: sourcemapOptions.vendor,
36-
tsconfig,
37-
jit,
38-
advancedOptimizations,
39-
fileReplacements,
40-
sourceFileCache,
41-
loadResultCache: sourceFileCache?.loadResultCache,
42-
incremental: !!options.watch,
43-
},
44-
// Component stylesheet options
45-
styleOptions: {
46-
workspaceRoot,
47-
inlineFonts: !!optimizationOptions.fonts.inline,
48-
optimization: !!optimizationOptions.styles.minify,
49-
sourcemap:
50-
// Hidden component stylesheet sourcemaps are inaccessible which is effectively
51-
// the same as being disabled. Disabling has the advantage of avoiding the overhead
52-
// of sourcemap processing.
53-
sourcemapOptions.styles && !sourcemapOptions.hidden ? 'linked' : false,
54-
outputNames,
55-
includePaths: stylePreprocessorOptions?.includePaths,
56-
externalDependencies,
57-
target,
58-
inlineStyleLanguage,
59-
preserveSymlinks,
60-
tailwindConfiguration,
61-
postcssConfiguration,
62-
cacheOptions,
63-
publicPath,
64-
},
65-
};
66-
}
66+
},
67+
};
68+
}

0 commit comments

Comments
 (0)