@owdproject/core 3.3.1 → 4.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -59
- package/dist/dom/index.d.mts +65 -0
- package/dist/dom/index.d.ts +65 -0
- package/dist/dom/index.mjs +224 -0
- package/dist/events/index.d.mts +70 -0
- package/dist/events/index.d.ts +70 -0
- package/dist/events/index.mjs +3 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.mjs +115 -0
- package/dist/layout/index.d.mts +41 -0
- package/dist/layout/index.d.ts +41 -0
- package/dist/layout/index.mjs +64 -0
- package/dist/machines/index.d.mts +31 -0
- package/dist/machines/index.d.ts +31 -0
- package/dist/machines/index.mjs +2 -0
- package/dist/managers/index.d.mts +117 -0
- package/dist/managers/index.d.ts +117 -0
- package/dist/managers/index.mjs +6 -0
- package/dist/session/index.d.mts +57 -0
- package/dist/session/index.d.ts +57 -0
- package/dist/session/index.mjs +65 -0
- package/dist/shared/core.B0B0KfVK.mjs +865 -0
- package/dist/shared/core.B1XxB289.mjs +239 -0
- package/dist/shared/core.B3mp7ztE.mjs +237 -0
- package/dist/shared/core.BOvFdEVQ.d.ts +114 -0
- package/dist/shared/core.CsDFgGnX.mjs +40 -0
- package/dist/shared/core.Di1eFcr_.d.mts +114 -0
- package/dist/shared/core.Pd_Ogt4g.mjs +101 -0
- package/dist/shared/core.b3Xldzyu.mjs +29 -0
- package/dist/types/index.d.mts +266 -0
- package/dist/types/index.d.ts +266 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +60 -87
- package/bin/cli.js +0 -395
- package/bin/desktop.js +0 -5
- package/bin/lib/catalog.js +0 -293
- package/bin/lib/config.js +0 -109
- package/bin/lib/desktopConfig.js +0 -56
- package/bin/lib/generateTemplate.js +0 -389
- package/bin/lib/install.js +0 -408
- package/bin/lib/migrateModulePlayground.config.mjs +0 -164
- package/bin/lib/migrateModulePlayground.mjs +0 -313
- package/bin/lib/npmVersions.js +0 -124
- package/bin/lib/playgroundContext.js +0 -188
- package/bin/lib/scaffold.js +0 -197
- package/bin/lib/status.js +0 -289
- package/bin/lib/validateModule.js +0 -697
- package/bin/lib/workspace.js +0 -182
- package/bin/owd.js +0 -5
- package/bin/tui.js +0 -1379
- package/dist/module.d.mts +0 -13
- package/dist/module.json +0 -9
- package/dist/module.mjs +0 -268
- package/dist/types.d.mts +0 -7
- package/index.ts +0 -5
- package/module.ts +0 -223
- package/runtime/components/Desktop/Application/DesktopApplicationRender.vue +0 -20
- package/runtime/components/Desktop/Application/DesktopApplicationWindowsRender.vue +0 -38
- package/runtime/components/Desktop/Background/DesktopBackground.vue +0 -16
- package/runtime/components/Desktop/Core/DesktopCore.vue +0 -90
- package/runtime/components/Desktop/Time/DesktopTime.vue +0 -56
- package/runtime/components/Desktop/Window/DesktopWindow.vue +0 -204
- package/runtime/components/Desktop/Window/DesktopWindowContent.vue +0 -28
- package/runtime/components/Desktop/Window/DesktopWindowNav.vue +0 -66
- package/runtime/composables/useApplicationEntries.ts +0 -51
- package/runtime/composables/useApplicationManager.ts +0 -285
- package/runtime/composables/useDesktopManager.ts +0 -49
- package/runtime/composables/useTerminalManager.ts +0 -66
- package/runtime/composables/useWorkspaceManager.ts +0 -41
- package/runtime/internal/controllers/ApplicationController.ts +0 -345
- package/runtime/internal/controllers/WindowController.ts +0 -462
- package/runtime/plugins/02.desktop-register-desktop-apps.client.ts +0 -17
- package/runtime/plugins/resize.client.ts +0 -6
- package/runtime/stores/storeApplicationMeta.ts +0 -59
- package/runtime/stores/storeApplicationWindows.ts +0 -20
- package/runtime/stores/storeDesktop.ts +0 -111
- package/runtime/stores/storeDesktopDefaultApps.ts +0 -53
- package/runtime/stores/storeDesktopVolume.ts +0 -18
- package/runtime/stores/storeDesktopWindow.ts +0 -20
- package/runtime/stores/storeDesktopWorkspace.ts +0 -75
- package/runtime/utils/captureElementToCanvas.ts +0 -21
- package/runtime/utils/explorerEntryPath.ts +0 -10
- package/runtime/utils/resolveDesktopConfigPath.ts +0 -52
- package/runtime/utils/splitDesktopUserConfig.ts +0 -85
- package/runtime/utils/utilApp.ts +0 -37
- package/runtime/utils/utilCommon.ts +0 -26
- package/runtime/utils/utilDebug.ts +0 -30
- package/runtime/utils/utilDesktop.ts +0 -35
- package/runtime/utils/utilTerminal.ts +0 -6
- package/runtime/utils/utilWindow.ts +0 -15
- package/runtime/utils/validateDesktopUserConfig.ts +0 -44
- package/types/index.d.ts +0 -420
package/bin/lib/install.js
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
import { execSync, spawn } from 'node:child_process'
|
|
2
|
-
import { existsSync } from 'node:fs'
|
|
3
|
-
import { createRequire } from 'node:module'
|
|
4
|
-
import { dirname, join } from 'node:path'
|
|
5
|
-
import { fileURLToPath } from 'node:url'
|
|
6
|
-
import {
|
|
7
|
-
KINDS,
|
|
8
|
-
shortName as toShortName,
|
|
9
|
-
isWorkspaceInstallMode,
|
|
10
|
-
inferKind,
|
|
11
|
-
} from './workspace.js'
|
|
12
|
-
import {
|
|
13
|
-
resolveDesktopConfigPath,
|
|
14
|
-
desktopConfigWritePath,
|
|
15
|
-
} from './desktopConfig.js'
|
|
16
|
-
|
|
17
|
-
const require = createRequire(import.meta.url)
|
|
18
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
19
|
-
const desktopBin = join(__dirname, '..', 'desktop.js')
|
|
20
|
-
|
|
21
|
-
const SCOPE = '@owdproject/'
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {string | undefined} from
|
|
25
|
-
* @param {string} pkgShortName
|
|
26
|
-
* @param {boolean} inMonorepo
|
|
27
|
-
* @param {{ npm?: boolean, dev?: boolean }} [options]
|
|
28
|
-
*/
|
|
29
|
-
export function resolveSource(from, pkgShortName, inMonorepo, options = {}) {
|
|
30
|
-
const { npm = false, dev = false } = options
|
|
31
|
-
|
|
32
|
-
if (npm || from === 'npm' || from === 'registry') {
|
|
33
|
-
return { mode: 'npm', label: 'npm registry' }
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (dev && inMonorepo) {
|
|
37
|
-
return {
|
|
38
|
-
mode: 'workspace',
|
|
39
|
-
gitUrl: `https://github.com/owdproject/${pkgShortName}.git`,
|
|
40
|
-
label: `github.com/owdproject/${pkgShortName}`,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!from) {
|
|
45
|
-
return { mode: 'npm', label: 'npm registry' }
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (from === 'owdproject' || from === 'official') {
|
|
49
|
-
if (!inMonorepo) {
|
|
50
|
-
return { mode: 'npm', label: 'npm registry' }
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
mode: 'workspace',
|
|
54
|
-
gitUrl: `https://github.com/owdproject/${pkgShortName}.git`,
|
|
55
|
-
label: `github.com/owdproject/${pkgShortName}`,
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const trimmed = from.trim()
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
trimmed.startsWith('https://') ||
|
|
63
|
-
trimmed.startsWith('http://') ||
|
|
64
|
-
trimmed.startsWith('git@') ||
|
|
65
|
-
trimmed.startsWith('ssh://')
|
|
66
|
-
) {
|
|
67
|
-
return {
|
|
68
|
-
mode: 'workspace',
|
|
69
|
-
gitUrl: normalizeGitUrl(trimmed),
|
|
70
|
-
label: trimmed,
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const slug = trimmed
|
|
75
|
-
.replace(/^github:/, '')
|
|
76
|
-
.replace(/^fork:/, '')
|
|
77
|
-
.replace(/^https?:\/\/github\.com\//, '')
|
|
78
|
-
.replace(/\.git$/, '')
|
|
79
|
-
.replace(/\/$/, '')
|
|
80
|
-
|
|
81
|
-
if (slug.includes('/')) {
|
|
82
|
-
const gitUrl = normalizeGitUrl(`https://github.com/${slug}`)
|
|
83
|
-
return { mode: 'workspace', gitUrl, label: slug }
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!inMonorepo) {
|
|
87
|
-
return { mode: 'npm', label: 'npm registry' }
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
mode: 'workspace',
|
|
92
|
-
gitUrl: `https://github.com/${slug}/${pkgShortName}.git`,
|
|
93
|
-
label: `github.com/${slug}/${pkgShortName}`,
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function normalizeGitUrl(input) {
|
|
98
|
-
const trimmed = input.trim().replace(/\/$/, '')
|
|
99
|
-
if (trimmed.startsWith('git@') || trimmed.startsWith('ssh://')) return trimmed
|
|
100
|
-
if (/^https?:\/\//.test(trimmed)) {
|
|
101
|
-
return trimmed.endsWith('.git') ? trimmed : `${trimmed}.git`
|
|
102
|
-
}
|
|
103
|
-
const path = trimmed
|
|
104
|
-
.replace(/^github\.com\//, '')
|
|
105
|
-
.replace(/^https?:\/\/github\.com\//, '')
|
|
106
|
-
if (/^[\w.-]+\/[\w.-]+/.test(path)) {
|
|
107
|
-
return `https://github.com/${path.split('/').slice(0, 2).join('/')}.git`
|
|
108
|
-
}
|
|
109
|
-
throw new Error(`Could not parse git source: "${input}"`)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @param {string} workspaceRoot
|
|
114
|
-
* @param {string} pkgName full @owdproject/name
|
|
115
|
-
*/
|
|
116
|
-
export function hasLocalWorkspaceSource(workspaceRoot, pkgName) {
|
|
117
|
-
const pkgShort = toShortName(pkgName)
|
|
118
|
-
const kind = inferKind(pkgShort)
|
|
119
|
-
return existsSync(join(workspaceRoot, KINDS[kind].workspaceDir, pkgShort, 'package.json'))
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export async function resolveForkUser(githubUser, pkgShortName) {
|
|
123
|
-
if (!githubUser || githubUser === 'owdproject') return 'owdproject'
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
const res = await fetch(`https://api.github.com/repos/${githubUser}/${pkgShortName}`, {
|
|
127
|
-
headers: { Accept: 'application/vnd.github+json', 'User-Agent': 'owd-desktop-cli' },
|
|
128
|
-
})
|
|
129
|
-
if (res.ok) return githubUser
|
|
130
|
-
} catch {
|
|
131
|
-
/* ignore */
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return 'owdproject'
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @param {string} pkgName full @owdproject/name
|
|
139
|
-
* @param {import('./workspace.js').InstallMode extends infer M ? { installMode?: M, githubUser?: string | null } : never} settings
|
|
140
|
-
* @param {string | null} workspaceRoot
|
|
141
|
-
*/
|
|
142
|
-
export async function resolveInstallPlan(pkgName, settings, workspaceRoot) {
|
|
143
|
-
const pkgShort = toShortName(pkgName)
|
|
144
|
-
const kind = inferKind(pkgShort)
|
|
145
|
-
const inMonorepo = Boolean(workspaceRoot)
|
|
146
|
-
|
|
147
|
-
if (!isWorkspaceInstallMode(settings)) {
|
|
148
|
-
return {
|
|
149
|
-
mode: 'npm',
|
|
150
|
-
pkgName,
|
|
151
|
-
shortName: pkgShort,
|
|
152
|
-
kind,
|
|
153
|
-
label: 'npm registry',
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (!inMonorepo) {
|
|
158
|
-
return {
|
|
159
|
-
error:
|
|
160
|
-
'Dev install mode requires an OWD monorepo (apps/, packages/, themes/). Switch to User mode or use --npm.',
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const fromUser = settings.githubUser
|
|
165
|
-
? await resolveForkUser(settings.githubUser, pkgShort)
|
|
166
|
-
: 'owdproject'
|
|
167
|
-
|
|
168
|
-
const source = resolveSource(fromUser, pkgShort, true)
|
|
169
|
-
return {
|
|
170
|
-
mode: 'workspace',
|
|
171
|
-
pkgName,
|
|
172
|
-
shortName: pkgShort,
|
|
173
|
-
kind,
|
|
174
|
-
from: fromUser,
|
|
175
|
-
source,
|
|
176
|
-
targetDir: join(KINDS[kind].workspaceDir, pkgShort),
|
|
177
|
-
label: source.label,
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* @param {string} pkgName
|
|
183
|
-
* @param {{ installMode?: string, githubUser?: string | null }} settings
|
|
184
|
-
* @param {string} workspaceRoot
|
|
185
|
-
* @param {{ stdio?: 'inherit' | 'pipe' }} [options]
|
|
186
|
-
*/
|
|
187
|
-
export async function installPackage(pkgName, settings, workspaceRoot, options = {}) {
|
|
188
|
-
const plan = await resolveInstallPlan(pkgName, settings, workspaceRoot)
|
|
189
|
-
if (plan.error) throw new Error(plan.error)
|
|
190
|
-
|
|
191
|
-
const stdio = options.stdio ?? 'inherit'
|
|
192
|
-
const args = ['add', plan.shortName]
|
|
193
|
-
|
|
194
|
-
if (plan.mode === 'npm') {
|
|
195
|
-
args.push('--npm')
|
|
196
|
-
} else if (plan.from && plan.from !== 'owdproject') {
|
|
197
|
-
args.push('--from', plan.from)
|
|
198
|
-
} else {
|
|
199
|
-
args.push('--dev')
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
execSync(
|
|
203
|
-
`node ${JSON.stringify(desktopBin)} ${args.map((a) => JSON.stringify(a)).join(' ')}`,
|
|
204
|
-
{ cwd: workspaceRoot, stdio },
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
return plan
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export function runPrepareModules(workspaceRoot, stdio = 'inherit') {
|
|
211
|
-
try {
|
|
212
|
-
execSync('pnpm run prepare:modules', { cwd: workspaceRoot, stdio })
|
|
213
|
-
} catch {
|
|
214
|
-
/* optional in minimal workspaces */
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function loadConfigUtil(workspaceRoot) {
|
|
219
|
-
const utilPath = join(
|
|
220
|
-
workspaceRoot,
|
|
221
|
-
'node_modules/@owdproject/nx/dist/utils/utilConfig.js',
|
|
222
|
-
)
|
|
223
|
-
if (!existsSync(utilPath)) {
|
|
224
|
-
throw new Error('Workspace install needs @owdproject/nx. Run `pnpm install` at the repo root.')
|
|
225
|
-
}
|
|
226
|
-
return require(utilPath)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export function printPlan({ pkgName, kind, targetDir, source, branch, dryRun }) {
|
|
230
|
-
const kindMeta = KINDS[kind]
|
|
231
|
-
console.log(`
|
|
232
|
-
${dryRun ? 'Plan (dry run)' : 'Adding to desktop'}
|
|
233
|
-
────────────────────────────────────────
|
|
234
|
-
Package ${pkgName}
|
|
235
|
-
Type ${kindMeta.label}
|
|
236
|
-
Folder ${targetDir}/
|
|
237
|
-
Source ${source.label}${branch ? ` (branch: ${branch})` : ''}
|
|
238
|
-
Config desktop/desktop.config.ts → ${kindMeta.configKey}
|
|
239
|
-
────────────────────────────────────────
|
|
240
|
-
`)
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export function printNextSteps({ targetDir, dryRun }) {
|
|
244
|
-
if (dryRun) {
|
|
245
|
-
console.log('Dry run complete. Re-run without --dry-run to apply.\n')
|
|
246
|
-
return
|
|
247
|
-
}
|
|
248
|
-
console.log(`Next steps:
|
|
249
|
-
pnpm run dev Start the desktop
|
|
250
|
-
pnpm run prepare:modules Rebuild module stubs if needed
|
|
251
|
-
|
|
252
|
-
Package lives in ${targetDir}/
|
|
253
|
-
`)
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* @param {string} targetDir
|
|
258
|
-
* @param {string} gitUrl
|
|
259
|
-
* @param {string | undefined} branch
|
|
260
|
-
* @param {string} workspaceRoot
|
|
261
|
-
* @param {{ stdio?: 'inherit' | 'pipe' | 'ignore', quiet?: boolean }} [options]
|
|
262
|
-
*/
|
|
263
|
-
export function cloneRepo(targetDir, gitUrl, branch, workspaceRoot, options = {}) {
|
|
264
|
-
const stdio = options.stdio ?? 'inherit'
|
|
265
|
-
const quiet = options.quiet ?? stdio !== 'inherit'
|
|
266
|
-
const absoluteTarget = join(workspaceRoot, targetDir)
|
|
267
|
-
|
|
268
|
-
if (existsSync(join(absoluteTarget, 'package.json'))) {
|
|
269
|
-
if (!quiet) console.log(`Folder ${targetDir}/ already exists — skipping clone.\n`)
|
|
270
|
-
return
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (existsSync(absoluteTarget)) {
|
|
274
|
-
throw new Error(
|
|
275
|
-
`${targetDir}/ exists but has no package.json. Remove the folder or clone your fork there manually.`,
|
|
276
|
-
)
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
const branchArg = branch ? `-b ${JSON.stringify(branch)} ` : ''
|
|
280
|
-
if (!quiet) console.log(`Cloning into ${targetDir}/ …\n`)
|
|
281
|
-
execSync(
|
|
282
|
-
`git clone ${branchArg}${JSON.stringify(gitUrl)} ${JSON.stringify(absoluteTarget)}`,
|
|
283
|
-
{ stdio, cwd: workspaceRoot },
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function linkWorkspacePackage(desktopPath, pkgName, stdio = 'inherit') {
|
|
288
|
-
execSync(`pnpm add ${pkgName}@workspace:*`, {
|
|
289
|
-
stdio,
|
|
290
|
-
cwd: desktopPath,
|
|
291
|
-
})
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function runDevPrepare(workspaceRoot, pkgName, options = {}) {
|
|
295
|
-
const stdio = options.stdio ?? 'inherit'
|
|
296
|
-
const quiet = options.quiet ?? stdio !== 'inherit'
|
|
297
|
-
try {
|
|
298
|
-
execSync(`pnpm --filter "${pkgName}" run dev:prepare`, {
|
|
299
|
-
stdio,
|
|
300
|
-
cwd: workspaceRoot,
|
|
301
|
-
})
|
|
302
|
-
} catch {
|
|
303
|
-
if (!quiet) console.log('(no dev:prepare script — ok for some packages)\n')
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export async function runWorkspaceInstall({
|
|
308
|
-
pkgName,
|
|
309
|
-
shortName: pkgShort,
|
|
310
|
-
kind,
|
|
311
|
-
workspaceRoot,
|
|
312
|
-
source,
|
|
313
|
-
branch,
|
|
314
|
-
dryRun,
|
|
315
|
-
}) {
|
|
316
|
-
const { workspaceDir } = KINDS[kind]
|
|
317
|
-
const targetDir = join(workspaceDir, pkgShort)
|
|
318
|
-
const desktopPath = join(workspaceRoot, 'desktop')
|
|
319
|
-
const resolved = resolveDesktopConfigPath(desktopPath)
|
|
320
|
-
const configPath = resolved?.path ?? desktopConfigWritePath(desktopPath)
|
|
321
|
-
|
|
322
|
-
printPlan({
|
|
323
|
-
pkgName,
|
|
324
|
-
kind,
|
|
325
|
-
targetDir,
|
|
326
|
-
source,
|
|
327
|
-
branch,
|
|
328
|
-
dryRun,
|
|
329
|
-
})
|
|
330
|
-
|
|
331
|
-
if (dryRun) {
|
|
332
|
-
printNextSteps({ targetDir, dryRun: true })
|
|
333
|
-
return
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
cloneRepo(targetDir, source.gitUrl, branch, workspaceRoot)
|
|
337
|
-
linkWorkspacePackage(desktopPath, pkgName)
|
|
338
|
-
|
|
339
|
-
const { addToDesktopConfig } = loadConfigUtil(workspaceRoot)
|
|
340
|
-
addToDesktopConfig(configPath, KINDS[kind].configKey, pkgName)
|
|
341
|
-
|
|
342
|
-
runDevPrepare(workspaceRoot, pkgName)
|
|
343
|
-
|
|
344
|
-
console.log(`✓ ${pkgName} is ready.\n`)
|
|
345
|
-
printNextSteps({ targetDir, dryRun: false })
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export function runNpmInstall(kind, pkgName, workspaceRoot, stdio = 'inherit') {
|
|
349
|
-
const nxTarget = KINDS[kind].nx
|
|
350
|
-
const child = spawn('pnpm', ['nx', 'run', nxTarget, `--name=${pkgName}`], {
|
|
351
|
-
stdio,
|
|
352
|
-
shell: true,
|
|
353
|
-
cwd: workspaceRoot,
|
|
354
|
-
})
|
|
355
|
-
child.on('exit', (code) => {
|
|
356
|
-
if (stdio === 'inherit') process.exit(code ?? 1)
|
|
357
|
-
})
|
|
358
|
-
return child
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/** Preview label for TUI list rows */
|
|
362
|
-
/**
|
|
363
|
-
* @param {string} pkgName
|
|
364
|
-
* @param {{ installMode?: string, githubUser?: string | null }} settings
|
|
365
|
-
* @param {string} workspaceRoot
|
|
366
|
-
* @param {{ stdio?: 'inherit' | 'pipe' }} [options]
|
|
367
|
-
*/
|
|
368
|
-
export async function materializeToWorkspace(pkgName, settings, workspaceRoot, options = {}) {
|
|
369
|
-
const plan = await resolveInstallPlan(pkgName, settings, workspaceRoot)
|
|
370
|
-
if (plan.error) throw new Error(plan.error)
|
|
371
|
-
if (plan.mode !== 'workspace') {
|
|
372
|
-
throw new Error(`Cannot materialize ${pkgName}: install mode is not DEV (workspace).`)
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
if (hasLocalWorkspaceSource(workspaceRoot, pkgName)) {
|
|
376
|
-
return { skipped: true, plan }
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
const stdio = options.stdio ?? 'inherit'
|
|
380
|
-
const quiet = stdio !== 'inherit'
|
|
381
|
-
const desktopPath = join(workspaceRoot, 'desktop')
|
|
382
|
-
|
|
383
|
-
cloneRepo(plan.targetDir, plan.source.gitUrl, undefined, workspaceRoot, { stdio, quiet })
|
|
384
|
-
linkWorkspacePackage(desktopPath, pkgName, stdio)
|
|
385
|
-
runDevPrepare(workspaceRoot, pkgName, { stdio, quiet })
|
|
386
|
-
|
|
387
|
-
return { skipped: false, plan }
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/** @param {import('./catalog.js').CatalogEntry} item */
|
|
391
|
-
export function catalogListTag(item) {
|
|
392
|
-
if (item.localSource) return 'local'
|
|
393
|
-
if (item.installed && !item.localSource) return 'npm'
|
|
394
|
-
if (item.org === 'workspace') return 'local'
|
|
395
|
-
return 'catalog'
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
export function installTag(settings, item) {
|
|
399
|
-
const tag = catalogListTag(item)
|
|
400
|
-
if (tag === 'catalog') {
|
|
401
|
-
if (isWorkspaceInstallMode(settings)) {
|
|
402
|
-
const user = settings.githubUser
|
|
403
|
-
return user && user !== 'owdproject' ? 'git fork' : 'git'
|
|
404
|
-
}
|
|
405
|
-
return 'npm'
|
|
406
|
-
}
|
|
407
|
-
return tag
|
|
408
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/** @typedef {import('./migrateModulePlayground.mjs').MigrateConfig} MigrateConfig */
|
|
2
|
-
|
|
3
|
-
/** @type {MigrateConfig[]} */
|
|
4
|
-
export const configs = [
|
|
5
|
-
{
|
|
6
|
-
path: 'apps/app-todo',
|
|
7
|
-
slug: 'app-todo',
|
|
8
|
-
name: '@owdproject/app-todo',
|
|
9
|
-
moduleName: 'owd-app-todo',
|
|
10
|
-
version: '0.1.3',
|
|
11
|
-
keywords: ['owd-client', 'owd-apps', 'owd-modules'],
|
|
12
|
-
launch: {
|
|
13
|
-
file: 'launch-todo.client.ts',
|
|
14
|
-
pluginName: 'app-todo-playground-launch',
|
|
15
|
-
dependsOn: 'owd-app-todo-register',
|
|
16
|
-
appId: 'org.owdproject.todo',
|
|
17
|
-
command: 'todo',
|
|
18
|
-
},
|
|
19
|
-
pagesYml: true,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
path: 'apps/app-terminal',
|
|
23
|
-
slug: 'app-terminal',
|
|
24
|
-
name: '@owdproject/app-terminal',
|
|
25
|
-
moduleName: 'owd-app-terminal',
|
|
26
|
-
version: '0.1.3',
|
|
27
|
-
launch: {
|
|
28
|
-
file: 'launch-terminal.client.ts',
|
|
29
|
-
pluginName: 'app-terminal-playground-launch',
|
|
30
|
-
dependsOn: 'owd-app-terminal-register',
|
|
31
|
-
appId: 'org.owdproject.terminal',
|
|
32
|
-
command: 'terminal',
|
|
33
|
-
},
|
|
34
|
-
pagesYml: true,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
path: 'apps/app-debug',
|
|
38
|
-
slug: 'app-debug',
|
|
39
|
-
name: '@owdproject/app-debug',
|
|
40
|
-
moduleName: 'owd-app-debug',
|
|
41
|
-
version: '0.1.0',
|
|
42
|
-
launch: {
|
|
43
|
-
file: 'launch-debug.client.ts',
|
|
44
|
-
pluginName: 'app-debug-playground-launch',
|
|
45
|
-
dependsOn: 'owd-app-debug-register',
|
|
46
|
-
appId: 'org.owdproject.debug',
|
|
47
|
-
command: 'debug',
|
|
48
|
-
},
|
|
49
|
-
pagesYml: true,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
path: 'apps/app-dino',
|
|
53
|
-
slug: 'app-dino',
|
|
54
|
-
name: '@owdproject/app-dino',
|
|
55
|
-
moduleName: 'owd-app-dino',
|
|
56
|
-
version: '0.0.1',
|
|
57
|
-
private: true,
|
|
58
|
-
launch: {
|
|
59
|
-
file: 'launch-dino.client.ts',
|
|
60
|
-
pluginName: 'app-dino-playground-launch',
|
|
61
|
-
dependsOn: 'owd-app-dino-register',
|
|
62
|
-
appId: 'org.owdproject.dino',
|
|
63
|
-
command: 'dino',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
path: 'apps/app-soundcloud',
|
|
68
|
-
slug: 'app-soundcloud',
|
|
69
|
-
name: '@owdproject/app-soundcloud',
|
|
70
|
-
moduleName: 'owd-app-soundcloud',
|
|
71
|
-
version: '0.1.0',
|
|
72
|
-
launch: {
|
|
73
|
-
file: 'launch-soundcloud.client.ts',
|
|
74
|
-
pluginName: 'app-soundcloud-playground-launch',
|
|
75
|
-
dependsOn: 'owd-app-soundcloud-register',
|
|
76
|
-
appId: 'org.owdproject.soundcloud',
|
|
77
|
-
command: 'soundcloud --new --no-check',
|
|
78
|
-
},
|
|
79
|
-
pagesYml: true,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
path: 'apps/app-youtube',
|
|
83
|
-
slug: 'app-youtube',
|
|
84
|
-
name: '@owdproject/app-youtube',
|
|
85
|
-
moduleName: 'owd-app-youtube',
|
|
86
|
-
version: '0.1.0',
|
|
87
|
-
launch: {
|
|
88
|
-
file: 'launch-youtube.client.ts',
|
|
89
|
-
pluginName: 'app-youtube-playground-launch',
|
|
90
|
-
dependsOn: 'owd-app-youtube-register',
|
|
91
|
-
appId: 'org.owdproject.youtube',
|
|
92
|
-
command: 'youtube --new --no-check',
|
|
93
|
-
},
|
|
94
|
-
pagesYml: true,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
path: 'apps/app-classic-audioplayer',
|
|
98
|
-
slug: 'app-classic-audioplayer',
|
|
99
|
-
name: '@owdproject/app-classic-audioplayer',
|
|
100
|
-
moduleName: 'owd-app-classic-audioplayer',
|
|
101
|
-
version: '0.0.4',
|
|
102
|
-
playgroundModules: ['@owdproject/module-fs', '@owdproject/module-persistence'],
|
|
103
|
-
playgroundApps: ['@owdproject/app-classic-audioplayer'],
|
|
104
|
-
fsMounts: { '/mnt/test': '/test.zip' },
|
|
105
|
-
copyTestZip: true,
|
|
106
|
-
playgroundExtraDevDeps: {
|
|
107
|
-
'@owdproject/module-fs': '^0.0.4',
|
|
108
|
-
'@owdproject/module-persistence': '^0.0.2',
|
|
109
|
-
},
|
|
110
|
-
launch: {
|
|
111
|
-
file: 'launch-audioplayer.client.ts',
|
|
112
|
-
pluginName: 'app-classic-audioplayer-playground-launch',
|
|
113
|
-
dependsOn: 'owd-app-classic-audioplayer-register',
|
|
114
|
-
appId: 'org.owdproject.classic-audioplayer',
|
|
115
|
-
command: 'classic-audioplayer',
|
|
116
|
-
fsDemo: true,
|
|
117
|
-
},
|
|
118
|
-
pagesYml: true,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
path: 'apps/app-classic-videoplayer',
|
|
122
|
-
slug: 'app-classic-videoplayer',
|
|
123
|
-
name: '@owdproject/app-classic-videoplayer',
|
|
124
|
-
moduleName: 'owd-app-classic-videoplayer',
|
|
125
|
-
version: '0.0.4',
|
|
126
|
-
launch: {
|
|
127
|
-
file: 'launch-videoplayer.client.ts',
|
|
128
|
-
pluginName: 'app-classic-videoplayer-playground-launch',
|
|
129
|
-
dependsOn: 'owd-app-classic-videoplayer-register',
|
|
130
|
-
appId: 'org.owdproject.classic-videoplayer',
|
|
131
|
-
command: 'classic-videoplayer',
|
|
132
|
-
},
|
|
133
|
-
pagesYml: true,
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
path: 'apps/app-explorer',
|
|
137
|
-
slug: 'app-explorer',
|
|
138
|
-
name: '@owdproject/app-explorer',
|
|
139
|
-
moduleName: 'owd-app-explorer',
|
|
140
|
-
version: '0.0.4',
|
|
141
|
-
playgroundModules: ['@owdproject/module-fs', '@owdproject/module-persistence'],
|
|
142
|
-
playgroundApps: ['@owdproject/app-explorer'],
|
|
143
|
-
fsMounts: { '/mnt/test': '/test.zip' },
|
|
144
|
-
copyTestZip: true,
|
|
145
|
-
playgroundExtraDevDeps: {
|
|
146
|
-
'@owdproject/module-fs': '^0.0.4',
|
|
147
|
-
'@owdproject/module-persistence': '^0.0.2',
|
|
148
|
-
'@owdproject/kit-fs': 'workspace:*',
|
|
149
|
-
'@owdproject/kit-explorer': 'workspace:*',
|
|
150
|
-
},
|
|
151
|
-
dependencies: {
|
|
152
|
-
'@owdproject/kit-explorer': 'workspace:*',
|
|
153
|
-
'@owdproject/kit-fs': 'workspace:*',
|
|
154
|
-
},
|
|
155
|
-
launch: {
|
|
156
|
-
file: 'launch-explorer.client.ts',
|
|
157
|
-
pluginName: 'app-explorer-playground-launch',
|
|
158
|
-
dependsOn: 'owd-app-explorer-register',
|
|
159
|
-
appId: 'org.owdproject.explorer',
|
|
160
|
-
command: 'explorer /mnt/test',
|
|
161
|
-
},
|
|
162
|
-
pagesYml: true,
|
|
163
|
-
},
|
|
164
|
-
]
|