@detergent-software/atk 9.3.1-dev.1 → 9.4.0-dev.10
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/CHANGELOG.md +83 -0
- package/build/command-manifest.json +9 -9
- package/build/commands/freeze.d.ts.map +1 -1
- package/build/commands/freeze.js +3 -1
- package/build/commands/freeze.js.map +1 -1
- package/build/commands/info.js +1 -0
- package/build/commands/info.js.map +1 -1
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +289 -90
- package/build/commands/install.js.map +1 -1
- package/build/commands/outdated.d.ts.map +1 -1
- package/build/commands/outdated.js +2 -1
- package/build/commands/outdated.js.map +1 -1
- package/build/commands/pin.js +1 -1
- package/build/commands/pin.js.map +1 -1
- package/build/commands/sync.d.ts.map +1 -1
- package/build/commands/sync.js +26 -13
- package/build/commands/sync.js.map +1 -1
- package/build/commands/thaw.d.ts.map +1 -1
- package/build/commands/thaw.js +5 -1
- package/build/commands/thaw.js.map +1 -1
- package/build/commands/uninstall.d.ts.map +1 -1
- package/build/commands/uninstall.js +6 -1
- package/build/commands/uninstall.js.map +1 -1
- package/build/commands/unpin.d.ts.map +1 -1
- package/build/commands/unpin.js +5 -1
- package/build/commands/unpin.js.map +1 -1
- package/build/commands/update.d.ts.map +1 -1
- package/build/commands/update.js +18 -8
- package/build/commands/update.js.map +1 -1
- package/build/components/AssetDetail.d.ts.map +1 -1
- package/build/components/AssetDetail.js +1 -1
- package/build/components/AssetDetail.js.map +1 -1
- package/build/components/PreferredScopeQuestion.d.ts +16 -0
- package/build/components/PreferredScopeQuestion.d.ts.map +1 -0
- package/build/components/PreferredScopeQuestion.js +20 -0
- package/build/components/PreferredScopeQuestion.js.map +1 -0
- package/build/components/PreferredScopeWarning.d.ts +17 -0
- package/build/components/PreferredScopeWarning.d.ts.map +1 -0
- package/build/components/PreferredScopeWarning.js +13 -0
- package/build/components/PreferredScopeWarning.js.map +1 -0
- package/build/components/index.d.ts +2 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +2 -0
- package/build/components/index.js.map +1 -1
- package/build/hooks/useListActions.d.ts.map +1 -1
- package/build/hooks/useListActions.js +5 -1
- package/build/hooks/useListActions.js.map +1 -1
- package/build/hooks/useUninstallState.d.ts.map +1 -1
- package/build/hooks/useUninstallState.js +16 -12
- package/build/hooks/useUninstallState.js.map +1 -1
- package/build/lib/asset-tools.d.ts +2 -0
- package/build/lib/asset-tools.d.ts.map +1 -1
- package/build/lib/asset-tools.js +4 -0
- package/build/lib/asset-tools.js.map +1 -1
- package/build/lib/atk-schemas/index.d.ts +1 -1
- package/build/lib/atk-schemas/index.d.ts.map +1 -1
- package/build/lib/atk-schemas/index.js +1 -1
- package/build/lib/atk-schemas/index.js.map +1 -1
- package/build/lib/atk-schemas/manifest.d.ts +14 -0
- package/build/lib/atk-schemas/manifest.d.ts.map +1 -1
- package/build/lib/atk-schemas/manifest.js +3 -0
- package/build/lib/atk-schemas/manifest.js.map +1 -1
- package/build/lib/atk-schemas/registry.d.ts +16 -0
- package/build/lib/atk-schemas/registry.d.ts.map +1 -1
- package/build/lib/atk-schemas/registry.js +2 -1
- package/build/lib/atk-schemas/registry.js.map +1 -1
- package/build/lib/diff-command.d.ts +6 -1
- package/build/lib/diff-command.d.ts.map +1 -1
- package/build/lib/diff-command.js +25 -28
- package/build/lib/diff-command.js.map +1 -1
- package/build/lib/install-targets.d.ts +35 -8
- package/build/lib/install-targets.d.ts.map +1 -1
- package/build/lib/install-targets.js +78 -11
- package/build/lib/install-targets.js.map +1 -1
- package/build/lib/installer.d.ts +9 -3
- package/build/lib/installer.d.ts.map +1 -1
- package/build/lib/installer.js +28 -10
- package/build/lib/installer.js.map +1 -1
- package/build/lib/multi-tool-install.d.ts +35 -6
- package/build/lib/multi-tool-install.d.ts.map +1 -1
- package/build/lib/multi-tool-install.js +128 -31
- package/build/lib/multi-tool-install.js.map +1 -1
- package/build/lib/named-entry.d.ts +10 -2
- package/build/lib/named-entry.d.ts.map +1 -1
- package/build/lib/named-entry.js +23 -9
- package/build/lib/named-entry.js.map +1 -1
- package/build/lib/org.d.ts +32 -13
- package/build/lib/org.d.ts.map +1 -1
- package/build/lib/org.js +36 -12
- package/build/lib/org.js.map +1 -1
- package/build/lib/preferred-scope.d.ts +38 -0
- package/build/lib/preferred-scope.d.ts.map +1 -0
- package/build/lib/preferred-scope.js +53 -0
- package/build/lib/preferred-scope.js.map +1 -0
- package/build/lib/updater.d.ts +30 -5
- package/build/lib/updater.d.ts.map +1 -1
- package/build/lib/updater.js +114 -27
- package/build/lib/updater.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { formatOrgName } from './org.js';
|
|
3
|
+
import { findProjectRoot } from './paths.js';
|
|
4
|
+
import { isUserRoot, resolveUserRoot } from './scope.js';
|
|
5
|
+
/**
|
|
6
|
+
* Whether an install could move to `scope`: the user scope when its root exists, and the project when
|
|
7
|
+
* the cwd is in one other than the user root.
|
|
8
|
+
*/
|
|
9
|
+
export async function canInstallAt(scope) {
|
|
10
|
+
try {
|
|
11
|
+
return scope === 'user' ? existsSync(await resolveUserRoot()) : !(await isUserRoot(findProjectRoot()));
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** `The author says atk-guide works best at the user level.` */
|
|
18
|
+
export function describePreferredScope({ assets, scope }) {
|
|
19
|
+
const names = assets.map((asset) => formatOrgName(asset.org, asset.name)).join(', ');
|
|
20
|
+
const where = scope === 'user' ? 'at the user level' : 'in a project';
|
|
21
|
+
return assets.length === 1
|
|
22
|
+
? `The author says ${names} works best ${where}.`
|
|
23
|
+
: `The authors say ${names} work best ${where}.`;
|
|
24
|
+
}
|
|
25
|
+
/** The `preferred-scope` notice: what the authors say, and `command`, the install at their scope. */
|
|
26
|
+
export function preferredScopeNotice(preferred, command) {
|
|
27
|
+
return { command, kind: 'preferred-scope', text: describePreferredScope(preferred) };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The plan's direct targets (the asset, a bundle's members, each named asset) that prefer the scope
|
|
31
|
+
* other than `scope`; undefined when none does. Dependencies install with what needs them, so their
|
|
32
|
+
* preference doesn't count.
|
|
33
|
+
*/
|
|
34
|
+
export function preferredScopeOf(plan, scope) {
|
|
35
|
+
const declared = plan.entries.filter((entry) => entry.reason === 'direct' && entry.versionData.preferredScope);
|
|
36
|
+
const other = declared.filter((entry) => entry.versionData.preferredScope !== scope);
|
|
37
|
+
if (other.length === 0)
|
|
38
|
+
return undefined;
|
|
39
|
+
return {
|
|
40
|
+
assets: other.map(({ asset, org = asset.org }) => ({
|
|
41
|
+
name: asset.name,
|
|
42
|
+
...(org ? { org } : {}),
|
|
43
|
+
type: asset.type,
|
|
44
|
+
})),
|
|
45
|
+
conflict: other.length < declared.length,
|
|
46
|
+
scope: other[0].versionData.preferredScope,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** How a question offers the preferred scope: `with --user`, or `in the project`. */
|
|
50
|
+
export function preferredScopeOffer(scope) {
|
|
51
|
+
return scope === 'user' ? 'with --user' : 'in the project';
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=preferred-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferred-scope.js","sourceRoot":"","sources":["../../src/lib/preferred-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAc,MAAM,YAAY,CAAC;AAerE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAY;IAC7C,IAAI,CAAC;QACH,OAAO,KAAK,KAA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AC,KAAK,CAAC,WAAW,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC;IACrF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;YACjD,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;QACH,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM;QACxC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAE,CAAC,WAAW,CAAC,cAAe;KAC7C,CAAC;AACJ,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAC7D,CAAC"}
|
package/build/lib/updater.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { InstalledAsset, Lockfile } from './schemas/lockfile.js';
|
|
|
5
5
|
import { ApiCodeError, type ErrorGuidance } from './errors.js';
|
|
6
6
|
import { type InstallResult, type PlanFiles } from './installer.js';
|
|
7
7
|
import { type LocalEdits } from './local-edits.js';
|
|
8
|
+
import { type NamedAssets } from './multi-tool-install.js';
|
|
8
9
|
import { type Scope } from './scope.js';
|
|
9
10
|
export interface OutdatedAsset {
|
|
10
11
|
/** Whether the asset is frozen. */
|
|
@@ -127,6 +128,19 @@ export interface UpdateOptions {
|
|
|
127
128
|
* tool skips the same assets and the lockfile keeps one version for them.
|
|
128
129
|
*/
|
|
129
130
|
localEdits?: Map<string, LocalEdits>;
|
|
131
|
+
/**
|
|
132
|
+
* A run that names the assets it updates, with its `force`: an update that moves the named asset
|
|
133
|
+
* to a version an installed dependent rejects offers `--force`, and goes on with it (see
|
|
134
|
+
* {@link withoutKeptDependencies}). `updateAssets` sets it for named assets; a bulk run has none.
|
|
135
|
+
*/
|
|
136
|
+
named?: NamedAssets;
|
|
137
|
+
/**
|
|
138
|
+
* The tools each installed asset was not in place for when a multi-tool run started
|
|
139
|
+
* ({@link notInPlaceByTool}). An update keeps an installed dependency only when every one of them
|
|
140
|
+
* had it, as `atk install` decides for every tool at once. Found once before the run, so every
|
|
141
|
+
* tool keeps or moves the same dependencies.
|
|
142
|
+
*/
|
|
143
|
+
notInPlace?: Map<string, Adapter[]>;
|
|
130
144
|
/** Callback for progress updates. */
|
|
131
145
|
onProgress?: (message: string) => void;
|
|
132
146
|
/** Project root directory. */
|
|
@@ -148,6 +162,15 @@ export interface UpdateOptions {
|
|
|
148
162
|
toolLockfile?: Lockfile;
|
|
149
163
|
/** Type of the named assets, when a name is installed as more than one type. */
|
|
150
164
|
type?: AssetType;
|
|
165
|
+
/**
|
|
166
|
+
* The assets the run updates, by identity key, with the version each goes to. An update that
|
|
167
|
+
* moves a dependency counts the others as its dependents at that version, not the one their
|
|
168
|
+
* lockfile entry records, so two assets that move a shared dependency together don't refuse each
|
|
169
|
+
* other. `updateAssets` sets it, and leaves an asset out once its update fails or is skipped.
|
|
170
|
+
* An asset still to come counts at its new version before it gets there, so when its own update
|
|
171
|
+
* then fails, a dependency an earlier update moved stays at a version it doesn't accept.
|
|
172
|
+
*/
|
|
173
|
+
updating?: Map<string, string>;
|
|
151
174
|
}
|
|
152
175
|
export interface UpdateResult {
|
|
153
176
|
fromVersion: string;
|
|
@@ -208,6 +231,12 @@ export declare function findUpdateTarget(lockfile: Lockfile, spec: string, optio
|
|
|
208
231
|
type?: AssetType;
|
|
209
232
|
version?: string;
|
|
210
233
|
}): InstalledAsset;
|
|
234
|
+
/**
|
|
235
|
+
* For each installed asset, keyed by {@link identityKey}, the adapters that have a placement for
|
|
236
|
+
* its type but don't have it in place. Read before a multi-tool update changes any files, for
|
|
237
|
+
* `UpdateOptions.notInPlace`. Assets every adapter has are left out.
|
|
238
|
+
*/
|
|
239
|
+
export declare function notInPlaceByTool(lockfile: Lockfile, adapters: Adapter[], projectDir: string): Map<string, Adapter[]>;
|
|
211
240
|
/**
|
|
212
241
|
* After every tool's update in a run: remove the adapter's tool's copy of each hook its update
|
|
213
242
|
* skipped because the new version doesn't declare the tool (`undeclared`, as this tool has them),
|
|
@@ -240,13 +269,9 @@ export declare function updateAssets(assetNames: Array<AssetIdentity | string> |
|
|
|
240
269
|
* refuses such an asset as it does one with its own edits. Found once, before a multi-tool run
|
|
241
270
|
* changes any files, and for the dry run the same way, so both list the same assets.
|
|
242
271
|
*/
|
|
243
|
-
export declare function withDependencyEdits(outdated: Array<AssetIdentity & {
|
|
244
|
-
latestVersion: string;
|
|
245
|
-
}>, lockfile: Lockfile, registry: Registry, localEdits: Map<string, LocalEdits>, { adapters, projectDir, scope, targetVersion, }: {
|
|
272
|
+
export declare function withDependencyEdits(outdated: Array<AssetIdentity & Pick<OutdatedAsset, 'frozen' | 'latestVersion' | 'pinned'>>, lockfile: Lockfile, registry: Registry, localEdits: Map<string, LocalEdits>, { adapters, notInPlace, projectDir, scope, targetVersion, }: Pick<UpdateOptions, 'notInPlace' | 'scope' | 'targetVersion'> & {
|
|
246
273
|
adapters: Adapter[];
|
|
247
274
|
projectDir: string;
|
|
248
|
-
scope?: Scope;
|
|
249
|
-
targetVersion?: string;
|
|
250
275
|
}): Map<string, LocalEdits>;
|
|
251
276
|
export {};
|
|
252
277
|
//# sourceMappingURL=updater.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../src/lib/updater.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SA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D,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAgR7B;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,eAAe,GAAG,QAAQ,CAAC,CAAC,EAC3F,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACnC,EACE,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,EACL,aAAa,GACd,EAAE,IAAI,CAAC,aAAa,EAAE,YAAY,GAAG,OAAO,GAAG,eAAe,CAAC,GAAG;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC7G,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAmDzB"}
|
package/build/lib/updater.js
CHANGED
|
@@ -3,11 +3,12 @@ import { declarationAllows, isExcludedAtVersion, isExcludedForTool, isUndeclared
|
|
|
3
3
|
import { getCredential } from './auth.js';
|
|
4
4
|
import { ApiCodeError, asSentence, errorGuidance, errorMessage, isRunWideFailure, } from './errors.js';
|
|
5
5
|
import { restoreFiles, snapshotFiles } from './file-snapshot.js';
|
|
6
|
+
import { isInstalledForTool } from './installed-for-tool.js';
|
|
6
7
|
import { executeInstallPlan, fetchPlanFiles, FileConflictError, InstallerError, installFailureMessage, InstallPlanError, } from './installer.js';
|
|
7
8
|
import {} from './local-edits.js';
|
|
8
9
|
import { addAssetToLockfile, findDependencyAsset, findDependents, findInstalledAsset, getLockfilePath, identityKey, readLockfile, writeLockfile, } from './lockfile.js';
|
|
9
10
|
import { withoutKeptDependencies } from './multi-tool-install.js';
|
|
10
|
-
import { findNamedEntry } from './named-entry.js';
|
|
11
|
+
import { entrySpec, findNamedEntry } from './named-entry.js';
|
|
11
12
|
import { formatOrgName, scopeSwitchGuidance } from './org.js';
|
|
12
13
|
import { findAsset } from './registry.js';
|
|
13
14
|
import { resolveInstallPlan } from './resolver.js';
|
|
@@ -57,7 +58,7 @@ export function checkPinMismatches(lockfile, scope) {
|
|
|
57
58
|
return (lockfile.assets ?? []).flatMap(({ name, org, pinnedVersion, type, version }) => pinnedVersion && pinnedVersion !== version
|
|
58
59
|
? [
|
|
59
60
|
{
|
|
60
|
-
command: scopedCommand(`atk install ${
|
|
61
|
+
command: scopedCommand(`atk install ${entrySpec(lockfile, { name, org, type })}@${pinnedVersion} --pin`, scope),
|
|
61
62
|
installedVersion: version,
|
|
62
63
|
name,
|
|
63
64
|
...(org ? { org } : {}),
|
|
@@ -99,6 +100,20 @@ export function excludedAtVersion(registry, installed, version, adapter) {
|
|
|
99
100
|
export function findUpdateTarget(lockfile, spec, options = {}) {
|
|
100
101
|
return findNamedEntry(lockfile, spec, { ...options, command: 'update', error: UpdaterError });
|
|
101
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* For each installed asset, keyed by {@link identityKey}, the adapters that have a placement for
|
|
105
|
+
* its type but don't have it in place. Read before a multi-tool update changes any files, for
|
|
106
|
+
* `UpdateOptions.notInPlace`. Assets every adapter has are left out.
|
|
107
|
+
*/
|
|
108
|
+
export function notInPlaceByTool(lockfile, adapters, projectDir) {
|
|
109
|
+
const notInPlace = new Map();
|
|
110
|
+
for (const installed of lockfile.assets ?? []) {
|
|
111
|
+
const missing = adapters.filter((adapter) => supportsType(adapter, installed.type) && !isInstalledForTool(installed, adapter, projectDir));
|
|
112
|
+
if (missing.length > 0)
|
|
113
|
+
notInPlace.set(identityKey(installed), missing);
|
|
114
|
+
}
|
|
115
|
+
return notInPlace;
|
|
116
|
+
}
|
|
102
117
|
/**
|
|
103
118
|
* After every tool's update in a run: remove the adapter's tool's copy of each hook its update
|
|
104
119
|
* skipped because the new version doesn't declare the tool (`undeclared`, as this tool has them),
|
|
@@ -165,7 +180,7 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
165
180
|
version: options.targetVersion,
|
|
166
181
|
});
|
|
167
182
|
const { name } = installed;
|
|
168
|
-
const spec = assetSpec(installed, options.type);
|
|
183
|
+
const spec = assetSpec(lockfile, installed, options.type);
|
|
169
184
|
// Check frozen state for explicitly targeted asset
|
|
170
185
|
const compositeKey = `${installed.type}:${installed.org ?? ''}:${name}`;
|
|
171
186
|
if (options.frozenAssets?.has(compositeKey)) {
|
|
@@ -197,7 +212,11 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
197
212
|
return { failures: [], results: [], undeclared: [toolEntry(installed, lockfile, options)] };
|
|
198
213
|
}
|
|
199
214
|
// The skip check and the update plan from the same view of what this tool has.
|
|
200
|
-
const toolOptions = {
|
|
215
|
+
const toolOptions = {
|
|
216
|
+
...options,
|
|
217
|
+
named: { force: Boolean(options.force) },
|
|
218
|
+
toolLockfile: options.toolLockfile ?? lockfile,
|
|
219
|
+
};
|
|
201
220
|
const dependencySkip = await failedDependencySkipFor(installed, registry, toolOptions);
|
|
202
221
|
if (dependencySkip) {
|
|
203
222
|
return { failedSkipped: [dependencySkip], failures: [], results: [] };
|
|
@@ -249,19 +268,19 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
249
268
|
// For explicitly targeted frozen assets, throw
|
|
250
269
|
for (const asset of toUpdate) {
|
|
251
270
|
if (asset.frozen) {
|
|
252
|
-
throw frozenError(asset.name, assetSpec(asset, options.type), options.scope);
|
|
271
|
+
throw frozenError(asset.name, assetSpec(lockfile, asset, options.type), options.scope);
|
|
253
272
|
}
|
|
254
273
|
}
|
|
255
274
|
// For explicitly targeted pinned assets, throw unless force is true
|
|
256
275
|
for (const asset of toUpdate) {
|
|
257
276
|
if (asset.pinned && !options.force) {
|
|
258
|
-
throw pinnedError(`Asset "${asset.name}" is pinned.`, assetSpec(asset, options.type), options.scope);
|
|
277
|
+
throw pinnedError(`Asset "${asset.name}" is pinned.`, assetSpec(lockfile, asset, options.type), options.scope);
|
|
259
278
|
}
|
|
260
279
|
}
|
|
261
280
|
for (const asset of toUpdate) {
|
|
262
281
|
const edits = options.force ? undefined : options.localEdits?.get(identityKey(asset));
|
|
263
282
|
if (edits)
|
|
264
|
-
throw localEditsError(asset.name, [edits], assetSpec(asset, options.type), options.scope);
|
|
283
|
+
throw localEditsError(asset.name, [edits], assetSpec(lockfile, asset, options.type), options.scope);
|
|
265
284
|
}
|
|
266
285
|
}
|
|
267
286
|
else {
|
|
@@ -271,12 +290,12 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
271
290
|
const edits = options.force ? undefined : options.localEdits?.get(identityKey(asset));
|
|
272
291
|
if (asset.frozen) {
|
|
273
292
|
frozenSkipped.push(asset);
|
|
274
|
-
const thaw = scopedCommand(`atk thaw ${asset.
|
|
293
|
+
const thaw = scopedCommand(`atk thaw ${assetSpec(lockfile, asset, options.type)}`, options.scope);
|
|
275
294
|
options.onProgress?.(`Skipping frozen asset ${asset.name} (frozen, use "${thaw}" to unfreeze)`);
|
|
276
295
|
}
|
|
277
296
|
else if (asset.pinned) {
|
|
278
297
|
skipped.push(asset);
|
|
279
|
-
const force = scopedCommand(`atk update ${asset.
|
|
298
|
+
const force = scopedCommand(`atk update ${assetSpec(lockfile, asset, options.type)} --force`, options.scope);
|
|
280
299
|
options.onProgress?.(`Skipping pinned asset ${asset.name} (pinned, use "${force}" to override)`);
|
|
281
300
|
}
|
|
282
301
|
else if (edits) {
|
|
@@ -287,7 +306,7 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
287
306
|
files,
|
|
288
307
|
...(unchecked ? { unchecked } : {}),
|
|
289
308
|
});
|
|
290
|
-
const force = scopedCommand(`atk update ${assetSpec(asset, options.type)} --force`, options.scope);
|
|
309
|
+
const force = scopedCommand(`atk update ${assetSpec(lockfile, asset, options.type)} --force`, options.scope);
|
|
291
310
|
options.onProgress?.(`Skipping ${asset.name}: it has local edits (use "${force}" to overwrite them)`);
|
|
292
311
|
}
|
|
293
312
|
else {
|
|
@@ -349,6 +368,9 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
349
368
|
let notAttempted;
|
|
350
369
|
// What this tool has: the lockfile the run started from, plus what this tool's updates install.
|
|
351
370
|
let toolLockfile = options.toolLockfile ?? lockfile;
|
|
371
|
+
const updating = new Map(toUpdate.map((a) => [identityKey(a), options.targetVersion ?? a.latestVersion]));
|
|
372
|
+
// A bulk run names no asset, so --force doesn't move one past a dependent that rejects its version.
|
|
373
|
+
const named = assetNames && assetNames.length > 0 ? { force: Boolean(options.force) } : undefined;
|
|
352
374
|
for (const [index, asset] of toUpdate.entries()) {
|
|
353
375
|
const installed = lockfileEntryFor(lockfile, asset);
|
|
354
376
|
if (!installed) {
|
|
@@ -356,14 +378,17 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
356
378
|
}
|
|
357
379
|
let updated;
|
|
358
380
|
try {
|
|
359
|
-
const
|
|
381
|
+
const assetOptions = { ...options, named, toolLockfile, updating };
|
|
382
|
+
const dependencySkip = await failedDependencySkipFor(installed, registry, assetOptions);
|
|
360
383
|
if (dependencySkip) {
|
|
361
384
|
failedSkipped.push(dependencySkip);
|
|
385
|
+
updating.delete(identityKey(asset));
|
|
362
386
|
continue;
|
|
363
387
|
}
|
|
364
|
-
updated = await updateAssetPlanned(asset.name, installed, registry,
|
|
388
|
+
updated = await updateAssetPlanned(asset.name, installed, registry, assetOptions);
|
|
365
389
|
}
|
|
366
390
|
catch (error) {
|
|
391
|
+
updating.delete(identityKey(asset));
|
|
367
392
|
// Most errors from updateAsset already name the asset; only frame the ones that don't.
|
|
368
393
|
const cause = errorMessage(error);
|
|
369
394
|
const message = cause.includes(`"${asset.name}"`)
|
|
@@ -411,10 +436,15 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
411
436
|
* refuses such an asset as it does one with its own edits. Found once, before a multi-tool run
|
|
412
437
|
* changes any files, and for the dry run the same way, so both list the same assets.
|
|
413
438
|
*/
|
|
414
|
-
export function withDependencyEdits(outdated, lockfile, registry, localEdits, { adapters, projectDir, scope, targetVersion, }) {
|
|
439
|
+
export function withDependencyEdits(outdated, lockfile, registry, localEdits, { adapters, notInPlace, projectDir, scope, targetVersion, }) {
|
|
415
440
|
const withDependencies = new Map(localEdits);
|
|
416
441
|
if (localEdits.size === 0)
|
|
417
442
|
return withDependencies;
|
|
443
|
+
// The assets the update goes on to update, as `updateAssets` counts them: not the pinned, frozen
|
|
444
|
+
// or edited ones it skips or refuses (with `force`, there are no edits and this returns above).
|
|
445
|
+
const updating = new Map(outdated
|
|
446
|
+
.filter((o) => !o.pinned && !o.frozen && !localEdits.has(identityKey(o)))
|
|
447
|
+
.map((o) => [identityKey(o), targetVersion ?? o.latestVersion]));
|
|
418
448
|
for (const asset of outdated) {
|
|
419
449
|
const installed = lockfileEntryFor(lockfile, asset);
|
|
420
450
|
if (!installed || localEdits.has(identityKey(installed)))
|
|
@@ -429,10 +459,18 @@ export function withDependencyEdits(outdated, lockfile, registry, localEdits, {
|
|
|
429
459
|
continue;
|
|
430
460
|
let plan;
|
|
431
461
|
try {
|
|
432
|
-
plan = planFor(registry, installed, resolved.version, {
|
|
462
|
+
plan = planFor(registry, installed, resolved.version, {
|
|
463
|
+
adapter,
|
|
464
|
+
lockfile,
|
|
465
|
+
notInPlace,
|
|
466
|
+
projectDir,
|
|
467
|
+
scope,
|
|
468
|
+
updating,
|
|
469
|
+
});
|
|
433
470
|
}
|
|
434
471
|
catch {
|
|
435
|
-
// The update itself refuses it (a pinned dependency it would move
|
|
472
|
+
// The update itself refuses it (a pinned dependency it would move, or one a dependent
|
|
473
|
+
// rejects) and says why.
|
|
436
474
|
continue;
|
|
437
475
|
}
|
|
438
476
|
const newDeps = resolved.versionData.dependencies ?? [];
|
|
@@ -454,9 +492,43 @@ export function withDependencyEdits(outdated, lockfile, registry, localEdits, {
|
|
|
454
492
|
}
|
|
455
493
|
return withDependencies;
|
|
456
494
|
}
|
|
457
|
-
/**
|
|
458
|
-
|
|
459
|
-
|
|
495
|
+
/**
|
|
496
|
+
* How a command names an asset so that it reaches this one ({@link entrySpec}: `@org/name`, or
|
|
497
|
+
* `global:name` where a bare name would reach the lockfile org's), with `--type` when the run was
|
|
498
|
+
* given one.
|
|
499
|
+
*/
|
|
500
|
+
function assetSpec(lockfile, asset, type) {
|
|
501
|
+
return `${entrySpec(lockfile, asset, type ? asset.type : undefined)}${type ? ` --type ${asset.type}` : ''}`;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The installed assets besides `installed` that its update with `resolved` changes, by identity key,
|
|
505
|
+
* with the dependencies they end up with: the run's other assets (`updating`) at the version they
|
|
506
|
+
* update to, and none for the dependencies the update's cleanup removes (see
|
|
507
|
+
* {@link droppedDependencies}). An asset the lockfile on disk (`recorded`) has at another version
|
|
508
|
+
* than this tool's `lockfile`, which an earlier tool of the run moved, counts with the
|
|
509
|
+
* dependencies `recorded` gives it: every tool shares the one version.
|
|
510
|
+
*/
|
|
511
|
+
function changedBy(registry, installed, resolved, { adapter, lockfile, recorded, updating, }) {
|
|
512
|
+
const changing = new Map();
|
|
513
|
+
for (const moved of recorded?.assets ?? []) {
|
|
514
|
+
const own = lockfileEntryFor(lockfile, moved);
|
|
515
|
+
if (!own || own.version === moved.version || isSameAsset(moved, installed))
|
|
516
|
+
continue;
|
|
517
|
+
changing.set(identityKey(moved), moved.dependencies ?? []);
|
|
518
|
+
}
|
|
519
|
+
for (const [key, version] of updating ?? []) {
|
|
520
|
+
const other = (lockfile.assets ?? []).find((a) => identityKey(a) === key);
|
|
521
|
+
if (!other || isSameAsset(other, installed))
|
|
522
|
+
continue;
|
|
523
|
+
const target = findAsset(registry, other.name, other.type, version, other.org);
|
|
524
|
+
if (target && target.asset.org === other.org)
|
|
525
|
+
changing.set(key, target.versionData.dependencies ?? []);
|
|
526
|
+
}
|
|
527
|
+
const newDeps = resolved.entries.find((e) => isSameAsset(e.asset, installed))?.versionData.dependencies ?? [];
|
|
528
|
+
for (const dropped of droppedDependencies(installed, newDeps, lockfile, adapter)) {
|
|
529
|
+
changing.set(identityKey(dropped), []);
|
|
530
|
+
}
|
|
531
|
+
return changing;
|
|
460
532
|
}
|
|
461
533
|
/**
|
|
462
534
|
* The installed dependencies of `installed` an update to a version needing `newDeps` removes, as its
|
|
@@ -511,16 +583,21 @@ async function failedDependencySkipFor(installed, registry, options) {
|
|
|
511
583
|
const lockfile = await readLockfile(options.projectDir);
|
|
512
584
|
let plan;
|
|
513
585
|
try {
|
|
514
|
-
const { adapter, projectDir, scope, toolLockfile } = options;
|
|
586
|
+
const { adapter, named, notInPlace, projectDir, scope, toolLockfile, updating } = options;
|
|
515
587
|
plan = planFor(registry, installed, resolved.version, {
|
|
516
588
|
adapter,
|
|
517
589
|
lockfile: toolLockfile ?? lockfile,
|
|
590
|
+
named,
|
|
591
|
+
notInPlace,
|
|
518
592
|
projectDir,
|
|
593
|
+
recorded: lockfile,
|
|
519
594
|
scope,
|
|
595
|
+
updating,
|
|
520
596
|
});
|
|
521
597
|
}
|
|
522
598
|
catch (error) {
|
|
523
|
-
// It would move a pinned dependency, which the update itself
|
|
599
|
+
// It would move a pinned dependency, or one a dependent rejects, which the update itself
|
|
600
|
+
// refuses and reports.
|
|
524
601
|
if (error instanceof InstallerError)
|
|
525
602
|
return undefined;
|
|
526
603
|
throw error;
|
|
@@ -632,12 +709,20 @@ function pinnedError(pinned, spec, scope) {
|
|
|
632
709
|
* own reason.
|
|
633
710
|
*
|
|
634
711
|
* With `kept`, the dependencies that lockfile has in place for the adapter's tool at a version the
|
|
635
|
-
* plan accepts are left out (see {@link withoutKeptDependencies})
|
|
636
|
-
*
|
|
712
|
+
* plan accepts are left out (see {@link withoutKeptDependencies}), unless `notInPlace` says another
|
|
713
|
+
* tool of the run lacked one when it started. That runs before the reason is carried over, while
|
|
714
|
+
* the asset being updated is still the plan's one direct entry. A dependency the plan moves is
|
|
715
|
+
* checked against the installed assets that depend on it, as the update leaves them (see
|
|
716
|
+
* {@link changedBy}).
|
|
637
717
|
*/
|
|
638
718
|
function planFor(registry, installed, version, kept) {
|
|
639
719
|
const resolved = resolveInstallPlan(registry, installed.name, installed.type, version, installed.org);
|
|
640
|
-
const plan = kept
|
|
720
|
+
const plan = kept
|
|
721
|
+
? withoutKeptDependencies(resolved, kept.lockfile, [{ adapter: kept.adapter }], {
|
|
722
|
+
...kept,
|
|
723
|
+
changing: changedBy(registry, installed, resolved, kept),
|
|
724
|
+
})
|
|
725
|
+
: resolved;
|
|
641
726
|
const reason = installed.installReason ?? 'direct';
|
|
642
727
|
return {
|
|
643
728
|
...plan,
|
|
@@ -707,7 +792,8 @@ async function updateAssetPlanned(assetName, installed, registry, options) {
|
|
|
707
792
|
let plan;
|
|
708
793
|
let kept;
|
|
709
794
|
try {
|
|
710
|
-
|
|
795
|
+
const recorded = await readLockfile(projectDir);
|
|
796
|
+
kept = { ...options, lockfile: options.toolLockfile ?? recorded, recorded };
|
|
711
797
|
plan = planFor(registry, installed, toVersion, kept);
|
|
712
798
|
}
|
|
713
799
|
catch (planError) {
|
|
@@ -723,8 +809,9 @@ async function updateAssetPlanned(assetName, installed, registry, options) {
|
|
|
723
809
|
...(own ? [own] : []),
|
|
724
810
|
...editsReplacedBy(plan, installed, newDeps, kept.lockfile, adapter, options.localEdits),
|
|
725
811
|
];
|
|
726
|
-
if (edited.length > 0)
|
|
727
|
-
throw localEditsError(assetName, edited, assetSpec(installed, options.type), scope);
|
|
812
|
+
if (edited.length > 0) {
|
|
813
|
+
throw localEditsError(assetName, edited, assetSpec(kept.lockfile, installed, options.type), scope);
|
|
814
|
+
}
|
|
728
815
|
}
|
|
729
816
|
// Download the target version before removing anything, so a refused download (an outdated
|
|
730
817
|
// CLI, an expired sign-in, the API down) leaves the installed version in place.
|
|
@@ -889,7 +976,7 @@ async function updateAssetPlanned(assetName, installed, registry, options) {
|
|
|
889
976
|
onProgress?.(`Warning: ${message}`);
|
|
890
977
|
// Other tools may still need the dependency, so the command removes it for this tool only.
|
|
891
978
|
const toolFlag = (options.configuredAdapters?.length ?? 1) > 1 ? ` --tool ${adapter.tool}` : '';
|
|
892
|
-
const spec =
|
|
979
|
+
const spec = entrySpec(updatedLockfile, depAsset);
|
|
893
980
|
warnings.push({ command: scopedCommand(`atk uninstall ${spec}${toolFlag}`, scope), message });
|
|
894
981
|
}
|
|
895
982
|
}
|