mirror of
https://github.com/enso-org/enso.git
synced 2024-12-21 17:41:32 +03:00
d2f6b1026a
- Close https://github.com/enso-org/cloud-v2/issues/866 - Remove *all* references to client keys and API base URLs from the codebase. - The app can still be built by external contributors. *However*, the cloud backend (among some other things) will be completely disabled, as the required keys and base URLs will be missing. - Add entry to `.gitignore` to allow `*.env` files in `app/ide-desktop/lib/dashboard/` # Important Notes - Tested (no `.env`; `.env` with prod backend; `.pbuchu.env`) on: - `npm run dev` in `app/ide-desktop/lib/dashboard/` - `./run ide build` - `./run ide2 build` - `./run gui watch`
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
/** @file Esbuild config file. */
|
|
import * as path from 'node:path'
|
|
|
|
import type * as esbuild from 'esbuild'
|
|
import esbuildPluginYaml from 'esbuild-plugin-yaml'
|
|
|
|
import * as appConfig from 'enso-common/src/appConfig'
|
|
import * as paths from './paths'
|
|
|
|
// ====================
|
|
// === Global setup ===
|
|
// ====================
|
|
|
|
await appConfig.readEnvironmentFromFile()
|
|
|
|
// ================
|
|
// === Bundling ===
|
|
// ================
|
|
|
|
/** Get the bundler options using the environment.
|
|
*
|
|
* The following environment variables are required:
|
|
* - `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(): esbuild.BuildOptions {
|
|
return bundlerOptions(
|
|
path.join(paths.getIdeDirectory(), 'client'),
|
|
paths.getProjectManagerInBundlePath(),
|
|
paths.getBundledEngineVersion()
|
|
)
|
|
}
|
|
|
|
/** Get options without relying on the environment. */
|
|
export function bundlerOptions(
|
|
outdir: string,
|
|
projectManagerInBundlePath: string,
|
|
bundledEngineVersion: string
|
|
): esbuild.BuildOptions {
|
|
return {
|
|
bundle: true,
|
|
outdir,
|
|
entryPoints: ['src/index.ts', 'src/preload.ts'],
|
|
outbase: 'src',
|
|
format: 'cjs',
|
|
platform: 'node',
|
|
plugins: [esbuildPluginYaml.yamlPlugin({})],
|
|
// The names come from a third-party API and cannot be changed.
|
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
outExtension: { '.js': '.cjs' },
|
|
define: {
|
|
BUNDLED_ENGINE_VERSION: JSON.stringify(bundledEngineVersion),
|
|
PROJECT_MANAGER_IN_BUNDLE_PATH: JSON.stringify(projectManagerInBundlePath),
|
|
},
|
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
sourcemap: true,
|
|
external: ['electron'],
|
|
}
|
|
}
|