2021-11-05 14:51:43 +03:00
|
|
|
const path = require('path')
|
2020-12-23 01:14:52 +03:00
|
|
|
const os = require('os')
|
2020-03-16 05:58:00 +03:00
|
|
|
|
|
|
|
// =============
|
|
|
|
// === Paths ===
|
|
|
|
// =============
|
|
|
|
|
2021-11-05 14:51:43 +03:00
|
|
|
let paths = {}
|
2020-03-16 05:58:00 +03:00
|
|
|
|
2021-11-05 14:51:43 +03:00
|
|
|
paths.root = path.dirname(__dirname)
|
2021-10-30 18:06:21 +03:00
|
|
|
|
2021-11-05 14:51:43 +03:00
|
|
|
paths.github = {}
|
2021-11-16 12:04:56 +03:00
|
|
|
paths.github.root = path.join(paths.root, '.github')
|
2021-11-05 14:51:43 +03:00
|
|
|
paths.github.workflows = path.join(paths.github.root, 'workflows')
|
2020-03-16 05:58:00 +03:00
|
|
|
|
2021-11-05 14:51:43 +03:00
|
|
|
paths.script = {}
|
|
|
|
paths.script.main = path.join(paths.root, 'run')
|
|
|
|
paths.script.root = path.join(paths.root, 'build')
|
|
|
|
paths.script.run = path.join(paths.script.root, 'run')
|
2020-03-16 05:58:00 +03:00
|
|
|
|
2021-11-05 14:51:43 +03:00
|
|
|
paths.dist = {}
|
|
|
|
paths.dist.root = path.join(paths.root, 'dist')
|
|
|
|
paths.dist.client = path.join(paths.dist.root, 'client')
|
|
|
|
paths.dist.content = path.join(paths.dist.root, 'content')
|
2022-01-10 12:18:34 +03:00
|
|
|
paths.dist.assets = path.join(paths.dist.content, 'assets')
|
|
|
|
paths.dist.packageJson = path.join(paths.dist.content, 'package.json')
|
|
|
|
paths.dist.preload = path.join(paths.dist.content, 'preload.js')
|
2021-11-05 14:51:43 +03:00
|
|
|
paths.dist.bin = path.join(paths.dist.root, 'bin')
|
|
|
|
paths.dist.init = path.join(paths.dist.root, 'init')
|
|
|
|
paths.dist.buildInit = path.join(paths.dist.root, 'build-init')
|
|
|
|
paths.dist.buildInfo = path.join(paths.dist.root, 'build.json')
|
|
|
|
paths.dist.tmp = path.join(paths.dist.root, 'tmp')
|
2020-03-16 05:58:00 +03:00
|
|
|
|
2022-01-10 12:18:34 +03:00
|
|
|
const WASM_MAIN = 'ide.wasm'
|
|
|
|
const WASM_MAIN_RAW = 'ide_bg.wasm'
|
|
|
|
const WASM_GLUE = 'ide.js'
|
|
|
|
|
|
|
|
// Final WASM artifacts in `dist` directory.
|
2021-11-05 14:51:43 +03:00
|
|
|
paths.dist.wasm = {}
|
|
|
|
paths.dist.wasm.root = path.join(paths.dist.root, 'wasm')
|
2022-01-10 12:18:34 +03:00
|
|
|
paths.dist.wasm.main = path.join(paths.dist.wasm.root, WASM_MAIN)
|
|
|
|
paths.dist.wasm.mainRaw = path.join(paths.dist.wasm.root, WASM_MAIN_RAW)
|
|
|
|
paths.dist.wasm.glue = path.join(paths.dist.wasm.root, WASM_GLUE)
|
|
|
|
|
|
|
|
// Intermediate WASM artifacts.
|
|
|
|
paths.wasm = {}
|
|
|
|
paths.wasm.root = path.resolve(os.tmpdir(), 'enso-wasm')
|
|
|
|
paths.wasm.main = path.join(paths.wasm.root, WASM_MAIN)
|
|
|
|
paths.wasm.mainRaw = path.join(paths.wasm.root, WASM_MAIN_RAW)
|
|
|
|
paths.wasm.glue = path.join(paths.wasm.root, WASM_GLUE)
|
|
|
|
paths.wasm.mainGz = path.join(paths.wasm.root, 'ide.wasm.gz')
|
2020-03-16 05:58:00 +03:00
|
|
|
|
2021-11-16 12:04:56 +03:00
|
|
|
paths.ide_desktop = {}
|
|
|
|
paths.ide_desktop.lib = {}
|
|
|
|
paths.ide_desktop.root = path.join(paths.root, 'app', 'ide-desktop')
|
|
|
|
paths.ide_desktop.lib.projectManager = path.join(paths.ide_desktop.root, 'lib', 'project-manager')
|
|
|
|
paths.ide_desktop.lib.content = path.join(paths.ide_desktop.root, 'lib', 'content')
|
2020-03-16 05:58:00 +03:00
|
|
|
|
2021-11-16 12:04:56 +03:00
|
|
|
paths.gui = {}
|
|
|
|
paths.gui.root = path.join(paths.root, 'app', 'gui')
|
2020-03-16 05:58:00 +03:00
|
|
|
|
2020-12-23 01:14:52 +03:00
|
|
|
function get_project_manager_extension() {
|
|
|
|
const target_platform = os.platform()
|
|
|
|
switch (target_platform) {
|
|
|
|
case 'win32':
|
|
|
|
return '.exe'
|
|
|
|
default:
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
paths.get_project_manager_path = function (root) {
|
2021-11-05 14:51:43 +03:00
|
|
|
let base_path = path.join(root, 'enso', 'bin')
|
2020-12-23 01:14:52 +03:00
|
|
|
const extension = get_project_manager_extension()
|
|
|
|
return path.join(base_path, 'project-manager') + extension
|
|
|
|
}
|
|
|
|
|
2020-03-16 05:58:00 +03:00
|
|
|
module.exports = paths
|