@intra-mart/accel 1.0.0 → 2.0.0-dev.202610210621
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 +93 -6
- package/dist/asset/deployer.js +1 -2
- package/dist/asset/fetch-once.d.ts +2 -0
- package/dist/asset/fetch-once.js +14 -0
- package/dist/asset/mobile-meta.d.ts +15 -0
- package/dist/asset/mobile-meta.js +86 -0
- package/dist/asset/root-selection.d.ts +12 -0
- package/dist/asset/root-selection.js +78 -0
- package/dist/asset/updater.js +1 -1
- package/dist/asset/walker.d.ts +1 -1
- package/dist/asset/walker.js +3 -26
- package/dist/commands/attach-existing-files.d.ts +12 -0
- package/dist/commands/attach-existing-files.js +76 -0
- package/dist/commands/attach.d.ts +20 -0
- package/dist/commands/attach.js +77 -77
- package/dist/commands/deploy.js +16 -13
- package/dist/commands/detach.js +7 -3
- package/dist/commands/init.d.ts +20 -0
- package/dist/commands/init.js +71 -4
- package/dist/commands/login.js +12 -6
- package/dist/commands/mobile/attach.d.ts +7 -0
- package/dist/commands/mobile/attach.js +60 -0
- package/dist/commands/mobile/init.d.ts +4 -0
- package/dist/commands/mobile/init.js +95 -0
- package/dist/commands/mobile/shared.d.ts +65 -0
- package/dist/commands/mobile/shared.js +254 -0
- package/dist/commands/mobile/update.d.ts +8 -0
- package/dist/commands/mobile/update.js +109 -0
- package/dist/commands/mobile-sdk-options.d.ts +10 -0
- package/dist/commands/mobile-sdk-options.js +19 -0
- package/dist/commands/preset.d.ts +1 -1
- package/dist/commands/preset.js +35 -13
- package/dist/commands/project-type-select.d.ts +17 -0
- package/dist/commands/project-type-select.js +26 -0
- package/dist/commands/switch.d.ts +1 -1
- package/dist/commands/switch.js +118 -48
- package/dist/commands/update.d.ts +22 -0
- package/dist/commands/update.js +179 -106
- package/dist/core/condition-evaluator.js +4 -1
- package/dist/core/constants.d.ts +12 -2
- package/dist/core/constants.js +16 -0
- package/dist/core/eval-context.js +27 -0
- package/dist/core/project-type.d.ts +20 -0
- package/dist/core/project-type.js +49 -0
- package/dist/core/types.d.ts +28 -9
- package/dist/core/types.js +2 -0
- package/dist/core/validation.d.ts +2 -2
- package/dist/core/validators.d.ts +7 -0
- package/dist/core/validators.js +38 -1
- package/dist/core/variable-interpolator.js +2 -0
- package/dist/i18n/en.js +59 -0
- package/dist/i18n/ja.js +59 -0
- package/dist/i18n/zh_CN.js +59 -0
- package/dist/interactive/agent-detect.d.ts +1 -1
- package/dist/interactive/agent-detect.js +6 -6
- package/dist/interactive/mobile-prompts.d.ts +15 -0
- package/dist/interactive/mobile-prompts.js +45 -0
- package/dist/interactive/next-steps.d.ts +4 -0
- package/dist/interactive/next-steps.js +11 -0
- package/dist/interactive/prompts.d.ts +5 -2
- package/dist/interactive/prompts.js +23 -19
- package/dist/interactive/summary.d.ts +5 -3
- package/dist/interactive/summary.js +38 -0
- package/dist/lib.d.ts +11 -5
- package/dist/lib.js +6 -3
- package/dist/utils/args.d.ts +1 -0
- package/dist/utils/args.js +16 -0
- package/dist/utils/expo-project.d.ts +8 -0
- package/dist/utils/expo-project.js +54 -0
- package/dist/utils/external-command.d.ts +68 -0
- package/dist/utils/external-command.js +238 -0
- package/dist/utils/preset-io.d.ts +1 -0
- package/dist/utils/preset-io.js +18 -1
- package/dist/utils/settings-io.d.ts +1 -0
- package/dist/utils/settings-io.js +12 -0
- package/package.json +1 -1
package/dist/commands/preset.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { defineCommand } from "citty";
|
|
3
3
|
import * as p from "@clack/prompts";
|
|
4
|
+
import { isMobileSettings } from "../core/types.js";
|
|
5
|
+
import { collectOptionsNotForProjectType, formatOptionsNotForProjectType, } from "../core/project-type.js";
|
|
4
6
|
import { findReleaseById } from "../core/catalog.js";
|
|
5
|
-
import {
|
|
7
|
+
import { MOBILE_AGENT_OPTIONS } from "../core/constants.js";
|
|
8
|
+
import { createMobileValidators, createPresetNameValidator, } from "../core/validators.js";
|
|
6
9
|
import { printIntro, promptModules, promptFeatures, promptAgents, } from "../interactive/prompts.js";
|
|
7
10
|
import { collectSettingsErrors } from "../core/validation.js";
|
|
8
11
|
import { withHint, displayWidth } from "../interactive/format.js";
|
|
@@ -10,13 +13,13 @@ import { createCancelledError } from "../core/errors.js";
|
|
|
10
13
|
import { withExitCode } from "./run-wrapper.js";
|
|
11
14
|
import { getMessage } from "../i18n/index.js";
|
|
12
15
|
import { detectLocale } from "../utils/locale-detect.js";
|
|
13
|
-
import {
|
|
16
|
+
import { readProjectSettings } from "../utils/settings-io.js";
|
|
14
17
|
import { presetPath, writePreset, presetExists, deletePreset, listPresetSummaries, formatPresetDisplayName, } from "../utils/preset-io.js";
|
|
15
18
|
import { sanitizeDisplayText } from "../utils/sanitize-text.js";
|
|
16
19
|
const requirePresetContext = async (argLocale) => {
|
|
17
20
|
const projectDir = process.cwd();
|
|
18
21
|
const fallbackLocale = argLocale ?? detectLocale();
|
|
19
|
-
const settings = await
|
|
22
|
+
const settings = await readProjectSettings(projectDir, fallbackLocale);
|
|
20
23
|
if (!settings) {
|
|
21
24
|
throw new Error(getMessage("preset.error.noSettings", fallbackLocale));
|
|
22
25
|
}
|
|
@@ -63,7 +66,7 @@ const resolveConfirmInput = (input) => {
|
|
|
63
66
|
export const runPresetCreateInteractive = async (ctx, release, cli, force = false, prompts = defaultPrompts) => {
|
|
64
67
|
const { projectDir, locale } = ctx;
|
|
65
68
|
const nameValidator = createPresetNameValidator(locale);
|
|
66
|
-
const allModuleIds = release
|
|
69
|
+
const allModuleIds = release?.modules.map((m) => m.artifactId) ?? [];
|
|
67
70
|
printIntro("preset", locale);
|
|
68
71
|
let first = true;
|
|
69
72
|
let again = true;
|
|
@@ -103,9 +106,13 @@ export const runPresetCreateInteractive = async (ctx, release, cli, force = fals
|
|
|
103
106
|
: resolveTextInput(await prompts.text({
|
|
104
107
|
message: withHint("preset.prompt.description", locale),
|
|
105
108
|
}));
|
|
106
|
-
const modules =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
const modules = release
|
|
110
|
+
? await prompts.modules(release, (first ? cli.modules : undefined) ?? allModuleIds, locale)
|
|
111
|
+
: [];
|
|
112
|
+
const features = release
|
|
113
|
+
? await prompts.features(release, first ? cli.features : undefined, locale)
|
|
114
|
+
: [];
|
|
115
|
+
const agents = await prompts.agents(first ? cli.agents : undefined, locale, release ? undefined : "prompt.mobileAgent", release ? undefined : MOBILE_AGENT_OPTIONS);
|
|
109
116
|
await writePreset(projectDir, buildPreset(name, label, description, modules, features, agents));
|
|
110
117
|
p.log.success(getMessage("preset.created", locale, { name }));
|
|
111
118
|
again = resolveConfirmInput(await prompts.confirm({
|
|
@@ -184,6 +191,13 @@ const createCommand = defineCommand({
|
|
|
184
191
|
? undefined
|
|
185
192
|
: agentArg.split(",").map((a) => a.trim()),
|
|
186
193
|
};
|
|
194
|
+
const mobile = isMobileSettings(settings);
|
|
195
|
+
if (mobile) {
|
|
196
|
+
const notFor = collectOptionsNotForProjectType({ module: cli.modules, feature: cli.features }, "mobile");
|
|
197
|
+
if (notFor.length > 0) {
|
|
198
|
+
throw new Error(formatOptionsNotForProjectType(notFor, "mobile", locale));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
187
201
|
const errors = [];
|
|
188
202
|
if (cli.name !== undefined) {
|
|
189
203
|
const nameError = createPresetNameValidator(locale)(cli.name);
|
|
@@ -193,14 +207,22 @@ const createCommand = defineCommand({
|
|
|
193
207
|
errors.push(...collectSettingsErrors({
|
|
194
208
|
module: cli.modules,
|
|
195
209
|
feature: cli.features,
|
|
196
|
-
agent: cli.agents,
|
|
210
|
+
agent: mobile ? undefined : cli.agents,
|
|
197
211
|
locale,
|
|
198
212
|
isInit: false,
|
|
199
|
-
}, locale, settings.accelplatformVersion.label));
|
|
213
|
+
}, locale, mobile ? undefined : settings.accelplatformVersion.label));
|
|
214
|
+
if (mobile) {
|
|
215
|
+
const agentValidator = createMobileValidators(locale).agent;
|
|
216
|
+
for (const agent of cli.agents ?? []) {
|
|
217
|
+
const error = agentValidator(agent);
|
|
218
|
+
if (error)
|
|
219
|
+
errors.push(error);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
200
222
|
if (errors.length > 0) {
|
|
201
223
|
throw new Error(errors.join("\n"));
|
|
202
224
|
}
|
|
203
|
-
const release = resolveRelease(settings, locale);
|
|
225
|
+
const release = mobile ? null : resolveRelease(settings, locale);
|
|
204
226
|
const isInteractive = !args["non-interactive"];
|
|
205
227
|
if (isInteractive) {
|
|
206
228
|
await runPresetCreateInteractive(ctx, release, cli, args.force);
|
|
@@ -211,9 +233,9 @@ const createCommand = defineCommand({
|
|
|
211
233
|
requiredErrors.push(getMessage("preset.error.missingName", locale, { command: "create" }));
|
|
212
234
|
}
|
|
213
235
|
const missing = [];
|
|
214
|
-
if (cli.modules === undefined)
|
|
236
|
+
if (!mobile && cli.modules === undefined)
|
|
215
237
|
missing.push("--module");
|
|
216
|
-
if (cli.features === undefined)
|
|
238
|
+
if (!mobile && cli.features === undefined)
|
|
217
239
|
missing.push("--feature");
|
|
218
240
|
if (cli.agents === undefined)
|
|
219
241
|
missing.push("--agent");
|
|
@@ -229,7 +251,7 @@ const createCommand = defineCommand({
|
|
|
229
251
|
!args.force) {
|
|
230
252
|
throw new Error(getMessage("preset.error.exists", locale, { name: cli.name }));
|
|
231
253
|
}
|
|
232
|
-
await writePreset(projectDir, buildPreset(cli.name, cli.label ?? "", cli.description ?? "", cli.modules, cli.features, cli.agents));
|
|
254
|
+
await writePreset(projectDir, buildPreset(cli.name, cli.label ?? "", cli.description ?? "", cli.modules ?? [], cli.features ?? [], cli.agents));
|
|
233
255
|
p.log.success(getMessage("preset.created", locale, { name: cli.name }));
|
|
234
256
|
}),
|
|
235
257
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProjectType } from "../core/types.js";
|
|
2
|
+
import type { Logger } from "../core/logger.js";
|
|
3
|
+
import type { MobilePrompts } from "../interactive/mobile-prompts.js";
|
|
4
|
+
export declare const resolveProjectType: (opts: {
|
|
5
|
+
mode: "init" | "attach";
|
|
6
|
+
projectType: string | undefined;
|
|
7
|
+
nonInteractive: boolean;
|
|
8
|
+
iapPromptsReplaced: boolean;
|
|
9
|
+
initial: () => Promise<ProjectType>;
|
|
10
|
+
optionValues: Readonly<Record<string, unknown>>;
|
|
11
|
+
locale: string;
|
|
12
|
+
logger: Logger;
|
|
13
|
+
selectProjectType: MobilePrompts["selectProjectType"];
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
projectType: ProjectType;
|
|
16
|
+
introShown: boolean;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createMobileValidators } from "../core/validators.js";
|
|
2
|
+
import { collectOptionsNotForProjectType, formatOptionsNotForProjectType, } from "../core/project-type.js";
|
|
3
|
+
import { printIntro } from "../interactive/prompts.js";
|
|
4
|
+
export const resolveProjectType = async (opts) => {
|
|
5
|
+
let projectType;
|
|
6
|
+
let introShown = false;
|
|
7
|
+
if (opts.projectType !== undefined) {
|
|
8
|
+
const error = createMobileValidators(opts.locale).projectType(opts.projectType);
|
|
9
|
+
if (error)
|
|
10
|
+
throw new Error(error);
|
|
11
|
+
projectType = opts.projectType;
|
|
12
|
+
}
|
|
13
|
+
else if (opts.nonInteractive || opts.iapPromptsReplaced) {
|
|
14
|
+
projectType = "iap";
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
printIntro(opts.mode === "init" ? "common" : "attachCommon", opts.locale, opts.logger);
|
|
18
|
+
introShown = true;
|
|
19
|
+
projectType = await opts.selectProjectType(await opts.initial(), opts.locale);
|
|
20
|
+
}
|
|
21
|
+
const notFor = collectOptionsNotForProjectType(opts.optionValues, projectType);
|
|
22
|
+
if (notFor.length > 0) {
|
|
23
|
+
throw new Error(formatOptionsNotForProjectType(notFor, projectType, opts.locale));
|
|
24
|
+
}
|
|
25
|
+
return { projectType, introShown };
|
|
26
|
+
};
|
|
@@ -8,7 +8,7 @@ export type SwitchPrompts = {
|
|
|
8
8
|
selectPreset: (presets: PresetSummary[], locale: string) => Promise<string | undefined>;
|
|
9
9
|
selectModules: (release: Release, initial: string[], locale: string) => Promise<string[]>;
|
|
10
10
|
selectFeatures: (release: Release, initial: string[], locale: string) => Promise<string[]>;
|
|
11
|
-
selectAgents: (initial: string[], locale: string) => Promise<string[]>;
|
|
11
|
+
selectAgents: (initial: string[], locale: string, options?: readonly string[]) => Promise<string[]>;
|
|
12
12
|
confirmApply: (locale: string) => Promise<boolean>;
|
|
13
13
|
};
|
|
14
14
|
export type RunSwitchDeps = {
|
package/dist/commands/switch.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
|
+
import { isMobileSettings } from "../core/types.js";
|
|
4
|
+
import { collectOptionsNotForProjectType, formatOptionsNotForProjectType, } from "../core/project-type.js";
|
|
5
|
+
import { MOBILE_AGENT_OPTIONS } from "../core/constants.js";
|
|
6
|
+
import { buildEvalContext } from "../core/eval-context.js";
|
|
7
|
+
import { selectMobileRootDir } from "../asset/root-selection.js";
|
|
8
|
+
import { printMobileSummary } from "../interactive/summary.js";
|
|
3
9
|
import { createCancelledError, normalizeAbort } from "../core/errors.js";
|
|
4
10
|
import { getCliVersion } from "../core/paths.js";
|
|
5
11
|
import { findReleaseById } from "../core/catalog.js";
|
|
@@ -12,8 +18,8 @@ import { applyUpdateActions, buildRenderedPlan, dependencyDirsOfPlan, buildUpdat
|
|
|
12
18
|
import { createMessageCollector } from "../asset/messages.js";
|
|
13
19
|
import { printAssetMessages } from "../interactive/asset-messages.js";
|
|
14
20
|
import { installTriggerChanged, runInstallBuild } from "../asset/installer.js";
|
|
15
|
-
import {
|
|
16
|
-
import { loadAndValidatePreset, listPresetSummaries, buildPresetSelectOptions, parsePresetChoice, } from "../utils/preset-io.js";
|
|
21
|
+
import { readProjectSettings, readHashsum, writeSettings, writeHashsum, } from "../utils/settings-io.js";
|
|
22
|
+
import { loadAndValidatePreset, loadAndValidateMobilePreset, listPresetSummaries, buildPresetSelectOptions, parsePresetChoice, } from "../utils/preset-io.js";
|
|
17
23
|
import { getMessage } from "../i18n/index.js";
|
|
18
24
|
import { detectLocale } from "../utils/locale-detect.js";
|
|
19
25
|
import { generateMcpConfigsBestEffort, } from "../utils/mcp-generate.js";
|
|
@@ -91,7 +97,7 @@ const defaultPrompts = {
|
|
|
91
97
|
},
|
|
92
98
|
selectModules: promptModules,
|
|
93
99
|
selectFeatures: promptFeatures,
|
|
94
|
-
selectAgents: promptAgents,
|
|
100
|
+
selectAgents: (initial, locale, options) => promptAgents(initial, locale, options === undefined ? undefined : "prompt.mobileAgent", options),
|
|
95
101
|
confirmApply: async (locale) => {
|
|
96
102
|
const ok = await p.confirm({
|
|
97
103
|
message: getMessage("switch.confirmApply", locale),
|
|
@@ -112,11 +118,17 @@ const runSwitchInner = async (deps) => {
|
|
|
112
118
|
const logger = deps.logger ?? createClackLogger();
|
|
113
119
|
const prompts = deps.prompts ?? defaultPrompts;
|
|
114
120
|
let locale = deps.locale ?? detectLocale();
|
|
115
|
-
const settings = await
|
|
121
|
+
const settings = await readProjectSettings(projectDir, locale);
|
|
116
122
|
if (!settings) {
|
|
117
123
|
throw new Error(getMessage("error.accelNotFound", locale));
|
|
118
124
|
}
|
|
119
125
|
locale = deps.locale ?? settings.locale ?? locale;
|
|
126
|
+
if (isMobileSettings(settings)) {
|
|
127
|
+
const notFor = collectOptionsNotForProjectType({ module: deps.modules, feature: deps.features }, "mobile");
|
|
128
|
+
if (notFor.length > 0) {
|
|
129
|
+
throw new Error(formatOptionsNotForProjectType(notFor, "mobile", locale));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
120
132
|
const assetSource = settings.assetSource;
|
|
121
133
|
if (!assetSource) {
|
|
122
134
|
throw new Error(getMessage("switch.error.legacyProject", locale));
|
|
@@ -130,13 +142,76 @@ const runSwitchInner = async (deps) => {
|
|
|
130
142
|
ref: assetSource.ref,
|
|
131
143
|
};
|
|
132
144
|
const isInteractive = !deps.nonInteractive;
|
|
133
|
-
|
|
134
|
-
if (presetArg !== undefined &&
|
|
145
|
+
if (deps.preset !== undefined &&
|
|
135
146
|
(deps.modules !== undefined ||
|
|
136
147
|
deps.features !== undefined ||
|
|
137
148
|
deps.agents !== undefined)) {
|
|
138
149
|
throw new Error(getMessage("preset.error.conflictingFlags", locale));
|
|
139
150
|
}
|
|
151
|
+
const newSettings = isMobileSettings(settings)
|
|
152
|
+
? await resolveMobileSwitch(deps, settings, locale, prompts, logger)
|
|
153
|
+
: await resolveIapSwitch(deps, settings, locale, prompts, logger);
|
|
154
|
+
const provider = createGitAssetProvider(source.url, source.ref, {
|
|
155
|
+
locale,
|
|
156
|
+
signal: deps.signal,
|
|
157
|
+
});
|
|
158
|
+
try {
|
|
159
|
+
logger.info(getMessage("switch.progress", locale, { sha: shortSha(source.commit) }));
|
|
160
|
+
const tree = await provider.openCommit(source.commit);
|
|
161
|
+
const messageCollector = createMessageCollector();
|
|
162
|
+
const onPathRejected = resolvePathRejected(deps.progress, locale, logger);
|
|
163
|
+
deps.progress?.onRenderStart?.("theirs");
|
|
164
|
+
const theirsPlan = await buildRenderedPlan(tree, newSettings, tree.materialize, messageCollector.collect, onPathRejected);
|
|
165
|
+
deps.progress?.onRenderStart?.("base");
|
|
166
|
+
const basePlan = await buildRenderedPlan(tree, settings, tree.materialize, undefined, onPathRejected);
|
|
167
|
+
const oldHashsum = await readHashsum(projectDir);
|
|
168
|
+
const states = await collectFileStates(projectDir, basePlan, theirsPlan, oldHashsum);
|
|
169
|
+
deps.progress?.onClassifyStart?.(states.length);
|
|
170
|
+
const actions = classifySwitch(states);
|
|
171
|
+
const summary = await applyUpdateActions(projectDir, actions, deps.progress);
|
|
172
|
+
const { hashEntries, deployedAssets } = buildUpdatedRecords(oldHashsum, actions);
|
|
173
|
+
const dependencies = dependencyDirsOfPlan(theirsPlan);
|
|
174
|
+
await writeSettings(projectDir, withDependencies({ ...newSettings, deployedAssets }, dependencies));
|
|
175
|
+
await writeHashsum(projectDir, hashEntries);
|
|
176
|
+
await generateMcpConfigsBestEffort(projectDir, logger, deps.generateMcpConfigs);
|
|
177
|
+
const { ensureReady } = await syncDependencyArtifactsBestEffort(projectDir, logger, deps.syncDependencyArtifacts);
|
|
178
|
+
printAssetMessages(messageCollector.drain(), logger);
|
|
179
|
+
const dependencyDirs = [...(settings.dependencies ?? []), ...dependencies];
|
|
180
|
+
const changedPaths = actions
|
|
181
|
+
.filter((a) => a.op !== "none")
|
|
182
|
+
.map((a) => a.relativePath)
|
|
183
|
+
.filter((path) => !isDependencyFile(path, dependencyDirs));
|
|
184
|
+
if (!isMobileSettings(newSettings) &&
|
|
185
|
+
!deps.skipInstall &&
|
|
186
|
+
installTriggerChanged(changedPaths)) {
|
|
187
|
+
const { success } = runInstallBuild(projectDir, newSettings.packageManager, buildProgressCallbacks(locale, logger));
|
|
188
|
+
if (!success && summary.skippedSwitch.length > 0) {
|
|
189
|
+
const list = summary.skippedSwitch
|
|
190
|
+
.map((c) => ` - ${sanitizeDisplayText(c)}`)
|
|
191
|
+
.join("\n");
|
|
192
|
+
logger.warn(`${getMessage("switch.installFailedHint", locale)}\n${list}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (ensureReady && !deps.skipInstall) {
|
|
196
|
+
await runEnsureBestEffort(projectDir, logger, deps.runEnsure);
|
|
197
|
+
}
|
|
198
|
+
printSwitchResult(summary, actions, locale, logger);
|
|
199
|
+
if (isMobileSettings(newSettings)) {
|
|
200
|
+
const { expoSkillsHintForAddedAgents } = await import("./mobile/shared.js");
|
|
201
|
+
const { mobile } = await selectMobileRootDir(tree, buildEvalContext(newSettings));
|
|
202
|
+
const hint = expoSkillsHintForAddedAgents(settings.agents, newSettings.agents, mobile, locale);
|
|
203
|
+
if (hint !== undefined)
|
|
204
|
+
logger.info(hint);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
await provider.cleanup().catch(() => { });
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const resolveIapSwitch = async (deps, settings, locale, prompts, logger) => {
|
|
212
|
+
const { projectDir } = deps;
|
|
213
|
+
const isInteractive = !deps.nonInteractive;
|
|
214
|
+
const presetArg = deps.preset;
|
|
140
215
|
let presetValues;
|
|
141
216
|
if (presetArg !== undefined) {
|
|
142
217
|
presetValues = await loadAndValidatePreset(projectDir, presetArg, settings.accelplatformVersion.label, locale);
|
|
@@ -201,53 +276,48 @@ const runSwitchInner = async (deps) => {
|
|
|
201
276
|
throw createCancelledError();
|
|
202
277
|
}
|
|
203
278
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
await generateMcpConfigsBestEffort(projectDir, logger, deps.generateMcpConfigs);
|
|
227
|
-
const { ensureReady } = await syncDependencyArtifactsBestEffort(projectDir, logger, deps.syncDependencyArtifacts);
|
|
228
|
-
printAssetMessages(messageCollector.drain(), logger);
|
|
229
|
-
const dependencyDirs = [...(settings.dependencies ?? []), ...dependencies];
|
|
230
|
-
const changedPaths = actions
|
|
231
|
-
.filter((a) => a.op !== "none")
|
|
232
|
-
.map((a) => a.relativePath)
|
|
233
|
-
.filter((path) => !isDependencyFile(path, dependencyDirs));
|
|
234
|
-
if (!deps.skipInstall && installTriggerChanged(changedPaths)) {
|
|
235
|
-
const { success } = runInstallBuild(projectDir, newSettings.packageManager, buildProgressCallbacks(locale, logger));
|
|
236
|
-
if (!success && summary.skippedSwitch.length > 0) {
|
|
237
|
-
const list = summary.skippedSwitch
|
|
238
|
-
.map((c) => ` - ${sanitizeDisplayText(c)}`)
|
|
239
|
-
.join("\n");
|
|
240
|
-
logger.warn(`${getMessage("switch.installFailedHint", locale)}\n${list}`);
|
|
279
|
+
return newSettings;
|
|
280
|
+
};
|
|
281
|
+
const resolveMobileSwitch = async (deps, settings, locale, prompts, logger) => {
|
|
282
|
+
const { projectDir } = deps;
|
|
283
|
+
const isInteractive = !deps.nonInteractive;
|
|
284
|
+
let agents = deps.preset !== undefined
|
|
285
|
+
? (await loadAndValidateMobilePreset(projectDir, deps.preset, locale))
|
|
286
|
+
.agents
|
|
287
|
+
: (deps.agents ?? settings.agents);
|
|
288
|
+
const { assertMobileAgents } = await import("./mobile/shared.js");
|
|
289
|
+
assertMobileAgents(deps.agents ?? [], locale);
|
|
290
|
+
if (isInteractive) {
|
|
291
|
+
printIntro("mobileSwitch", locale, logger);
|
|
292
|
+
let presetSelected = deps.preset !== undefined;
|
|
293
|
+
if (!presetSelected && deps.agents === undefined) {
|
|
294
|
+
const presets = await listPresetSummaries(projectDir);
|
|
295
|
+
if (presets.length > 0) {
|
|
296
|
+
const presetName = await prompts.selectPreset(presets, locale);
|
|
297
|
+
if (presetName !== undefined) {
|
|
298
|
+
agents = (await loadAndValidateMobilePreset(projectDir, presetName, locale)).agents;
|
|
299
|
+
presetSelected = true;
|
|
300
|
+
}
|
|
241
301
|
}
|
|
242
302
|
}
|
|
243
|
-
if (
|
|
244
|
-
await
|
|
303
|
+
if (!presetSelected) {
|
|
304
|
+
agents = await prompts.selectAgents(agents, locale, MOBILE_AGENT_OPTIONS);
|
|
305
|
+
assertMobileAgents(agents, locale);
|
|
245
306
|
}
|
|
246
|
-
printSwitchResult(summary, actions, locale, logger);
|
|
247
307
|
}
|
|
248
|
-
|
|
249
|
-
|
|
308
|
+
const newSettings = {
|
|
309
|
+
...settings,
|
|
310
|
+
cliVersion: getCliVersion(),
|
|
311
|
+
agents,
|
|
312
|
+
};
|
|
313
|
+
if (isInteractive) {
|
|
314
|
+
printMobileSummary(newSettings, projectDir, [], locale, logger);
|
|
315
|
+
if (!(await prompts.confirmApply(locale))) {
|
|
316
|
+
logger.info(getMessage("switch.cancelled", locale));
|
|
317
|
+
throw createCancelledError();
|
|
318
|
+
}
|
|
250
319
|
}
|
|
320
|
+
return newSettings;
|
|
251
321
|
};
|
|
252
322
|
export const switchCommand = defineCommand({
|
|
253
323
|
meta: {
|
|
@@ -23,6 +23,14 @@ export type UpdatePrompts = {
|
|
|
23
23
|
selectSettingsSource: (presets: PresetSummary[], locale: string) => Promise<SettingsSourceChoice>;
|
|
24
24
|
confirmApply: (locale: string) => Promise<boolean>;
|
|
25
25
|
reenterSettings: (opts: PromptOptions) => Promise<ResolvedOptions>;
|
|
26
|
+
confirmFollowExpoSdk: (detected: string, recorded: string, locale: string) => Promise<boolean>;
|
|
27
|
+
reenterMobileSettings: (current: MobileUpdateValues, sdkCandidates: (targetReleaseId: string) => Promise<string[]>, locale: string) => Promise<MobileUpdateValues>;
|
|
28
|
+
};
|
|
29
|
+
export type MobileUpdateValues = {
|
|
30
|
+
name: string;
|
|
31
|
+
targetReleaseId: string;
|
|
32
|
+
expoSdk: string;
|
|
33
|
+
agents: string[];
|
|
26
34
|
};
|
|
27
35
|
export type RunUpdateDeps = {
|
|
28
36
|
projectDir: string;
|
|
@@ -41,6 +49,7 @@ export type RunUpdateDeps = {
|
|
|
41
49
|
database?: string;
|
|
42
50
|
javascript?: boolean;
|
|
43
51
|
packageManager?: string;
|
|
52
|
+
expoSdk?: string;
|
|
44
53
|
preset?: string;
|
|
45
54
|
skipInstall?: boolean;
|
|
46
55
|
assetServerUrl?: string;
|
|
@@ -57,6 +66,15 @@ export type RunUpdateDeps = {
|
|
|
57
66
|
pruneRuntimeIds?: typeof pruneRuntimeIds;
|
|
58
67
|
};
|
|
59
68
|
export declare const runUpdate: (deps: RunUpdateDeps) => Promise<void>;
|
|
69
|
+
export type UpdateContext = {
|
|
70
|
+
deps: RunUpdateDeps;
|
|
71
|
+
projectDir: string;
|
|
72
|
+
locale: string;
|
|
73
|
+
logger: Logger;
|
|
74
|
+
prompts: UpdatePrompts;
|
|
75
|
+
isInteractive: boolean;
|
|
76
|
+
};
|
|
77
|
+
export declare const confirmDirtyWorktree: (ctx: UpdateContext) => Promise<void>;
|
|
60
78
|
export declare const updateCommand: import("citty").CommandDef<{
|
|
61
79
|
readonly "juggling-project": {
|
|
62
80
|
readonly type: "string";
|
|
@@ -114,6 +132,10 @@ export declare const updateCommand: import("citty").CommandDef<{
|
|
|
114
132
|
readonly type: "string";
|
|
115
133
|
readonly description: "Maven artifactId";
|
|
116
134
|
};
|
|
135
|
+
readonly "expo-sdk": {
|
|
136
|
+
readonly type: "string";
|
|
137
|
+
readonly description: "(mobile) Expo SDK major version to switch the assets to (e.g., 57)";
|
|
138
|
+
};
|
|
117
139
|
readonly "package-manager": {
|
|
118
140
|
readonly type: "string";
|
|
119
141
|
readonly description: "Package manager (bun, npm, yarn, pnpm)";
|