mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 23:01:29 +03:00
Remove obsolete GUI arguments (#9466)
- Close #8610 # Important Notes QA notes: - The GUI2 warning screen should not show up - the arguments that GUI2 do not understand have been removed. - However, it should be tested that the warnings screen should correctly work when invalid arguments really *are* passed in: - Via URL query parameters (electron, might need to open the electron app then the browser, *or* do `location.href = ` in DevTools in Electron.) - By editing `Editor.tsx` to inject invalid args to the big configuration object we pass to the GUI entrypoint.
This commit is contained in:
parent
6e1295379a
commit
143665d944
@ -16,22 +16,12 @@ async function runApp(
|
||||
if (!running) return
|
||||
unmount?.()
|
||||
const unrecognizedOptions: string[] = []
|
||||
// function onUnrecognizedOption(path: string[]) {
|
||||
// unrecognizedOptions.push(path.join('.'))
|
||||
// }
|
||||
// FIXME: https://github.com/enso-org/enso/issues/8610
|
||||
// Currently, options are provided that are not relevant to GUI2. These options cannot be removed
|
||||
// until GUI1 is removed, as GUI1 still needs them.
|
||||
const intermediateConfig = mergeConfig(baseConfig, urlParams())
|
||||
function onUnrecognizedOption(path: string[]) {
|
||||
unrecognizedOptions.push(path.join('.'))
|
||||
}
|
||||
const intermediateConfig = mergeConfig(baseConfig, urlParams(), { onUnrecognizedOption })
|
||||
const appConfig = mergeConfig(intermediateConfig, config ?? {})
|
||||
unmount = await mountProjectApp(
|
||||
{
|
||||
config: appConfig,
|
||||
accessToken,
|
||||
unrecognizedOptions,
|
||||
},
|
||||
pinia,
|
||||
)
|
||||
unmount = await mountProjectApp({ config: appConfig, accessToken, unrecognizedOptions }, pinia)
|
||||
}
|
||||
|
||||
function stopApp() {
|
||||
|
@ -23,15 +23,12 @@ await appConfig.readEnvironmentFromFile()
|
||||
* - `ENSO_BUILD_IDE` - output directory for bundled client files;
|
||||
* - `ENSO_BUILD_PROJECT_MANAGER_IN_BUNDLE_PATH` - path to the project manager executable relative
|
||||
* to the PM bundle root;
|
||||
* - `ENSO_BUILD_IDE_BUNDLED_ENGINE_VERSION` - version of the Engine (backend) that is bundled
|
||||
* along with this client build.
|
||||
* @see bundlerOptions
|
||||
*/
|
||||
export function bundlerOptionsFromEnv(devMode = false): esbuild.BuildOptions {
|
||||
return bundlerOptions(
|
||||
path.join(paths.getIdeDirectory(), 'client'),
|
||||
paths.getProjectManagerInBundlePath(),
|
||||
paths.getBundledEngineVersion(),
|
||||
devMode
|
||||
)
|
||||
}
|
||||
@ -40,7 +37,6 @@ export function bundlerOptionsFromEnv(devMode = false): esbuild.BuildOptions {
|
||||
export function bundlerOptions(
|
||||
outdir: string,
|
||||
projectManagerInBundlePath: string,
|
||||
bundledEngineVersion: string,
|
||||
devMode = false
|
||||
): esbuild.BuildOptions {
|
||||
return {
|
||||
@ -55,7 +51,6 @@ export function bundlerOptions(
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
outExtension: { '.js': '.cjs' },
|
||||
define: {
|
||||
BUNDLED_ENGINE_VERSION: JSON.stringify(bundledEngineVersion),
|
||||
PROJECT_MANAGER_IN_BUNDLE_PATH: JSON.stringify(projectManagerInBundlePath),
|
||||
'process.env.ELECTRON_DEV_MODE': JSON.stringify(String(devMode)),
|
||||
'process.env.GUI_CONFIG_PATH': JSON.stringify(
|
||||
|
@ -29,8 +29,3 @@ export function getProjectManagerBundlePath(): string {
|
||||
export function getProjectManagerInBundlePath(): string {
|
||||
return buildUtils.requireEnv('ENSO_BUILD_PROJECT_MANAGER_IN_BUNDLE_PATH')
|
||||
}
|
||||
|
||||
/** Version of the Engine (backend) that is bundled along with this client build. */
|
||||
export function getBundledEngineVersion(): string {
|
||||
return buildUtils.requireEnv('ENSO_BUILD_IDE_BUNDLED_ENGINE_VERSION')
|
||||
}
|
||||
|
@ -602,9 +602,6 @@ export const CONFIG = contentConfig.OPTIONS.merge(
|
||||
},
|
||||
})
|
||||
)
|
||||
CONFIG.groups.startup.options.platform.value = process.platform
|
||||
|
||||
CONFIG.groups.engine.options.preferredVersion.value = BUNDLED_ENGINE_VERSION
|
||||
|
||||
CONFIG.groups.engine.options.projectManagerUrl.passToWebApplication = true
|
||||
|
||||
|
@ -51,12 +51,6 @@
|
||||
"value": "",
|
||||
"description": "The name of the project to be displayed to the user.",
|
||||
"primary": false
|
||||
},
|
||||
"platform": {
|
||||
"value": "web",
|
||||
"defaultDescription": "'web' if run in the browser, operating system name otherwise`",
|
||||
"description": "The host platform on which the application is running. This is used to adjust some user interface elements. For example, on macOS, the window close buttons are integrated into the top application panel.",
|
||||
"primary": false
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -87,19 +81,6 @@
|
||||
"value": "https://raw.githubusercontent.com/enso-org/ide/develop/config.json",
|
||||
"description": "The URL of the application configuration. Used to check for available updates.",
|
||||
"primary": false
|
||||
},
|
||||
"skipMinVersionCheck": {
|
||||
"value": false,
|
||||
"valueEval": "scope.Version.isDev()",
|
||||
"defaultDescription": "true in local builds, false otherwise.",
|
||||
"description": "Determines whether the minimum engine version check should be performed.",
|
||||
"primary": false
|
||||
},
|
||||
"preferredVersion": {
|
||||
"value": "",
|
||||
"valueEval": "String(scope.Version.ide)",
|
||||
"description": "The preferred engine version.",
|
||||
"primary": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -46,5 +46,5 @@ import CONFIG from './config.json' assert { type: 'json' }
|
||||
export const OPTIONS = linkedDist.config.options.merge(
|
||||
// `valueEval` in `config.json` uses PascalCase scope variables for some reason.
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
linkedDist.config.objectToGroup(CONFIG, { Version: VERSION })
|
||||
linkedDist.config.objectToGroup(CONFIG)
|
||||
)
|
||||
|
@ -104,12 +104,7 @@ export default function Editor(props: EditorProps) {
|
||||
wasmUrl: `${assetsRoot}pkg-opt.wasm`,
|
||||
jsUrl: `${assetsRoot}pkg${JS_EXTENSION[backendType]}`,
|
||||
},
|
||||
engine: {
|
||||
...engineConfig,
|
||||
...(project.engineVersion != null
|
||||
? { preferredVersion: project.engineVersion.value }
|
||||
: {}),
|
||||
},
|
||||
engine: engineConfig,
|
||||
startup: {
|
||||
project: project.packageName,
|
||||
displayedProjectName: project.name,
|
||||
|
1
app/ide-desktop/lib/types/globals.d.ts
vendored
1
app/ide-desktop/lib/types/globals.d.ts
vendored
@ -154,7 +154,6 @@ declare global {
|
||||
|
||||
// These are used in other files (because they're globals)
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const BUNDLED_ENGINE_VERSION: string
|
||||
const BUILD_INFO: buildJson.BuildInfo
|
||||
const PROJECT_MANAGER_IN_BUNDLE_PATH: string
|
||||
const IS_VITE: boolean
|
||||
|
@ -460,20 +460,17 @@ type ToGroup<T extends GroupObject> = Group<
|
||||
>
|
||||
|
||||
/** Convert the plain group object to a `Group` object instance. */
|
||||
export function objectToGroup<T extends GroupObject>(
|
||||
obj: T,
|
||||
scope: Record<string, any> = {}
|
||||
): ToGroup<T> {
|
||||
export function objectToGroup<T extends GroupObject>(obj: T): ToGroup<T> {
|
||||
const options: Record<string, AnyOption> = {}
|
||||
const groups: Record<string, AnyGroup> = {}
|
||||
if (obj.options) {
|
||||
for (const [name, option] of Object.entries(obj.options)) {
|
||||
options[name] = objectToOption(option, scope)
|
||||
options[name] = objectToOption(option)
|
||||
}
|
||||
}
|
||||
if (obj.groups) {
|
||||
for (const [name, group] of Object.entries(obj.groups)) {
|
||||
groups[name] = objectToGroup(group, scope)
|
||||
groups[name] = objectToGroup(group)
|
||||
}
|
||||
}
|
||||
const description = obj.description
|
||||
@ -481,21 +478,7 @@ export function objectToGroup<T extends GroupObject>(
|
||||
}
|
||||
|
||||
/** Convert the plain option object to an `Option` object instance. */
|
||||
export function objectToOption<T extends AnyOptionObject>(
|
||||
obj: T,
|
||||
scope: Record<string, any>
|
||||
): ToOption<T> {
|
||||
const code = obj.valueEval
|
||||
if (code != null) {
|
||||
/* eslint @typescript-eslint/no-implied-eval: "off" */
|
||||
const value: unknown = new Function('scope', 'return ' + code)(scope)
|
||||
const expectedType = typeof obj.value
|
||||
if (typeof value === typeof obj.value) {
|
||||
obj.value = value as OptionValue
|
||||
} else {
|
||||
logger.error(`The value of eval option '${code}' did not resolve to '${expectedType}'.`)
|
||||
}
|
||||
}
|
||||
export function objectToOption<T extends AnyOptionObject>(obj: T): ToOption<T> {
|
||||
return new Option(obj)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user