Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read coreApp assets directly from package #144492

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/core/apps/core-apps-server-internal/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ PKG_REQUIRE_NAME = "@kbn/core-apps-server-internal"
SOURCE_FILES = glob(
[
"**/*.ts",
"src/**/*.css",
"src/**/*.ttf",
"src/**/*.woff",
"src/**/*.woff2",
"src/**/*.ico",
"src/**/*.png",
"src/**/*.svg",
],
exclude = [
"**/*.config.js",
Expand All @@ -38,8 +31,16 @@ filegroup(
srcs = SRCS,
)

ASSETS = glob(["assets/**/*"])

filegroup(
name = "assets",
srcs = ASSETS,
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
":assets"
]
Comment on lines +34 to 44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what does that do exactly?

But I think I spotted the problem:

This PR moved the assets from {package}/src/assets to {package}/assets. However you did not change the path in the route registered to serve them:

private registerStaticDirs(core: InternalCoreSetup | InternalCorePreboot) {
core.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets'));

Changing the Path.resolve(__dirname, './assets') to target the correct folder should hopefully do the trick.


RUNTIME_DEPS = [
Expand Down
8 changes: 7 additions & 1 deletion packages/core/apps/core-apps-server-internal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import Path from 'path';
export { CoreAppsService } from './src';
export type {
InternalCoreAppsServiceRequestHandlerContext,
InternalCoreAppsServiceRouter,
} from './src';
// only used by integration tests
export { FileHashCache, registerRouteForBundle } from './src';
// After the package is built and bootstrap extracts files to bazel-bin, node modules structure exposes assets outside of the src folder
// These constants reference locations in the hierarchy after the build is done
export const ASSETS_DIR = Path.resolve(__dirname, '../assets');
export const FAVICONS_DIR = `${ASSETS_DIR}/favicons`;
export const THEMES_DIR = `${ASSETS_DIR}`;
export const FONTS_DIR = `${ASSETS_DIR}/fonts`;
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
4 changes: 0 additions & 4 deletions src/core/server/core_app/assets/favicons/favicon.svg

This file was deleted.

Loading