cli,frontend-app-api: more cleanup
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ app:
|
||||
experimental:
|
||||
packages: 'all' # ✨
|
||||
|
||||
|
||||
# scmAuthExtension: >-
|
||||
# createScmAuthExtension({
|
||||
# id: 'apis.scmAuth.addons.ghe',
|
||||
|
||||
@@ -27,7 +27,7 @@ import { createConfig, resolveBaseUrl } from './config';
|
||||
import { BuildOptions } from './types';
|
||||
import { resolveBundlingPaths } from './paths';
|
||||
import chalk from 'chalk';
|
||||
import { createDetectedModulesEntrypoint } from './packageDetection';
|
||||
import { createDetectedModulesEntryPoint } from './packageDetection';
|
||||
|
||||
// TODO(Rugvip): Limits from CRA, we might want to tweak these though.
|
||||
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
|
||||
@@ -42,7 +42,7 @@ export async function buildBundle(options: BuildOptions) {
|
||||
|
||||
const paths = resolveBundlingPaths(options);
|
||||
|
||||
const detectedModulesEntryPoint = await createDetectedModulesEntrypoint({
|
||||
const detectedModulesEntryPoint = await createDetectedModulesEntryPoint({
|
||||
config: options.fullConfig,
|
||||
targetPath: paths.targetPath,
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ function readPackageDetectionConfig(
|
||||
config: Config,
|
||||
): PackageDetectionConfig | undefined {
|
||||
const packages = config.getOptional('app.experimental.packages');
|
||||
if (!packages) {
|
||||
if (packages === undefined || packages === null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ async function writeDetectedPackagesModule(packageNames: string[]) {
|
||||
);
|
||||
}
|
||||
|
||||
export async function createDetectedModulesEntrypoint(options: {
|
||||
export async function createDetectedModulesEntryPoint(options: {
|
||||
config: Config;
|
||||
targetPath: string;
|
||||
watch?: () => void;
|
||||
|
||||
@@ -31,12 +31,13 @@ import { paths as libPaths } from '../../lib/paths';
|
||||
import { loadCliConfig } from '../config';
|
||||
import { Lockfile } from '../versioning';
|
||||
import { createConfig, resolveBaseUrl } from './config';
|
||||
import { createDetectedModulesEntrypoint as createDetectedModulesEntryPoint } from './packageDetection';
|
||||
import { createDetectedModulesEntryPoint } from './packageDetection';
|
||||
import { resolveBundlingPaths } from './paths';
|
||||
import { ServeOptions } from './types';
|
||||
|
||||
export async function serveBundle(options: ServeOptions) {
|
||||
const paths = resolveBundlingPaths(options);
|
||||
const targetPkg = await fs.readJson(paths.targetPackageJson);
|
||||
|
||||
if (options.verifyVersions) {
|
||||
const lockfile = await Lockfile.load(
|
||||
@@ -170,6 +171,7 @@ export async function serveBundle(options: ServeOptions) {
|
||||
: false,
|
||||
host,
|
||||
port,
|
||||
proxy: targetPkg.proxy,
|
||||
// When the dev server is behind a proxy, the host and public hostname differ
|
||||
allowedHosts: [url.hostname],
|
||||
client: {
|
||||
|
||||
@@ -57,14 +57,14 @@ describe('getAvailablePlugins', () => {
|
||||
{
|
||||
module: {
|
||||
testPlugin,
|
||||
a: 1,
|
||||
a: 'a',
|
||||
b: null,
|
||||
c: undefined,
|
||||
d: Symbol('wat'),
|
||||
e: () => {},
|
||||
f: [],
|
||||
g: {},
|
||||
h: 'h',
|
||||
h: class {},
|
||||
i: NaN,
|
||||
j: Infinity,
|
||||
k: -Infinity,
|
||||
@@ -80,6 +80,9 @@ describe('getAvailablePlugins', () => {
|
||||
u: false,
|
||||
v: true,
|
||||
w: 0,
|
||||
x: 1,
|
||||
y: -1,
|
||||
z: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -30,7 +30,7 @@ export function getAvailablePlugins(): BackstagePlugin[] {
|
||||
|
||||
return (
|
||||
discovered?.modules.flatMap(({ module: mod }) =>
|
||||
Object.values(mod).flatMap(val => (isBackstagePlugin(val) ? [val] : [])),
|
||||
Object.values(mod).filter(isBackstagePlugin),
|
||||
) ?? []
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user