Restructure app/ide-desktop/client/ for consistency with other modules (#10649)

- Change paths from `foo-bar` to `@/fooBar` to be consistent with GUI module naming

# Important Notes
None
This commit is contained in:
somebody1234 2024-07-27 01:14:31 +10:00 committed by GitHub
parent c4e8ae143e
commit fde2f71419
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 56 additions and 52 deletions

View File

@ -33,7 +33,7 @@ const NAME = 'enso'
const DEFAULT_IMPORT_ONLY_MODULES =
'@vitejs\\u002Fplugin-react|node:process|chalk|string-length|yargs|yargs\\u002Fyargs|sharp|to-ico|connect|morgan|serve-static|tiny-invariant|clsx|create-servers|electron-is-dev|fast-glob|esbuild-plugin-.+|opener|tailwindcss.*|@modyfi\\u002Fvite-plugin-yaml|build-info|is-network-error|validator.+|.*[.]json$'
const RELATIVE_MODULES =
'bin\\u002Fproject-manager|bin\\u002Fserver|config\\u002Fparser|authentication|config|debug|detect|file-associations|index|ipc|log|naming|paths|preload|project-management|security|url-associations|content-config|desktop-environment|#\\u002F.*'
'projectManager|server|configParser|authentication|config|debug|detect|fileAssociations|index|ipc|log|naming|paths|preload|projectManagement|security|urlAssociations|contentConfig|desktopEnvironment|#\\u002F.*'
const ALLOWED_DEFAULT_IMPORT_MODULES = `${DEFAULT_IMPORT_ONLY_MODULES}|postcss|ajv\\u002Fdist\\u002F2020|${RELATIVE_MODULES}`
const STRING_LITERAL = ':matches(Literal[raw=/^["\']/], TemplateLiteral)'
const NOT_CAMEL_CASE = '/^(?!_?[a-z][a-z0-9*]*([A-Z0-9][a-z0-9]*)*$)(?!React$)/'

View File

@ -1,7 +1,7 @@
/** @file Script that bundles JS client code. */
import * as esbuild from 'esbuild'
import * as bundler from './esbuild-config'
import * as bundler from './esbuildConfig'
// ================
// === Bundling ===

View File

@ -15,12 +15,12 @@ import yargs from 'yargs'
import * as common from 'enso-common'
import * as fileAssociations from './file-associations'
import * as fileAssociations from './fileAssociations'
import * as paths from './paths'
import computeHashes from './tasks/computeHashes.mjs'
import signArchivesMacOs from './tasks/signArchivesMacOs'
import BUILD_INFO from './build-info'
import BUILD_INFO from './buildInfo'
// =============
// === Types ===

View File

@ -1,5 +1,6 @@
/** @file Esbuild config file. */
import * as path from 'node:path'
import { fileURLToPath } from 'node:url'
import type * as esbuild from 'esbuild'
import esbuildPluginYaml from 'esbuild-plugin-yaml'
@ -50,6 +51,9 @@ export function bundlerOptions(
// The names come from a third-party API and cannot be changed.
/* eslint-disable @typescript-eslint/naming-convention */
outExtension: { '.js': '.cjs' },
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
define: {
'process.env.PROJECT_MANAGER_IN_BUNDLE_PATH': JSON.stringify(projectManagerInBundlePath),
'process.env.ELECTRON_DEV_MODE': JSON.stringify(String(devMode)),

View File

@ -80,9 +80,9 @@ import opener from 'opener'
import * as common from 'enso-common'
import type * as dashboard from 'enso-dashboard'
import * as contentConfig from 'content-config'
import * as ipc from 'ipc'
import * as urlAssociations from 'url-associations'
import * as contentConfig from '@/contentConfig'
import * as ipc from '@/ipc'
import * as urlAssociations from '@/urlAssociations'
const logger = contentConfig.logger

View File

@ -3,9 +3,9 @@
import chalk from 'chalk'
import * as contentConfig from 'content-config'
import * as naming from 'naming'
import * as paths from 'paths'
import * as contentConfig from '@/contentConfig'
import * as naming from '@/naming'
import * as paths from '@/paths'
// =================
// === Constants ===

View File

@ -6,11 +6,11 @@ import stringLength from 'string-length'
// eslint-disable-next-line no-restricted-syntax
import yargs, { type Options } from 'yargs'
import * as config from 'config'
import * as contentConfig from 'content-config'
import * as fileAssociations from 'file-associations'
import * as naming from 'naming'
import BUILD_INFO from '../../build-info'
import * as config from '@/config'
import * as contentConfig from '@/contentConfig'
import * as fileAssociations from '@/fileAssociations'
import * as naming from '@/naming'
import BUILD_INFO from '../buildInfo'
const logger = contentConfig.logger

View File

@ -3,7 +3,7 @@
import * as semver from 'semver'
import * as linkedDist from 'enso-runner/src/runner'
import BUILD_INFO from '../build-info'
import BUILD_INFO from '../buildInfo'
// Aliases with the same name as the original.
// eslint-disable-next-line no-restricted-syntax

View File

@ -2,7 +2,7 @@
import * as buildUtils from 'enso-common/src/buildUtils'
import BUILD_INFO from '../build-info'
import BUILD_INFO from '../buildInfo'
// ==================
// === Debug Info ===

View File

@ -13,10 +13,10 @@ import electronIsDev from 'electron-is-dev'
import * as common from 'enso-common'
import type * as clientConfig from 'config'
import * as contentConfig from 'content-config'
import * as project from 'project-management'
import * as fileAssociations from '../file-associations'
import type * as clientConfig from '@/config'
import * as contentConfig from '@/contentConfig'
import * as project from '@/projectManagement'
import * as fileAssociations from '../fileAssociations'
const logger = contentConfig.logger

View File

@ -18,22 +18,22 @@ import * as common from 'enso-common'
import * as buildUtils from 'enso-common/src/buildUtils'
import GLOBAL_CONFIG from 'enso-common/src/config.json' assert { type: 'json' }
import * as authentication from 'authentication'
import * as projectManager from 'bin/project-manager'
import * as server from 'bin/server'
import * as config from 'config'
import * as configParser from 'config/parser'
import * as contentConfig from 'content-config'
import * as debug from 'debug'
import * as detect from 'detect'
import * as fileAssociations from 'file-associations'
import * as ipc from 'ipc'
import * as log from 'log'
import * as naming from 'naming'
import * as paths from 'paths'
import * as projectManagement from 'project-management'
import * as security from 'security'
import * as urlAssociations from 'url-associations'
import * as authentication from '@/authentication'
import * as config from '@/config'
import * as configParser from '@/configParser'
import * as contentConfig from '@/contentConfig'
import * as debug from '@/debug'
import * as detect from '@/detect'
import * as fileAssociations from '@/fileAssociations'
import * as ipc from '@/ipc'
import * as log from '@/log'
import * as naming from '@/naming'
import * as paths from '@/paths'
import * as projectManagement from '@/projectManagement'
import * as projectManager from '@/projectManager'
import * as security from '@/security'
import * as server from '@/server'
import * as urlAssociations from '@/urlAssociations'
const logger = contentConfig.logger

View File

@ -11,8 +11,8 @@ import * as pathModule from 'node:path'
import * as linkedDist from 'enso-runner/src/runner'
import * as contentConfig from 'content-config'
import * as paths from 'paths'
import * as contentConfig from '@/contentConfig'
import * as paths from '@/paths'
// ================
// === Log File ===

View File

@ -7,9 +7,9 @@ import * as electron from 'electron'
import type * as dashboard from 'enso-dashboard'
import * as debug from 'debug'
import * as ipc from 'ipc'
import type * as projectManagement from 'project-management'
import * as debug from '@/debug'
import * as ipc from '@/ipc'
import type * as projectManagement from '@/projectManagement'
// =================
// === Constants ===

View File

@ -18,7 +18,7 @@ import * as tar from 'tar'
import * as common from 'enso-common'
import * as buildUtils from 'enso-common/src/buildUtils'
import * as desktopEnvironment from 'desktop-environment'
import * as desktopEnvironment from '@/desktopEnvironment'
const logger = console

View File

@ -4,9 +4,9 @@ import * as childProcess from 'node:child_process'
import * as fsSync from 'node:fs'
import * as util from 'node:util'
import * as contentConfig from 'content-config'
import * as contentConfig from '@/contentConfig'
import type * as config from 'config'
import type * as config from '@/config'
const logger = contentConfig.logger
// This is a wrapped function, so it should be `camelCase`.

View File

@ -12,13 +12,13 @@ import * as mime from 'mime-types'
import * as portfinder from 'portfinder'
import type * as vite from 'vite'
import * as projectManagement from '@/projectManagement'
import * as common from 'enso-common'
import GLOBAL_CONFIG from 'enso-common/src/config.json' assert { type: 'json' }
import * as ydocServer from 'enso-gui2/ydoc-server'
import * as projectManagement from 'project-management'
import * as contentConfig from 'content-config'
import * as paths from 'paths'
import * as contentConfig from '@/contentConfig'
import * as paths from '@/paths'
const logger = contentConfig.logger

View File

@ -5,7 +5,7 @@ import electronIsDev from 'electron-is-dev'
import * as common from 'enso-common'
import * as contentConfig from 'content-config'
import * as contentConfig from '@/contentConfig'
const logger = contentConfig.logger

View File

@ -1,8 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./src",
"esModuleInterop": true
"esModuleInterop": true,
"paths": { "@/*": ["./src/*"] }
},
"include": [
".",

View File

@ -13,7 +13,7 @@ import process from 'node:process'
import * as esbuild from 'esbuild'
import * as clientBundler from './esbuild-config'
import * as clientBundler from './esbuildConfig'
import * as paths from './paths'
// =============