From cbac3c6390c4ee5a69d10031e36592cd0bc42b81 Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Mon, 2 Oct 2023 10:43:11 -0700 Subject: [PATCH] remove more ENTERPRISE=1 remnants (#57232) There are still many places that build the old non-enterprise bundle. This is no longer needed or maintained. This change simplifies our builds by removing that unnecessary target. There are still some remnants (such as `ui/assets/{enterprise,oss}`); not *all* are removed here. --- client/build-config/src/paths.ts | 8 +- .../src/webBundleSize/index.ts | 6 +- client/web-sveltekit/.env | 3 - .../src/routes/(enterprise)/+layout.ts | 15 ---- client/web/BUILD.bazel | 78 +++---------------- client/web/bundlesize.config.js | 5 +- client/web/dev/esbuild/build.ts | 7 +- client/web/dev/utils/environment-config.ts | 1 - client/web/package.json | 2 +- client/web/scripts/BUILD.bazel | 4 +- client/web/src/OpenSourceWebApp.tsx | 69 ---------------- client/web/src/enterprise/main.tsx | 2 +- .../web/src/enterprise/site-admin/routes.tsx | 1 - client/web/src/integration/BUILD.bazel | 4 +- client/web/src/main.tsx | 27 ------- .../UserManagement/components/UsersList.tsx | 9 +-- .../src/site-admin/UserManagement/index.tsx | 12 +-- client/web/src/site-admin/routes.tsx | 2 +- client/web/webpack.bazel.config.js | 3 +- client/web/webpack.config.js | 14 +--- dev/auth-provider/keycloak.sh | 5 -- dev/ci/pnpm-build.sh | 1 - dev/sg/internal/sgconf/config_test.go | 3 +- dev/webpack.bzl | 9 +-- doc/dev/background-information/bazel/web.md | 3 - .../bazel/web_overview.md | 4 +- doc/dev/contributing/frontend_contribution.md | 2 +- doc/dev/how-to/testing.md | 4 +- enterprise/dev/app/build-backend.sh | 2 +- enterprise/dev/app/build-windows.sh | 2 +- .../dev/ci/internal/ci/bazel_operations.go | 4 +- enterprise/dev/ci/internal/ci/operations.go | 23 ++---- enterprise/dev/ci/internal/ci/pipeline.go | 1 - enterprise/dev/dev-sourcegraph-server.sh | 11 --- sg.config.yaml | 14 ---- ui/assets/doc.go | 10 +-- ui/assets/enterprise/BUILD.bazel | 4 +- ui/assets/oss/BUILD.bazel | 28 ------- ui/assets/oss/assets.go | 76 ------------------ ui/assets/oss/webpack.manifest.json | 5 -- 40 files changed, 52 insertions(+), 431 deletions(-) delete mode 100644 client/web-sveltekit/src/routes/(enterprise)/+layout.ts delete mode 100644 client/web/src/OpenSourceWebApp.tsx delete mode 100644 client/web/src/main.tsx delete mode 100755 enterprise/dev/dev-sourcegraph-server.sh delete mode 100644 ui/assets/oss/BUILD.bazel delete mode 100644 ui/assets/oss/assets.go delete mode 100644 ui/assets/oss/webpack.manifest.json diff --git a/client/build-config/src/paths.ts b/client/build-config/src/paths.ts index d86e2168fdd..a9c3a2a38c7 100644 --- a/client/build-config/src/paths.ts +++ b/client/build-config/src/paths.ts @@ -2,8 +2,6 @@ import fs from 'fs' import path from 'path' -import { getEnvironmentBoolean } from './utils/environment-config' - // TODO(bazel): drop when non-bazel removed. const IS_BAZEL = !!(process.env.JS_BINARY__TARGET || process.env.BAZEL_BINDIR || process.env.BAZEL_TEST) @@ -34,11 +32,7 @@ export function resolveAssetsPath(root: string): string { // and be done with it. With Bazel, we have different loaders on the backend where the assets gets embedded. So // what we do here is "simulate" what happens in bazel, by putting the assets in the correct relative directory // so that when the backend is compiled the assets gets embedded properly - const isEnterprise: boolean = getEnvironmentBoolean('ENTERPRISE') - const relativeAssetPath: string = isEnterprise ? 'enterprise' : 'oss' - const path: string = resolveWithSymlink(root, 'ui/assets', relativeAssetPath) - - return path + return resolveWithSymlink(root, 'ui/assets/enterprise') } export const ROOT_PATH = IS_BAZEL ? process.cwd() : resolveWithSymlink(__dirname, '../../../') diff --git a/client/observability-server/src/webBundleSize/index.ts b/client/observability-server/src/webBundleSize/index.ts index c47213b2cc9..447087ba35f 100644 --- a/client/observability-server/src/webBundleSize/index.ts +++ b/client/observability-server/src/webBundleSize/index.ts @@ -2,7 +2,7 @@ * The script collects web application bundlesize information from the disk and uploads it to Honeycomb. * * 1. Build web application using: - * ENTERPRISE=1 NODE_ENV=production DISABLE_TYPECHECKING=true WEBPACK_USE_NAMED_CHUNKS=true pnpm build-web + * NODE_ENV=production DISABLE_TYPECHECKING=true WEBPACK_USE_NAMED_CHUNKS=true pnpm build-web * * 2. Upload bundlesize information to Honeycomb: * HONEYCOMB_API_KEY=XXX pnpm --filter @sourcegraph/observability-server run bundlesize:web:upload @@ -13,7 +13,7 @@ import { execSync } from 'child_process' import path from 'path' import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' -import { cleanEnv, bool, str } from 'envalid' +import { cleanEnv, str } from 'envalid' import { STATIC_ASSETS_PATH, WORKSPACES_PATH } from '@sourcegraph/build-config' @@ -23,7 +23,6 @@ import { libhoneySDK } from '../sdk' import { getBundleSizeStats } from './getBundleSizeStats' const environment = cleanEnv(process.env, { - ENTERPRISE: bool({ default: false }), NODE_ENV: str({ choices: ['development', 'production'] }), }) @@ -56,7 +55,6 @@ for (const [baseFilePath, fileInfo] of Object.entries(bundleSizeStats)) { 'bundle.file.isDefaultVendors': fileInfo.isDefaultVendors, 'bundle.file.isCss': fileInfo.isCss, 'bundle.file.isJs': fileInfo.isJs, - 'bundle.enterprise': environment.ENTERPRISE, 'bundle.env': environment.NODE_ENV, ...SDK_INFO, diff --git a/client/web-sveltekit/.env b/client/web-sveltekit/.env index d952b2781a8..f6b742fb3ce 100644 --- a/client/web-sveltekit/.env +++ b/client/web-sveltekit/.env @@ -1,5 +1,2 @@ -# Whether to run the enterprise version (default). Unsetting the value -# corresponds to running the OSS version. -PUBLIC_SG_ENTERPRISE=true PUBLIC_DOTCOM= PUBLIC_ENABLE_EVENT_LOGGER= diff --git a/client/web-sveltekit/src/routes/(enterprise)/+layout.ts b/client/web-sveltekit/src/routes/(enterprise)/+layout.ts deleted file mode 100644 index 2ea9dc21981..00000000000 --- a/client/web-sveltekit/src/routes/(enterprise)/+layout.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { error } from '@sveltejs/kit' - -import { PUBLIC_SG_ENTERPRISE } from '$env/static/public' - -import type { LayoutLoad } from './$types' - -export const load: LayoutLoad = () => { - // Example for how we could prevent access to all enterprese specific routes. - // It's not quite the same as not having the routes at all and have the - // interpreted differently, like in the current web app. - if (!PUBLIC_SG_ENTERPRISE) { - // eslint-disable-next-line etc/throw-error, rxjs/throw-error - throw error(404, { message: 'enterprise feature' }) - } -} diff --git a/client/web/BUILD.bazel b/client/web/BUILD.bazel index 3a9106b3542..a20f4f33c60 100644 --- a/client/web/BUILD.bazel +++ b/client/web/BUILD.bazel @@ -5,7 +5,7 @@ load("@npm//:bundlesize2/package_json.bzl", bundlesize_bin = "bin") load("//client/shared/dev:generate_graphql_operations.bzl", "generate_graphql_operations") load("//client/shared/dev:tools.bzl", "module_style_typings") load("//dev:defs.bzl", "jest_test", "npm_package", "sass", "ts_project") -load("//dev:webpack.bzl", "webpack_bundle", "webpack_devserver", "webpack_web_app") +load("//dev:webpack.bzl", "webpack_bundle", "webpack_web_app") load("@aspect_rules_ts//ts:defs.bzl", "ts_config") load("//dev:eslint.bzl", "eslint_config_and_lint_root", "eslint_test_with_types") load("//dev:write_generated_to_source_files.bzl", "write_generated_to_source_files") @@ -163,7 +163,6 @@ ts_project( "src/LegacyLayout.tsx", "src/LegacyRouteContext.tsx", "src/LegacySourcegraphWebApp.tsx", - "src/OpenSourceWebApp.tsx", "src/PageError.tsx", "src/SearchQueryStateObserver.tsx", "src/SourcegraphWebApp.tsx", @@ -1125,7 +1124,6 @@ ts_project( "src/insights/types.ts", "src/insights/utils/use-series-toggle.ts", "src/jscontext.ts", - "src/main.tsx", "src/marketing/backend.ts", "src/marketing/components/SurveyRatingRadio.tsx", "src/marketing/components/SurveyUseCaseForm.tsx", @@ -2114,9 +2112,6 @@ BUNDLE_DATA_DEPS = [ ":module_styles", ":package_styles", "src/get-cody/SourceSans3VF-Upright.ttf.woff2", -] - -ENTERPRISE_BUNDLE_DATA_DEPS = BUNDLE_DATA_DEPS + [ # TODO(bazel): this is already in the main ts_project(srcs). Why also here? "src/enterprise/codeintel/configuration/schema.json", ":enterprise-yaml", @@ -2132,10 +2127,14 @@ ENTERPRISE_BUNDLE_DATA_DEPS = BUNDLE_DATA_DEPS + [ "//:package_json", ], entry_points = { - "src/main.js": "app", + "src/enterprise/main.js": "app", + "src/enterprise/embed/main.js": "embed", }, env = { "NODE_ENV": "production" if prod else "development", + "INTEGRATION_TESTS": "false", + "WEBPACK_BUNDLE_ANALYZER": "false", + "WEBPACK_USE_NAMED_CHUNKS": "false", }, output_dir = True, visibility = ["//ui/assets:__subpackages__"], @@ -2148,35 +2147,11 @@ ENTERPRISE_BUNDLE_DATA_DEPS = BUNDLE_DATA_DEPS + [ ] ] -webpack_bundle( - name = "bundle-enterprise", - srcs = ENTERPRISE_BUNDLE_DATA_DEPS + [ - "//:babel_config", - "//:browserslist", - "//:package_json", - ], - entry_points = { - "src/enterprise/main.js": "app", - "src/enterprise/embed/main.js": "embed", - }, - env = { - "NODE_ENV": "production", - "ENTERPRISE": "true", - "INTEGRATION_TESTS": "false", - "WEBPACK_BUNDLE_ANALYZER": "false", - "WEBPACK_USE_NAMED_CHUNKS": "false", - }, - output_dir = True, - visibility = ["//ui/assets:__subpackages__"], - webpack_config = "webpack.bazel.config.js", - deps = WEBPACK_CONFIG_DEPS, -) - # Used for integration tests and has bigger bundle size # because of the inlined source-maps. webpack_web_app( - name = "app-enterprise", - srcs = ENTERPRISE_BUNDLE_DATA_DEPS + [ + name = "app", + srcs = BUNDLE_DATA_DEPS + [ "//:babel_config", "//:browserslist", "//:package_json", @@ -2186,7 +2161,6 @@ webpack_web_app( }, env = { "NODE_ENV": "production", - "ENTERPRISE": "true", "INTEGRATION_TESTS": "true", }, output_dir = True, @@ -2195,46 +2169,14 @@ webpack_web_app( deps = WEBPACK_CONFIG_DEPS, ) -# ibazel run //client/web:devserver -# should make the web application available under http://localhost:3080/ by default. -webpack_devserver( - name = "devserver", - data = BUNDLE_DATA_DEPS + WEBPACK_CONFIG_DEPS + [ - "//:babel_config", - "//:browserslist", - "//:package_json", - - # references from the devserver config - "webpack.bazel.config.js", - ], - entry_points = { - "src/main.js": "app", - }, - env = { - "NODE_ENV": "development", - # TODO(bazel): make it dynamic or make multiple targets. - "SOURCEGRAPH_API_URL": "https://sourcegraph.sourcegraph.com", - }, - webpack_config = "webpack.bazel.devserver.config.js", -) - build_test( name = "webpack_test", size = "enormous", - tags = ["manual"], # avoid building the oss bundle targets = [ ":bundle", ], ) -build_test( - name = "webpack_test_enterprise", - size = "enormous", - targets = [ - ":bundle-enterprise", - ], -) - bundlesize_bin.bundlesize_test( name = "bundlesize-report", timeout = "short", @@ -2244,10 +2186,10 @@ bundlesize_bin.bundlesize_test( ], data = [ "bundlesize.config.js", - ":bundle-enterprise", + ":bundle", ], env = { "INTERNAL_SKIP_CACHE": "true", - "WEB_BUNDLE_PATH": "$(rootpath //client/web:bundle-enterprise)", + "WEB_BUNDLE_PATH": "$(rootpath //client/web:bundle)", }, ) diff --git a/client/web/bundlesize.config.js b/client/web/bundlesize.config.js index f25654254bd..4c1619fd4a2 100644 --- a/client/web/bundlesize.config.js +++ b/client/web/bundlesize.config.js @@ -4,10 +4,7 @@ function relativeAssets(base) { if (process.env.NODE_ENV !== undefined && process.env.NODE_ENV === 'development') { return path.join(base, '../../ui/assets') } - if (process.env.ENTERPRISE !== undefined && process.env.ENTERPRISE === '1') { - return path.join(base, '../../ui/assets/enterprise') - } - return path.join(base, '../../ui/assets/oss') + return path.join(base, '../../ui/assets/enterprise') } const STATIC_ASSETS_PATH = process.env.WEB_BUNDLE_PATH || relativeAssets(__dirname) diff --git a/client/web/dev/esbuild/build.ts b/client/web/dev/esbuild/build.ts index ea4035bc46a..781b83e8c10 100644 --- a/client/web/dev/esbuild/build.ts +++ b/client/web/dev/esbuild/build.ts @@ -21,19 +21,14 @@ import { ENVIRONMENT_CONFIG, IS_DEVELOPMENT, IS_PRODUCTION } from '../utils' import { manifestPlugin } from './manifestPlugin' -const isEnterpriseBuild = ENVIRONMENT_CONFIG.ENTERPRISE const isCodyApp = ENVIRONMENT_CONFIG.CODY_APP const omitSlowDeps = ENVIRONMENT_CONFIG.DEV_WEB_BUILDER_OMIT_SLOW_DEPS export const BUILD_OPTIONS: esbuild.BuildOptions = { entryPoints: { - // Enterprise vs. OSS builds use different entrypoints. The enterprise entrypoint imports a - // strict superset of the OSS entrypoint. 'scripts/app': isCodyApp ? path.join(ROOT_PATH, 'client/web/src/enterprise/app-main.tsx') - : isEnterpriseBuild - ? path.join(ROOT_PATH, 'client/web/src/enterprise/main.tsx') - : path.join(ROOT_PATH, 'client/web/src/main.tsx'), + : path.join(ROOT_PATH, 'client/web/src/enterprise/main.tsx'), }, bundle: true, minify: IS_PRODUCTION, diff --git a/client/web/dev/utils/environment-config.ts b/client/web/dev/utils/environment-config.ts index 693ab882a86..4065e7f310a 100644 --- a/client/web/dev/utils/environment-config.ts +++ b/client/web/dev/utils/environment-config.ts @@ -77,7 +77,6 @@ export const ENVIRONMENT_CONFIG = { * Application features configuration. * ---------------------------------------- */ - ENTERPRISE: getEnvironmentBoolean('ENTERPRISE'), SOURCEGRAPHDOTCOM_MODE: getEnvironmentBoolean('SOURCEGRAPHDOTCOM_MODE'), CODY_APP: getEnvironmentBoolean('CODY_APP'), diff --git a/client/web/package.json b/client/web/package.json index 1e442ed7929..3f554c05511 100644 --- a/client/web/package.json +++ b/client/web/package.json @@ -29,7 +29,7 @@ "lint:js": "NODE_OPTIONS=\"--max_old_space_size=16192\" eslint --cache '**/*.[tj]s?(x)'", "lint:css": "stylelint 'src/**/*.scss' --quiet", "browserslist": "pnpm exec browserslist", - "analyze-bundle": "WEBPACK_USE_NAMED_CHUNKS=true NODE_ENV=production ENTERPRISE=1 WEBPACK_BUNDLE_ANALYZER=1 pnpm build", + "analyze-bundle": "WEBPACK_USE_NAMED_CHUNKS=true NODE_ENV=production WEBPACK_BUNDLE_ANALYZER=1 pnpm build", "bundlesize": "pnpm exec bundlesize --config=./bundlesize.config.js", "report-bundle-diff": "ts-node-transpile-only scripts/report-bundle-diff" }, diff --git a/client/web/scripts/BUILD.bazel b/client/web/scripts/BUILD.bazel index 84a32d9b793..c2fea2ccee0 100644 --- a/client/web/scripts/BUILD.bazel +++ b/client/web/scripts/BUILD.bazel @@ -22,7 +22,7 @@ js_test( "//:node_modules/@statoscope/cli", "//:node_modules/octokit", "//:node_modules/shelljs", - "//client/web:bundle-enterprise", + "//client/web:bundle", ], entry_point = "report-bundle-diff.js", env = { @@ -31,7 +31,7 @@ js_test( "BUILDKITE_PULL_REQUEST_REPO": "$$BUILDKITE_PULL_REQUEST_REPO", "BUILDKITE_PULL_REQUEST": "$$BUILDKITE_PULL_REQUEST", "GH_TOKEN": "$(GH_TOKEN)", - "WEB_BUNDLE_PATH": "$(rootpath //client/web:bundle-enterprise)", + "WEB_BUNDLE_PATH": "$(rootpath //client/web:bundle)", }, tags = ["manual"], ) diff --git a/client/web/src/OpenSourceWebApp.tsx b/client/web/src/OpenSourceWebApp.tsx deleted file mode 100644 index 5a9d41c8702..00000000000 --- a/client/web/src/OpenSourceWebApp.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import type { FC } from 'react' - -import './SourcegraphWebApp.scss' - -import { LegacySourcegraphWebApp } from './LegacySourcegraphWebApp' -import { orgAreaHeaderNavItems } from './org/area/navitems' -import { orgAreaRoutes } from './org/area/routes' -import { orgSettingsAreaRoutes } from './org/settings/routes' -import { orgSettingsSideBarItems } from './org/settings/sidebaritems' -import { repoContainerRoutes } from './repo/repoContainerRoutes' -import { repoHeaderActionButtons } from './repo/repoHeaderActionButtons' -import { repoRevisionContainerRoutes } from './repo/repoRevisionContainerRoutes' -import { repoSettingsAreaRoutes } from './repo/settings/routes' -import { repoSettingsSideBarGroups } from './repo/settings/sidebaritems' -import { routes } from './routes' -import { siteAdminAreaRoutes } from './site-admin/routes' -import { siteAdminSidebarGroups } from './site-admin/sidebaritems' -import { - type StaticAppConfig, - type StaticHardcodedAppConfig, - type StaticInjectedAppConfig, - windowContextConfig, -} from './staticAppConfig' -import { userAreaHeaderNavItems } from './user/area/navitems' -import { userAreaRoutes } from './user/area/routes' -import { userSettingsAreaRoutes } from './user/settings/routes' -import { userSettingsSideBarItems } from './user/settings/sidebaritems' - -const injectedValuesConfig = { - /** - * Routes and nav links - */ - siteAdminAreaRoutes, - siteAdminSideBarGroups: siteAdminSidebarGroups, - siteAdminOverviewComponents: [], - userAreaRoutes, - userAreaHeaderNavItems, - userSettingsSideBarItems, - userSettingsAreaRoutes, - orgSettingsSideBarItems, - orgSettingsAreaRoutes, - orgAreaRoutes, - orgAreaHeaderNavItems, - repoContainerRoutes, - repoRevisionContainerRoutes, - repoHeaderActionButtons, - repoSettingsAreaRoutes, - repoSettingsSidebarGroups: repoSettingsSideBarGroups, - routes, -} satisfies StaticInjectedAppConfig - -const hardcodedConfig = { - codeIntelligenceEnabled: false, - searchContextsEnabled: false, - notebooksEnabled: false, - codeMonitoringEnabled: false, - searchAggregationEnabled: false, - ownEnabled: false, -} satisfies StaticHardcodedAppConfig - -const staticAppConfig = { - ...injectedValuesConfig, - ...windowContextConfig, - ...hardcodedConfig, -} satisfies StaticAppConfig - -// Entry point for the app without enterprise functionality. -// For more info see: https://docs.sourcegraph.com/admin/subscriptions#paid-subscriptions-for-sourcegraph-enterprise -export const OpenSourceWebApp: FC = () => diff --git a/client/web/src/enterprise/main.tsx b/client/web/src/enterprise/main.tsx index 2e6e3e2ef5e..d6810973e63 100644 --- a/client/web/src/enterprise/main.tsx +++ b/client/web/src/enterprise/main.tsx @@ -1,4 +1,4 @@ -// This is the entry point for the enterprise web app +// This is the entry point for the web app // Order is important here // Don't remove the empty lines between these imports diff --git a/client/web/src/enterprise/site-admin/routes.tsx b/client/web/src/enterprise/site-admin/routes.tsx index ed18cb4285b..e16d0e16c43 100644 --- a/client/web/src/enterprise/site-admin/routes.tsx +++ b/client/web/src/enterprise/site-admin/routes.tsx @@ -96,7 +96,6 @@ export const enterpriseSiteAdminAreaRoutes: readonly SiteAdminAreaRoute[] = ( path: '/users', render: () => ( ( )} diff --git a/client/web/src/integration/BUILD.bazel b/client/web/src/integration/BUILD.bazel index 5c23764f660..0a730c4b2ec 100644 --- a/client/web/src/integration/BUILD.bazel +++ b/client/web/src/integration/BUILD.bazel @@ -112,9 +112,9 @@ mocha_test( "--parallel", "--jobs 16", ], - data = ["//client/web:app-enterprise"], + data = ["//client/web:app"], env = { - "WEB_BUNDLE_PATH": "$(rootpath //client/web:app-enterprise)", + "WEB_BUNDLE_PATH": "$(rootpath //client/web:app)", }, flaky = True, is_percy_enabled = True, diff --git a/client/web/src/main.tsx b/client/web/src/main.tsx deleted file mode 100644 index 49a4d27a047..00000000000 --- a/client/web/src/main.tsx +++ /dev/null @@ -1,27 +0,0 @@ -// This is the entry point for the web app - -// Order is important here -// Don't remove the empty lines between these imports - -// prettier-ignore-start -import '@sourcegraph/shared/src/polyfills' -// prettier-ignore-end - -import './initBuildInfo' -import './monitoring/initMonitoring' - -import { createRoot } from 'react-dom/client' - -import { RouterLink, setLinkComponent } from '@sourcegraph/wildcard' - -import { OpenSourceWebApp } from './OpenSourceWebApp' - -setLinkComponent(RouterLink) - -// It's important to have a root component in a separate file to create a react-refresh boundary and avoid page reload. -// https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload -window.addEventListener('DOMContentLoaded', () => { - const root = createRoot(document.querySelector('#root')!) - - root.render() -}) diff --git a/client/web/src/site-admin/UserManagement/components/UsersList.tsx b/client/web/src/site-admin/UserManagement/components/UsersList.tsx index 3a58bd323a1..53994f3f7db 100644 --- a/client/web/src/site-admin/UserManagement/components/UsersList.tsx +++ b/client/web/src/site-admin/UserManagement/components/UsersList.tsx @@ -58,7 +58,6 @@ const LIMIT = 25 interface UsersListProps { onActionEnd?: () => void - isEnterprise: boolean renderAssignmentModal: ( onCancel: () => void, onSuccess: (user: { username: string }) => void, @@ -129,11 +128,7 @@ const dateRangeQueryParameterToVariable = ( } } -export const UsersList: React.FunctionComponent = ({ - onActionEnd, - renderAssignmentModal, - isEnterprise, -}) => { +export const UsersList: React.FunctionComponent = ({ onActionEnd, renderAssignmentModal }) => { const [filters, setFilters] = useURLSyncedState(DEFAULT_FILTERS) const debouncedSearchText = useDebounce(filters.searchText, 300) @@ -330,7 +325,7 @@ export const UsersList: React.FunctionComponent = ({ label: 'Manage roles', icon: mdiBadgeAccount, onClick: openRoleAssignmentModal, - condition: ([user]) => isEnterprise && !user?.deletedAt, + condition: ([user]) => !user?.deletedAt, }, { key: 'unlock-user', diff --git a/client/web/src/site-admin/UserManagement/index.tsx b/client/web/src/site-admin/UserManagement/index.tsx index 3eaf650dd7f..a2053304257 100644 --- a/client/web/src/site-admin/UserManagement/index.tsx +++ b/client/web/src/site-admin/UserManagement/index.tsx @@ -16,7 +16,6 @@ import { USERS_MANAGEMENT_SUMMARY } from './queries' import styles from './index.module.scss' export interface UsersManagementProps { - isEnterprise: boolean renderAssignmentModal: ( onCancel: () => void, onSuccess: (user: { username: string }) => void, @@ -24,10 +23,7 @@ export interface UsersManagementProps { ) => React.ReactNode } -export const UsersManagement: React.FunctionComponent = ({ - isEnterprise, - renderAssignmentModal, -}) => { +export const UsersManagement: React.FunctionComponent = ({ renderAssignmentModal }) => { useEffect(() => { eventLogger.logPageView('UsersManagement') }, []) @@ -121,11 +117,7 @@ export const UsersManagement: React.FunctionComponent = ({ ) : ( )} - + All events are generated from entries in the event logs table and are updated every 24 hours. diff --git a/client/web/src/site-admin/routes.tsx b/client/web/src/site-admin/routes.tsx index b7a42c90f6b..02fa5199321 100644 --- a/client/web/src/site-admin/routes.tsx +++ b/client/web/src/site-admin/routes.tsx @@ -262,7 +262,7 @@ export const otherSiteAdminRoutes: readonly SiteAdminAreaRoute[] = [ const siteAdminUserManagementRoute: SiteAdminAreaRoute = { path: '/users', - render: () => null} />, + render: () => null} />, } export const siteAdminAreaRoutes: readonly SiteAdminAreaRoute[] = [ diff --git a/client/web/webpack.bazel.config.js b/client/web/webpack.bazel.config.js index 56095147806..ba5fb4f2239 100644 --- a/client/web/webpack.bazel.config.js +++ b/client/web/webpack.bazel.config.js @@ -32,7 +32,6 @@ const { NODE_ENV, CI: IS_CI, INTEGRATION_TESTS, - ENTERPRISE, EMBED_DEVELOPMENT, ENABLE_SENTRY, ENABLE_OPEN_TELEMETRY, @@ -53,7 +52,7 @@ const { const isHotReloadEnabled = NODE_ENV !== 'production' && !IS_CI const IS_PERSISTENT_CACHE_ENABLED = false // Disabled in Bazel -const IS_EMBED_ENTRY_POINT_ENABLED = ENTERPRISE && (IS_PRODUCTION || (IS_DEVELOPMENT && EMBED_DEVELOPMENT)) +const IS_EMBED_ENTRY_POINT_ENABLED = IS_PRODUCTION || (IS_DEVELOPMENT && EMBED_DEVELOPMENT) const RUNTIME_ENV_VARIABLES = { NODE_ENV, diff --git a/client/web/webpack.config.js b/client/web/webpack.config.js index cfa3ac99111..4769129eaf4 100644 --- a/client/web/webpack.config.js +++ b/client/web/webpack.config.js @@ -34,7 +34,6 @@ const { NODE_ENV, CI: IS_CI, INTEGRATION_TESTS, - ENTERPRISE, EMBED_DEVELOPMENT, ENABLE_SENTRY, ENABLE_OPEN_TELEMETRY, @@ -56,7 +55,7 @@ const { const isHotReloadEnabled = NODE_ENV !== 'production' && !IS_CI const IS_PERSISTENT_CACHE_ENABLED = IS_DEVELOPMENT && !IS_CI -const IS_EMBED_ENTRY_POINT_ENABLED = ENTERPRISE && (IS_PRODUCTION || (IS_DEVELOPMENT && EMBED_DEVELOPMENT)) +const IS_EMBED_ENTRY_POINT_ENABLED = IS_PRODUCTION || (IS_DEVELOPMENT && EMBED_DEVELOPMENT) const RUNTIME_ENV_VARIABLES = { NODE_ENV, @@ -127,15 +126,10 @@ const config = { }), }, entry: { - // Desktop app vs. Enterprise vs. OSS builds use different entrypoints. The enterprise entrypoint imports a - // strict superset of the OSS entrypoint. The app endoint imports a strict superset of the enterprise entrypoint. - app: CODY_APP - ? path.join(enterpriseDirectory, 'app-main.tsx') - : ENTERPRISE - ? path.join(enterpriseDirectory, 'main.tsx') - : path.join(__dirname, 'src', 'main.tsx'), + // Desktop app vs. web builds use different entrypoints. + app: CODY_APP ? path.join(enterpriseDirectory, 'app-main.tsx') : path.join(enterpriseDirectory, 'main.tsx'), // Embedding entrypoint. It uses a small subset of the main webapp intended to be embedded into - // iframes on 3rd party sites. Added only in production enterprise builds or if embed development is enabled. + // iframes on 3rd party sites. Added only in production builds or if embed development is enabled. ...(IS_EMBED_ENTRY_POINT_ENABLED && { embed: path.join(enterpriseDirectory, 'embed', 'main.tsx') }), }, output: { diff --git a/dev/auth-provider/keycloak.sh b/dev/auth-provider/keycloak.sh index c5dce10d5c1..1e66470a4ac 100755 --- a/dev/auth-provider/keycloak.sh +++ b/dev/auth-provider/keycloak.sh @@ -9,11 +9,6 @@ if [ -z "$USE_KEYCLOAK" ]; then exit 0 fi -if [ -z "$ENTERPRISE" ]; then - echo Not using Keycloak. Only runs in enterprise mode. - exit 0 -fi - unset CDPATH cd "$(dirname "${BASH_SOURCE[0]}")" # cd to dev/auth-provider dir diff --git a/dev/ci/pnpm-build.sh b/dev/ci/pnpm-build.sh index f3a857eefb3..82be3dfed0f 100755 --- a/dev/ci/pnpm-build.sh +++ b/dev/ci/pnpm-build.sh @@ -2,7 +2,6 @@ set -e -echo "ENTERPRISE=$ENTERPRISE" echo "NODE_ENV=$NODE_ENV" echo "# Note: NODE_ENV only used for build command" diff --git a/dev/sg/internal/sgconf/config_test.go b/dev/sg/internal/sgconf/config_test.go index 490e3708e0e..84ebfefedf8 100644 --- a/dev/sg/internal/sgconf/config_test.go +++ b/dev/sg/internal/sgconf/config_test.go @@ -83,7 +83,6 @@ commands: install: go build .bin/frontend github.com/sourcegraph/sourcegraph/cmd/frontend checkBinary: .bin/frontend env: - ENTERPRISE: 1 EXTSVC_CONFIG_FILE: '../dev-private/enterprise/dev/external-services-config.json' watch: - lib @@ -120,7 +119,7 @@ commands: Cmd: ".bin/frontend", Install: "go build .bin/frontend github.com/sourcegraph/sourcegraph/cmd/frontend", CheckBinary: ".bin/frontend", - Env: map[string]string{"ENTERPRISE": "1", "EXTSVC_CONFIG_FILE": ""}, + Env: map[string]string{"EXTSVC_CONFIG_FILE": ""}, Watch: []string{ "lib", "internal", diff --git a/dev/webpack.bzl b/dev/webpack.bzl index 9e5e929ff7e..1dbba5f6b2c 100644 --- a/dev/webpack.bzl +++ b/dev/webpack.bzl @@ -1,4 +1,4 @@ -load("@aspect_rules_webpack//webpack:defs.bzl", _webpack_bundle = "webpack_bundle", _webpack_devserver = "webpack_devserver") +load("@aspect_rules_webpack//webpack:defs.bzl", _webpack_bundle = "webpack_bundle") load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory") def webpack_bundle(name, **kwargs): @@ -25,10 +25,3 @@ def webpack_web_app(name, **kwargs): srcs = ["//ui/assets/img:img", ":%s" % bundle_name], visibility = ["//visibility:public"], ) - -def webpack_devserver(name, **kwargs): - _webpack_devserver( - name = name, - webpack = "//dev:webpack", - **kwargs - ) diff --git a/doc/dev/background-information/bazel/web.md b/doc/dev/background-information/bazel/web.md index 90e306b4636..4bb78929c09 100644 --- a/doc/dev/background-information/bazel/web.md +++ b/doc/dev/background-information/bazel/web.md @@ -44,11 +44,8 @@ All client tests (of all types such as jest and mocha) can be invoked by `bazel The primary `client/web` bundle targets are: * `//client/web:bundle` * `//client/web:bundle-dev` -* `//client/web:bundle-enterprise` See `client/web/BUILD`. -The `client/web` devserver can be run using `bazel run //client/web:devserver` - ## Rule configuration Most rules used throughout `client/*` are macros defined in `dev/*.bzl` to provide a consistent configuration used throughout the repo. diff --git a/doc/dev/background-information/bazel/web_overview.md b/doc/dev/background-information/bazel/web_overview.md index 0261418f144..d2a3140e001 100644 --- a/doc/dev/background-information/bazel/web_overview.md +++ b/doc/dev/background-information/bazel/web_overview.md @@ -364,9 +364,9 @@ Gazelle will automatically remove sources added to the new BUILD file from the B mocha_test( name = "integration-tests", timeout = "moderate", - data = ["//client/web:app-enterprise"], + data = ["//client/web:app"], env = { - "WEB_BUNDLE_PATH": "$(rootpath //client/web:app-enterprise)", + "WEB_BUNDLE_PATH": "$(rootpath //client/web:app)", }, is_percy_enabled = True, tags = [ diff --git a/doc/dev/contributing/frontend_contribution.md b/doc/dev/contributing/frontend_contribution.md index 8d519214f2a..2bec4bec41e 100644 --- a/doc/dev/contributing/frontend_contribution.md +++ b/doc/dev/contributing/frontend_contribution.md @@ -44,7 +44,7 @@ To work on most frontend issues, it is necessary to run three applications local ```sh # Prepare web application for integration tests - ENTERPRISE=1 DISABLE_TYPECHECKING=true pnpm run build-web + DISABLE_TYPECHECKING=true pnpm run build-web # Run integration tests pnpm test-integration ``` diff --git a/doc/dev/how-to/testing.md b/doc/dev/how-to/testing.md index 0a9848b2b5b..2defba1619a 100644 --- a/doc/dev/how-to/testing.md +++ b/doc/dev/how-to/testing.md @@ -169,7 +169,7 @@ Some common failure modes: - Page disconnected or browser session closed: another part of the test code might have called `page.close()` asynchronously, the browser crashed (check the video), or the build got canceled. - Node was detached from the DOM: components can change the DOM asynchronously, make sure to not rely on element handles. - Timing problems: Use `retry()` to "poll" for a condition that cannot be expressed through `waitForSelector()` (as opposed to relying on a fixed `setTimeout()`). -- `GraphQL query X has no configured mock response` this test may need enterprise features. Run either `ENTERPRISE=1 pnpm build-web` or `ENTERPRISE=1 pnpm watch-web` +- `GraphQL query X has no configured mock response` this test may need enterprise features. Run either `pnpm build-web` or `pnpm watch-web` Retrying the Buildkite step can help determine whether the test is flaky or broken. If it's flaky, [disable it with `it.skip()` and file an issue on the author](../background-information/testing_principles.md#flaky-tests). @@ -203,7 +203,7 @@ Test coverage from integration tests is tracked in [Codecov](https://codecov.io/ To run integration tests for the web app: -1. Run `INTEGRATION_TESTS=true ENTERPRISE=1 pnpm watch-web` in the repository root in a separate terminal to watch files and build a JavaScript bundle. You can also launch it as the VS Code task "Watch web app". +1. Run `INTEGRATION_TESTS=true pnpm watch-web` in the repository root in a separate terminal to watch files and build a JavaScript bundle. You can also launch it as the VS Code task "Watch web app". - Alternatively, `sg run web-integration-build` will only build a bundle once. - Alternatively, `sg run web-integration-build-prod` will only build a bundle once and will also mirror our CI setup where we use the production bundle of the web application for integration tests. 1. Run `sg test web-integration` in the repository root to run the tests. diff --git a/enterprise/dev/app/build-backend.sh b/enterprise/dev/app/build-backend.sh index a27d42570f4..492e4d7a293 100755 --- a/enterprise/dev/app/build-backend.sh +++ b/enterprise/dev/app/build-backend.sh @@ -16,7 +16,7 @@ go_build() { echo "--- :chrome: Building web" # esbuild is faster pnpm install - NODE_ENV=production ENTERPRISE=1 CODY_APP=1 DEV_WEB_BUILDER=esbuild pnpm run build-web + NODE_ENV=production CODY_APP=1 DEV_WEB_BUILDER=esbuild pnpm run build-web fi export GO111MODULE=on diff --git a/enterprise/dev/app/build-windows.sh b/enterprise/dev/app/build-windows.sh index c0056295f35..7bd674dc8d0 100755 --- a/enterprise/dev/app/build-windows.sh +++ b/enterprise/dev/app/build-windows.sh @@ -5,7 +5,7 @@ echo "Building version: ${version}" echo "--- :chrome: Building web" pnpm install -NODE_ENV=production ENTERPRISE=1 CODY_APP=1 pnpm run build-web +NODE_ENV=production CODY_APP=1 pnpm run build-web export PATH=$PATH:/c/msys64/ucrt64/bin platform="x86_64-pc-windows-msvc" # This is the name Tauri expects for the Windows executable diff --git a/enterprise/dev/ci/internal/ci/bazel_operations.go b/enterprise/dev/ci/internal/ci/bazel_operations.go index 66f7f853a9c..f2632552a94 100644 --- a/enterprise/dev/ci/internal/ci/bazel_operations.go +++ b/enterprise/dev/ci/internal/ci/bazel_operations.go @@ -166,8 +166,8 @@ func bazelTest(targets ...string) func(*bk.Pipeline) { // bazel build //client/web:bundle is very resource hungry and often crashes when ran along other targets // so we run it first to avoid failing builds midway. cmds = append(cmds, - bazelAnnouncef("bazel build //client/web:bundle-enterprise"), - bk.Cmd(bazelCmd("build //client/web:bundle-enterprise")), + bazelAnnouncef("bazel build //client/web:bundle"), + bk.Cmd(bazelCmd("build //client/web:bundle")), ) for _, target := range targets { diff --git a/enterprise/dev/ci/internal/ci/operations.go b/enterprise/dev/ci/internal/ci/operations.go index efd5e288bc1..85b3ac1640e 100644 --- a/enterprise/dev/ci/internal/ci/operations.go +++ b/enterprise/dev/ci/internal/ci/operations.go @@ -24,10 +24,11 @@ type CoreTestOperationsOptions struct { ChromaticShouldAutoAccept bool MinimumUpgradeableVersion string ForceReadyForReview bool - // for addWebAppOSSBuild - CacheBundleSize bool - CreateBundleSizeDiff bool - IsMainBranch bool + + CacheBundleSize bool // for addWebAppEnterpriseBuild + CreateBundleSizeDiff bool // for addWebAppEnterpriseBuild + + IsMainBranch bool } // CoreTestOperations is a core set of tests that should be run in most CI cases. More @@ -132,18 +133,6 @@ func addStylelint(pipeline *bk.Pipeline) { bk.Cmd("dev/ci/pnpm-run.sh lint:css:all")) } -// Adds steps for the OSS and Enterprise web app builds. Runs the web app tests. -func addWebAppOSSBuild(opts CoreTestOperationsOptions) operations.Operation { - return func(pipeline *bk.Pipeline) { - // Webapp build - pipeline.AddStep(":webpack::globe_with_meridians: Build", - withPnpmCache(), - bk.Cmd("dev/ci/pnpm-build.sh client/web"), - bk.Env("NODE_ENV", "production"), - bk.Env("ENTERPRISE", "")) - } -} - func addWebAppTests(opts CoreTestOperationsOptions) operations.Operation { return func(pipeline *bk.Pipeline) { // Webapp tests @@ -167,7 +156,6 @@ func addWebAppEnterpriseBuild(opts CoreTestOperationsOptions) operations.Operati withPnpmCache(), bk.Cmd("dev/ci/pnpm-build.sh client/web"), bk.Env("NODE_ENV", "production"), - bk.Env("ENTERPRISE", "1"), bk.Env("CHECK_BUNDLESIZE", "1"), // Emit a stats.json file for bundle size diffs bk.Env("WEBPACK_EXPORT_STATS", "true"), @@ -282,7 +270,6 @@ func clientIntegrationTests(pipeline *bk.Pipeline) { pipeline.AddStep(":puppeteer::electric_plug: Puppeteer tests prep", withPnpmCache(), bk.Key(prepStepKey), - bk.Env("ENTERPRISE", "1"), bk.Env("NODE_ENV", "production"), bk.Env("INTEGRATION_TESTS", "true"), bk.Env("COVERAGE_INSTRUMENT", "true"), diff --git a/enterprise/dev/ci/internal/ci/pipeline.go b/enterprise/dev/ci/internal/ci/pipeline.go index f8c20a22e07..1398e76780d 100644 --- a/enterprise/dev/ci/internal/ci/pipeline.go +++ b/enterprise/dev/ci/internal/ci/pipeline.go @@ -51,7 +51,6 @@ func GeneratePipeline(c Config) (*bk.Pipeline, error) { // Additional flags "FORCE_COLOR": "3", - "ENTERPRISE": "1", // Add debug flags for scripts to consume "CI_DEBUG_PROFILE": strconv.FormatBool(c.MessageFlags.ProfilingEnabled), // Bump Node.js memory to prevent OOM crashes diff --git a/enterprise/dev/dev-sourcegraph-server.sh b/enterprise/dev/dev-sourcegraph-server.sh deleted file mode 100755 index c2395027239..00000000000 --- a/enterprise/dev/dev-sourcegraph-server.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -ex -cd "$(dirname "${BASH_SOURCE[0]}")"/.. - -# Build a Sourcegraph server docker image with private code built in to run for -# development purposes -time cmd/server/pre-build.sh -IMAGE=sourcegraph/server:0.0.0-ENTERPRISE-DEVELOPMENT VERSION=0.0.0-ENTERPRISE-DEVELOPMENT time cmd/server/build.sh - -IMAGE=sourcegraph/server:0.0.0-ENTERPRISE-DEVELOPMENT ../dev/run-server-image.sh diff --git a/sg.config.yaml b/sg.config.yaml index d3719839aa2..a0ae4fc34fb 100644 --- a/sg.config.yaml +++ b/sg.config.yaml @@ -162,7 +162,6 @@ commands: env: CONFIGURATION_MODE: server USE_ENHANCED_LANGUAGE_DETECTION: false - ENTERPRISE: 1 SITE_CONFIG_FILE: "../dev-private/enterprise/dev/site-config.json" SITE_CONFIG_ESCAPE_HATCH_PATH: "$HOME/.sourcegraph/site-config.json" # frontend processes need this to be so that the paths to the assets are rendered correctly @@ -220,8 +219,6 @@ commands: fi go build -gcflags="$GCFLAGS" -o .bin/repo-updater github.com/sourcegraph/sourcegraph/cmd/repo-updater checkBinary: .bin/repo-updater - env: - ENTERPRISE: 1 watch: - lib - internal @@ -389,7 +386,6 @@ commands: cmd: ./node_modules/.bin/gulp --color dev install: pnpm install env: - ENTERPRISE: 1 ENABLE_OPEN_TELEMETRY: true web-standalone-http: @@ -415,14 +411,12 @@ commands: description: Build development web application for integration tests cmd: pnpm --filter @sourcegraph/web run build env: - ENTERPRISE: 1 INTEGRATION_TESTS: true web-integration-build-prod: description: Build production web application for integration tests cmd: pnpm --filter @sourcegraph/web run build env: - ENTERPRISE: 1 INTEGRATION_TESTS: true NODE_ENV: production @@ -940,7 +934,6 @@ commands: go build -gcflags="$GCFLAGS" -ldflags="-X github.com/sourcegraph/sourcegraph/internal/conf/deploy.forceType=single-program" -o .bin/sourcegraph github.com/sourcegraph/sourcegraph/cmd/sourcegraph checkBinary: .bin/sourcegraph env: - ENTERPRISE: 1 SITE_CONFIG_FILE: "../dev-private/enterprise/dev/site-config.json" SITE_CONFIG_ESCAPE_HATCH_PATH: "$HOME/.sourcegraph/site-config.json" WEBPACK_DEV_SERVER: 1 @@ -992,7 +985,6 @@ bazelCommands: env: CONFIGURATION_MODE: server USE_ENHANCED_LANGUAGE_DETECTION: false - ENTERPRISE: 1 SITE_CONFIG_FILE: "../dev-private/enterprise/dev/site-config.json" SITE_CONFIG_ESCAPE_HATCH_PATH: "$HOME/.sourcegraph/site-config.json" # frontend processes need this to be so that the paths to the assets are rendered correctly @@ -1005,8 +997,6 @@ bazelCommands: target: //cmd/repo-updater precmd: | export SOURCEGRAPH_LICENSE_GENERATION_KEY=$(cat ../dev-private/enterprise/dev/test-license-generation-key.pem) - env: - ENTERPRISE: 1 symbols: target: //enterprise/cmd/symbols checkBinary: .bin/symbols @@ -1466,15 +1456,11 @@ commandsets: commands: - web-standalone-http - caddy - env: - ENTERPRISE: 1 web-standalone-prod: commands: - web-standalone-http-prod - caddy - env: - ENTERPRISE: 1 # For testing our OpenTelemetry stack otel: diff --git a/ui/assets/doc.go b/ui/assets/doc.go index c6c85ba8aec..f2c24d87c07 100644 --- a/ui/assets/doc.go +++ b/ui/assets/doc.go @@ -3,14 +3,10 @@ // It exports a Provider global variable, that should be used by all code // seeking to provide access to assets, regardless of their type (dev, oss // or enterprise). + +// You must also import the embedded assets: // -// To select a particular bundle variant, use _one_ of the following imports in -// the main.go: -// -// - If you want the oss bundle: -// import _ "github.com/sourcegraph/sourcegraph/ui/assets/oss" // Select oss assets -// - If you want the enterprise bundle: -// import _ "github.com/sourcegraph/sourcegraph/ui/assets/enterprise" // Select enterprise assets +// import _ "github.com/sourcegraph/sourcegraph/ui/assets/enterprise" // Select enterprise assets // // And to support working with dev assets, with the webpack process handling them for you, you can use: // diff --git a/ui/assets/enterprise/BUILD.bazel b/ui/assets/enterprise/BUILD.bazel index daa1de5c198..f66e0b51a03 100644 --- a/ui/assets/enterprise/BUILD.bazel +++ b/ui/assets/enterprise/BUILD.bazel @@ -18,12 +18,12 @@ copy_to_directory( srcs = [ "//:CONTRIBUTING.md", "//client/browser:integration-assets", - "//client/web:bundle-enterprise", + "//client/web:bundle", "//ui/assets/img", ], out = "dist", replace_prefixes = { - "client/web/bundle-enterprise": "", + "client/web/bundle": "", "ui/assets/img": "img", "client/browser/integration-assets": "", }, diff --git a/ui/assets/oss/BUILD.bazel b/ui/assets/oss/BUILD.bazel deleted file mode 100644 index 079a242a45a..00000000000 --- a/ui/assets/oss/BUILD.bazel +++ /dev/null @@ -1,28 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory") - -go_library( - name = "oss", - srcs = ["assets.go"], - embedsrcs = ["copy_bundle"], # keep - importpath = "github.com/sourcegraph/sourcegraph/ui/assets/oss", - visibility = ["//visibility:public"], - deps = [ - "//lib/errors", - "//ui/assets", - ], -) - -copy_to_directory( - name = "copy_bundle", - srcs = [ - "//:CONTRIBUTING.md", - "//client/web:bundle", - "//ui/assets/img", - ], - out = "dist", - replace_prefixes = { - "client/web/bundle": "", - "ui/assets/img": "img", - }, -) diff --git a/ui/assets/oss/assets.go b/ui/assets/oss/assets.go deleted file mode 100644 index ea4012cee1b..00000000000 --- a/ui/assets/oss/assets.go +++ /dev/null @@ -1,76 +0,0 @@ -package oss - -import ( - "embed" - "encoding/json" - "io" - "io/fs" - "net/http" - "sync" - - "github.com/sourcegraph/sourcegraph/lib/errors" - "github.com/sourcegraph/sourcegraph/ui/assets" -) - -//go:embed * -var assetsFS embed.FS -var afs fs.FS = assetsFS - -var Assets http.FileSystem - -var ( - webpackManifestOnce sync.Once - assetsOnce sync.Once - webpackManifest *assets.WebpackManifest - webpackManifestErr error -) - -func init() { - // Sets the global assets provider. - assets.Provider = Provider{} -} - -type Provider struct{} - -func (p Provider) LoadWebpackManifest() (*assets.WebpackManifest, error) { - webpackManifestOnce.Do(func() { - f, err := afs.Open("webpack.manifest.json") - if err != nil { - webpackManifestErr = errors.Wrap(err, "read manifest file") - return - } - defer f.Close() - - manifestContent, err := io.ReadAll(f) - if err != nil { - webpackManifestErr = errors.Wrap(err, "read manifest file") - return - } - - if err := json.Unmarshal(manifestContent, &webpackManifest); err != nil { - webpackManifestErr = errors.Wrap(err, "unmarshal manifest json") - return - } - }) - return webpackManifest, webpackManifestErr -} - -func (p Provider) Assets() http.FileSystem { - assetsOnce.Do(func() { - // When we're building this package with Bazel, we cannot directly output the files in this current folder, because - // it's already containing other files known to Bazel. So instead we put those into the dist folder. - // If we do detect a dist folder when running this code, we immediately substitute the root to that dist folder. - // - // Therefore, this code works with both the traditionnal build approach and when built with Bazel. - if _, err := assetsFS.ReadDir("dist"); err == nil { - var err error - afs, err = fs.Sub(assetsFS, "dist") - if err != nil { - panic("incorrect embed") - } - } - Assets = http.FS(afs) - }) - - return Assets -} diff --git a/ui/assets/oss/webpack.manifest.json b/ui/assets/oss/webpack.manifest.json deleted file mode 100644 index 1da2f4a24d3..00000000000 --- a/ui/assets/oss/webpack.manifest.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "environment": "development", - "app.js": "/.assets/scripts/app.bundle.js", - "runtime.js": "/.assets/scripts/runtime.bundle.js" -} \ No newline at end of file