@iyexin/mio-android-tools 0.1.1 → 0.1.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/dist/discover.d.ts +27 -1
- package/dist/discover.js +106 -80
- package/dist/discover.js.map +1 -1
- package/dist/ensure.d.ts +28 -0
- package/dist/ensure.js +45 -0
- package/dist/ensure.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tool-bundle.d.ts +25 -9
- package/dist/tool-bundle.js +91 -78
- package/dist/tool-bundle.js.map +1 -1
- package/package.json +1 -1
package/dist/discover.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type ToolSource = "env-bundle" | "android-sdk";
|
|
1
2
|
export interface AndroidTools {
|
|
2
3
|
/** Java executable. Absolute path when known, otherwise "java" from PATH. */
|
|
3
4
|
java: string;
|
|
@@ -8,7 +9,7 @@ export interface AndroidTools {
|
|
|
8
9
|
/** keytool executable, when available. */
|
|
9
10
|
keytool?: string;
|
|
10
11
|
/** Where the tools came from. */
|
|
11
|
-
source:
|
|
12
|
+
source: ToolSource;
|
|
12
13
|
/** build-tools version, when source is android-sdk. */
|
|
13
14
|
buildToolsVersion?: string;
|
|
14
15
|
/** Android SDK root, when source is android-sdk. */
|
|
@@ -16,18 +17,43 @@ export interface AndroidTools {
|
|
|
16
17
|
/** JRE home, when the tools bundle contains one. */
|
|
17
18
|
jreHome?: string;
|
|
18
19
|
}
|
|
20
|
+
/** What a machine currently has; every field is optional. */
|
|
21
|
+
export interface AndroidToolStatus {
|
|
22
|
+
java?: string;
|
|
23
|
+
jreHome?: string;
|
|
24
|
+
keytool?: string;
|
|
25
|
+
apksignerJar?: string;
|
|
26
|
+
zipalign?: string;
|
|
27
|
+
sdkRoot?: string;
|
|
28
|
+
buildToolsVersion?: string;
|
|
29
|
+
toolsSource?: ToolSource;
|
|
30
|
+
}
|
|
31
|
+
export declare function statusComplete(status: AndroidToolStatus): status is Required<Pick<AndroidToolStatus, "java" | "apksignerJar" | "zipalign">> & AndroidToolStatus;
|
|
32
|
+
export declare function toolsFromStatus(status: AndroidToolStatus): AndroidTools;
|
|
33
|
+
export declare function describeMissing(status: AndroidToolStatus): string;
|
|
19
34
|
export interface DiscoverOptions {
|
|
20
35
|
/** Override for tests; defaults to process.env. */
|
|
21
36
|
env?: NodeJS.ProcessEnv;
|
|
22
37
|
/** Override for tests; defaults to process.platform. */
|
|
23
38
|
platform?: NodeJS.Platform;
|
|
24
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Inspect what the machine has without throwing.
|
|
42
|
+
*
|
|
43
|
+
* Tools come from `MIO_ANDROID_TOOLS_DIR` first (a Mio bundle) and then the
|
|
44
|
+
* Android SDK build-tools; Java from the bundle's `jre/`, `MIO_JAVA_HOME`,
|
|
45
|
+
* `JAVA_HOME`, or `PATH`. A partial result is normal: a machine may have Java
|
|
46
|
+
* but no build-tools, or the other way round.
|
|
47
|
+
*/
|
|
48
|
+
export declare function inspectAndroidTools(options?: DiscoverOptions): Promise<AndroidToolStatus>;
|
|
25
49
|
/**
|
|
26
50
|
* Find a usable Android signing toolchain.
|
|
27
51
|
*
|
|
28
52
|
* Priority:
|
|
29
53
|
* 1. MIO_ANDROID_TOOLS_DIR (a downloaded/bundled toolchain)
|
|
30
54
|
* 2. ANDROID_HOME / ANDROID_SDK_ROOT / default SDK locations
|
|
55
|
+
*
|
|
56
|
+
* Throws with a message that says exactly what is missing.
|
|
31
57
|
*/
|
|
32
58
|
export declare function discoverAndroidTools(options?: DiscoverOptions): Promise<AndroidTools>;
|
|
33
59
|
export declare function describeAndroidTools(tools: AndroidTools): string;
|
package/dist/discover.js
CHANGED
|
@@ -4,6 +4,36 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { MioToolError } from "./errors.js";
|
|
6
6
|
import { run } from "./exec.js";
|
|
7
|
+
export function statusComplete(status) {
|
|
8
|
+
return Boolean(status.java && status.apksignerJar && status.zipalign);
|
|
9
|
+
}
|
|
10
|
+
export function toolsFromStatus(status) {
|
|
11
|
+
if (!statusComplete(status)) {
|
|
12
|
+
throw new MioToolError("ANDROID_TOOLS_NOT_FOUND", "Android build tools are incomplete", { details: describeMissing(status) });
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
java: status.java,
|
|
16
|
+
apksignerJar: status.apksignerJar,
|
|
17
|
+
zipalign: status.zipalign,
|
|
18
|
+
keytool: status.keytool,
|
|
19
|
+
source: status.toolsSource ?? "android-sdk",
|
|
20
|
+
buildToolsVersion: status.buildToolsVersion,
|
|
21
|
+
sdkRoot: status.sdkRoot,
|
|
22
|
+
jreHome: status.jreHome,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function describeMissing(status) {
|
|
26
|
+
const missing = [];
|
|
27
|
+
if (!status.java)
|
|
28
|
+
missing.push("java");
|
|
29
|
+
if (!status.apksignerJar)
|
|
30
|
+
missing.push("apksigner.jar");
|
|
31
|
+
if (!status.zipalign)
|
|
32
|
+
missing.push("zipalign");
|
|
33
|
+
return missing.length === 0
|
|
34
|
+
? "nothing missing"
|
|
35
|
+
: `missing: ${missing.join(", ")}`;
|
|
36
|
+
}
|
|
7
37
|
const isWindows = (platform) => platform === "win32";
|
|
8
38
|
const javaName = (platform) => isWindows(platform) ? "java.exe" : "java";
|
|
9
39
|
const keytoolName = (platform) => isWindows(platform) ? "keytool.exe" : "keytool";
|
|
@@ -71,26 +101,20 @@ async function findJavaFromPath(platform) {
|
|
|
71
101
|
}
|
|
72
102
|
return undefined;
|
|
73
103
|
}
|
|
74
|
-
async function
|
|
104
|
+
async function tryResolveJava(env, platform, preferredHome) {
|
|
75
105
|
const fromBundle = await findJavaInHome(preferredHome, platform);
|
|
76
|
-
if (fromBundle)
|
|
106
|
+
if (fromBundle)
|
|
77
107
|
return { java: fromBundle, jreHome: preferredHome };
|
|
78
|
-
}
|
|
79
108
|
const fromMioHome = await findJavaInHome(env.MIO_JAVA_HOME, platform);
|
|
80
|
-
if (fromMioHome)
|
|
109
|
+
if (fromMioHome)
|
|
81
110
|
return { java: fromMioHome, jreHome: env.MIO_JAVA_HOME };
|
|
82
|
-
}
|
|
83
111
|
const fromJavaHome = await findJavaInHome(env.JAVA_HOME, platform);
|
|
84
|
-
if (fromJavaHome)
|
|
112
|
+
if (fromJavaHome)
|
|
85
113
|
return { java: fromJavaHome, jreHome: env.JAVA_HOME };
|
|
86
|
-
}
|
|
87
114
|
const fromPath = await findJavaFromPath(platform);
|
|
88
|
-
if (fromPath)
|
|
115
|
+
if (fromPath)
|
|
89
116
|
return { java: fromPath };
|
|
90
|
-
|
|
91
|
-
throw new MioToolError("JAVA_NOT_FOUND", "Java was not found. Install a JDK/JRE 17+ or place a JRE at <tools>/jre.", {
|
|
92
|
-
details: "Set MIO_JAVA_HOME/JAVA_HOME, put java on PATH, or point MIO_ANDROID_TOOLS_DIR at a tools bundle containing jre/.",
|
|
93
|
-
});
|
|
117
|
+
return undefined;
|
|
94
118
|
}
|
|
95
119
|
async function resolveKeytool(java, platform) {
|
|
96
120
|
if (java === "java") {
|
|
@@ -107,37 +131,6 @@ async function resolveKeytool(java, platform) {
|
|
|
107
131
|
const candidate = join(dirname(java), keytoolName(platform));
|
|
108
132
|
return (await exists(candidate)) ? candidate : undefined;
|
|
109
133
|
}
|
|
110
|
-
async function fromToolsDir(dir, env, platform) {
|
|
111
|
-
const apksignerCandidates = [
|
|
112
|
-
join(dir, "apksigner.jar"),
|
|
113
|
-
join(dir, "lib", "apksigner.jar"),
|
|
114
|
-
];
|
|
115
|
-
const zipalignCandidates = [
|
|
116
|
-
join(dir, zipalignName(platform)),
|
|
117
|
-
join(dir, "bin", zipalignName(platform)),
|
|
118
|
-
];
|
|
119
|
-
const apksignerJar = await firstExisting(apksignerCandidates);
|
|
120
|
-
const zipalign = await firstExisting(zipalignCandidates);
|
|
121
|
-
if (!apksignerJar || !zipalign) {
|
|
122
|
-
throw new MioToolError("INVALID_TOOLS_DIR", `MIO_ANDROID_TOOLS_DIR does not look like an Android tools bundle: ${dir}`, {
|
|
123
|
-
details: "Expected apksigner.jar (or lib/apksigner.jar), zipalign, and optionally jre/.",
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
const jreHomeCandidate = join(dir, "jre");
|
|
127
|
-
const jreHome = (await exists(join(jreHomeCandidate, "bin", javaName(platform))))
|
|
128
|
-
? jreHomeCandidate
|
|
129
|
-
: undefined;
|
|
130
|
-
const { java, jreHome: resolvedJreHome } = await resolveJava(env, platform, jreHome);
|
|
131
|
-
const keytool = await resolveKeytool(java, platform);
|
|
132
|
-
return {
|
|
133
|
-
java,
|
|
134
|
-
apksignerJar,
|
|
135
|
-
zipalign,
|
|
136
|
-
keytool,
|
|
137
|
-
source: "env-bundle",
|
|
138
|
-
jreHome: resolvedJreHome,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
134
|
async function firstExisting(candidates) {
|
|
142
135
|
for (const candidate of candidates) {
|
|
143
136
|
if (await exists(candidate))
|
|
@@ -174,40 +167,65 @@ async function findBuildTools(sdkRoot, platform) {
|
|
|
174
167
|
}
|
|
175
168
|
return undefined;
|
|
176
169
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Inspect what the machine has without throwing.
|
|
172
|
+
*
|
|
173
|
+
* Tools come from `MIO_ANDROID_TOOLS_DIR` first (a Mio bundle) and then the
|
|
174
|
+
* Android SDK build-tools; Java from the bundle's `jre/`, `MIO_JAVA_HOME`,
|
|
175
|
+
* `JAVA_HOME`, or `PATH`. A partial result is normal: a machine may have Java
|
|
176
|
+
* but no build-tools, or the other way round.
|
|
177
|
+
*/
|
|
178
|
+
export async function inspectAndroidTools(options = {}) {
|
|
179
|
+
const env = options.env ?? process.env;
|
|
180
|
+
const platform = options.platform ?? process.platform;
|
|
181
|
+
const status = {};
|
|
182
|
+
const toolsDir = env.MIO_ANDROID_TOOLS_DIR;
|
|
183
|
+
if (toolsDir) {
|
|
184
|
+
status.apksignerJar = await firstExisting([
|
|
185
|
+
join(toolsDir, "apksigner.jar"),
|
|
186
|
+
join(toolsDir, "lib", "apksigner.jar"),
|
|
188
187
|
]);
|
|
189
|
-
|
|
190
|
-
join(
|
|
191
|
-
join(
|
|
188
|
+
status.zipalign = await firstExisting([
|
|
189
|
+
join(toolsDir, zipalignName(platform)),
|
|
190
|
+
join(toolsDir, "bin", zipalignName(platform)),
|
|
192
191
|
]);
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
192
|
+
if (status.apksignerJar && status.zipalign)
|
|
193
|
+
status.toolsSource = "env-bundle";
|
|
194
|
+
const jreHome = join(toolsDir, "jre");
|
|
195
|
+
if (await exists(join(jreHome, "bin", javaName(platform)))) {
|
|
196
|
+
status.jreHome = jreHome;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!status.apksignerJar || !status.zipalign) {
|
|
200
|
+
for (const root of candidateSdkRoots(env, platform)) {
|
|
201
|
+
if (!(await exists(root)))
|
|
202
|
+
continue;
|
|
203
|
+
const match = await findBuildTools(root, platform);
|
|
204
|
+
if (!match)
|
|
205
|
+
continue;
|
|
206
|
+
status.apksignerJar = await firstExisting([
|
|
207
|
+
join(match.dir, "lib", "apksigner.jar"),
|
|
208
|
+
join(match.dir, "apksigner.jar"),
|
|
209
|
+
]);
|
|
210
|
+
status.zipalign = await firstExisting([
|
|
211
|
+
join(match.dir, zipalignName(platform)),
|
|
212
|
+
join(match.dir, "bin", zipalignName(platform)),
|
|
213
|
+
]);
|
|
214
|
+
if (status.apksignerJar && status.zipalign) {
|
|
215
|
+
status.toolsSource = "android-sdk";
|
|
216
|
+
status.sdkRoot = root;
|
|
217
|
+
status.buildToolsVersion = match.version;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const java = await tryResolveJava(env, platform, status.jreHome);
|
|
223
|
+
if (java) {
|
|
224
|
+
status.java = java.java;
|
|
225
|
+
status.jreHome = java.jreHome ?? status.jreHome;
|
|
226
|
+
status.keytool = await resolveKeytool(java.java, platform);
|
|
227
|
+
}
|
|
228
|
+
return status;
|
|
211
229
|
}
|
|
212
230
|
/**
|
|
213
231
|
* Find a usable Android signing toolchain.
|
|
@@ -215,14 +233,22 @@ async function fromAndroidSdk(env, platform) {
|
|
|
215
233
|
* Priority:
|
|
216
234
|
* 1. MIO_ANDROID_TOOLS_DIR (a downloaded/bundled toolchain)
|
|
217
235
|
* 2. ANDROID_HOME / ANDROID_SDK_ROOT / default SDK locations
|
|
236
|
+
*
|
|
237
|
+
* Throws with a message that says exactly what is missing.
|
|
218
238
|
*/
|
|
219
239
|
export async function discoverAndroidTools(options = {}) {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
240
|
+
const status = await inspectAndroidTools(options);
|
|
241
|
+
if (!status.java) {
|
|
242
|
+
throw new MioToolError("JAVA_NOT_FOUND", "Java was not found. Install a JDK/JRE 17+ or let Mio download one.", {
|
|
243
|
+
details: "Set MIO_JAVA_HOME/JAVA_HOME, put java on PATH, or set MIO_ANDROID_TOOLS_DIR to a tools bundle containing jre/.",
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (!status.apksignerJar || !status.zipalign) {
|
|
247
|
+
throw new MioToolError("ANDROID_TOOLS_NOT_FOUND", "Android build-tools (apksigner + zipalign) were not found.", {
|
|
248
|
+
details: "Set ANDROID_HOME (or MIO_ANDROID_SDK), install Android build-tools 35+, or point MIO_ANDROID_TOOLS_DIR at a Mio tools bundle.",
|
|
249
|
+
});
|
|
224
250
|
}
|
|
225
|
-
return
|
|
251
|
+
return toolsFromStatus(status);
|
|
226
252
|
}
|
|
227
253
|
export function describeAndroidTools(tools) {
|
|
228
254
|
const source = tools.source === "android-sdk"
|
package/dist/discover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAmChC,MAAM,UAAU,cAAc,CAAC,MAAyB;IAItD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAyB;IAC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C,YAAY,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7C,MAAM,IAAI,YAAY,CACpB,yBAAyB,EACzB,4DAA4D,EAC5D;YACE,OAAO,EACL,+HAA+H;SAClI,CACF,CAAC;IACJ,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAmB;IACtD,MAAM,MAAM,GACV,KAAK,CAAC,MAAM,KAAK,aAAa;QAC5B,CAAC,CAAC,2BAA2B,KAAK,CAAC,iBAAiB,IAAI,GAAG,EAAE;QAC7D,CAAC,CAAC,kBAAkB,CAAC;IACzB,OAAO;QACL,WAAW,MAAM,EAAE;QACnB,SAAS,KAAK,CAAC,IAAI,EAAE;QACrB,cAAc,KAAK,CAAC,YAAY,EAAE;QAClC,aAAa,KAAK,CAAC,QAAQ,EAAE;QAC7B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,oBAAoB;KACnE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/ensure.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AndroidTools } from "./discover.js";
|
|
2
|
+
import { type ToolBundleManifest, type ToolComponent } from "./tool-bundle.js";
|
|
3
|
+
export interface EnsureAndroidToolsOptions {
|
|
4
|
+
/** Manifest object, local path, or URL. Required when something is missing. */
|
|
5
|
+
manifest: ToolBundleManifest | string;
|
|
6
|
+
/** Defaults to ~/.mio/tools/android. */
|
|
7
|
+
cacheDir?: string;
|
|
8
|
+
proxy?: string;
|
|
9
|
+
/** Re-download every requested component even when cached. */
|
|
10
|
+
force?: boolean;
|
|
11
|
+
/** Set false to fail instead of downloading (offline builds, tests). */
|
|
12
|
+
allowDownload?: boolean;
|
|
13
|
+
log?: (message: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface EnsureAndroidToolsResult {
|
|
16
|
+
tools: AndroidTools;
|
|
17
|
+
/** Components fetched in this call; empty when the machine had everything. */
|
|
18
|
+
installed: ToolComponent[];
|
|
19
|
+
downloaded: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a complete Android toolchain, downloading only what is missing.
|
|
23
|
+
*
|
|
24
|
+
* Existing Java or build-tools are reused: a machine with a JDK but no SDK only
|
|
25
|
+
* fetches `tools` (~1.5 MB), one with build-tools but no Java only fetches
|
|
26
|
+
* `jre` (~18 MB).
|
|
27
|
+
*/
|
|
28
|
+
export declare function ensureAndroidTools(options: EnsureAndroidToolsOptions): Promise<EnsureAndroidToolsResult>;
|
package/dist/ensure.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MioToolError } from "./errors.js";
|
|
2
|
+
import { describeMissing, inspectAndroidTools, statusComplete, toolsFromStatus, } from "./discover.js";
|
|
3
|
+
import { installToolBundle, } from "./tool-bundle.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a complete Android toolchain, downloading only what is missing.
|
|
6
|
+
*
|
|
7
|
+
* Existing Java or build-tools are reused: a machine with a JDK but no SDK only
|
|
8
|
+
* fetches `tools` (~1.5 MB), one with build-tools but no Java only fetches
|
|
9
|
+
* `jre` (~18 MB).
|
|
10
|
+
*/
|
|
11
|
+
export async function ensureAndroidTools(options) {
|
|
12
|
+
const log = options.log ?? (() => { });
|
|
13
|
+
let status = await inspectAndroidTools();
|
|
14
|
+
if (statusComplete(status) && !options.force) {
|
|
15
|
+
return { tools: toolsFromStatus(status), installed: [], downloaded: false };
|
|
16
|
+
}
|
|
17
|
+
if (options.allowDownload === false) {
|
|
18
|
+
throw new MioToolError("ANDROID_TOOLS_NOT_FOUND", `Android build tools are incomplete (${describeMissing(status)})`, { details: "Downloading is disabled (MIO_NO_TOOL_DOWNLOAD); install them or allow downloads." });
|
|
19
|
+
}
|
|
20
|
+
const needed = [];
|
|
21
|
+
if (!status.apksignerJar || !status.zipalign)
|
|
22
|
+
needed.push("tools");
|
|
23
|
+
if (!status.java)
|
|
24
|
+
needed.push("jre");
|
|
25
|
+
// A forced refresh reinstalls everything, even when the machine looks ready.
|
|
26
|
+
if (needed.length === 0)
|
|
27
|
+
needed.push("tools", "jre");
|
|
28
|
+
log(`${describeMissing(status)}; fetching ${needed.join(" + ")}`);
|
|
29
|
+
const bundle = await installToolBundle({
|
|
30
|
+
manifest: options.manifest,
|
|
31
|
+
components: needed,
|
|
32
|
+
cacheDir: options.cacheDir,
|
|
33
|
+
proxy: options.proxy,
|
|
34
|
+
force: options.force,
|
|
35
|
+
log,
|
|
36
|
+
});
|
|
37
|
+
status = await inspectAndroidTools({
|
|
38
|
+
env: { ...process.env, MIO_ANDROID_TOOLS_DIR: bundle.dir },
|
|
39
|
+
});
|
|
40
|
+
if (!statusComplete(status)) {
|
|
41
|
+
throw new MioToolError("ANDROID_TOOLS_NOT_FOUND", `Android build tools are still incomplete after installing the bundle (${describeMissing(status)})`, { details: `bundle: ${bundle.dir}` });
|
|
42
|
+
}
|
|
43
|
+
return { tools: toolsFromStatus(status), installed: bundle.installed, downloaded: true };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ensure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure.js","sourceRoot":"","sources":["../src/ensure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,eAAe,GAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,GAGlB,MAAM,kBAAkB,CAAC;AAsB1B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAkC;IAElC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACtC,IAAI,MAAM,GAAG,MAAM,m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AAqB,EAAE,MAAM,CAAC,GAAG,EAAE;KAC3D,CAAC,CAAC;IAEH,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,YAAY,CACpB,yBAAyB,EACzB,yEAAyE,eAAe,CAAC,MAAM,CAAC,GAAG,EACnG,EAAE,OAAO,EAAE,WAAW,MAAM,CAAC,GAAG,EAAE,EAAE,CACrC,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC3F,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { MioToolError } from "./errors.js";
|
|
2
2
|
export type { MioToolErrorCode, MioToolErrorOptions } from "./errors.js";
|
|
3
|
-
export { discoverAndroidTools, describeAndroidTools, type AndroidTools, type DiscoverOptions, } from "./discover.js";
|
|
3
|
+
export { discoverAndroidTools, describeAndroidTools, inspectAndroidTools, statusComplete, toolsFromStatus, describeMissing, type AndroidToolStatus, type AndroidTools, type DiscoverOptions, } from "./discover.js";
|
|
4
|
+
export { ensureAndroidTools, type EnsureAndroidToolsOptions, type EnsureAndroidToolsResult, } from "./ensure.js";
|
|
4
5
|
export { alignApk, checkAlignment, type AlignOptions, type AlignmentCheck, type PageSize, } from "./zipalign.js";
|
|
5
6
|
export { signApkWithApksigner, verifyApkWithApksigner, buildSignArgs, parseVerifyOutput, type SignApkWithApksignerOptions, type VerifyApkOptions, type VerifyResult, type SignerCertificate, } from "./apksigner.js";
|
|
6
7
|
export { ensureDebugKeystore, type DebugKeystoreOptions } from "./keystore.js";
|
|
@@ -8,6 +9,6 @@ export { parseAxml, patchManifestAxml, type AxmlAttribute, type AxmlDocument, ty
|
|
|
8
9
|
export { injectApk, type InjectApkOptions, type InjectApkResult, } from "./apk.js";
|
|
9
10
|
export { injectWindowsExe, type InjectWindowsExeOptions, type InjectWindowsExeResult, } from "./windows.js";
|
|
10
11
|
export { signApk, verifyApk, type SignApkOptions, type SignResult, } from "./signing.js";
|
|
11
|
-
export { installToolBundle, platformKeyOf, type InstallToolBundleOptions, type InstalledToolBundle, type ToolBundleManifest, type ToolBundlePlatform, } from "./tool-bundle.js";
|
|
12
|
+
export { installToolBundle, platformKeyOf, type InstallToolBundleOptions, type InstalledToolBundle, type ToolBundleComponent, type ToolBundleManifest, type ToolBundlePlatform, type ToolComponent, } from "./tool-bundle.js";
|
|
12
13
|
export { run, type ExecOptions, type ExecResult } from "./exec.js";
|
|
13
14
|
export { listZipEntries, extractZip, readZipEntry } from "./zip.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { MioToolError } from "./errors.js";
|
|
2
|
-
export { discoverAndroidTools, describeAndroidTools, } from "./discover.js";
|
|
2
|
+
export { discoverAndroidTools, describeAndroidTools, inspectAndroidTools, statusComplete, toolsFromStatus, describeMissing, } from "./discover.js";
|
|
3
|
+
export { ensureAndroidTools, } from "./ensure.js";
|
|
3
4
|
export { alignApk, checkAlignment, } from "./zipalign.js";
|
|
4
5
|
export { signApkWithApksigner, verifyApkWithApksigner, buildSignArgs, parseVerifyOutput, } from "./apksigner.js";
|
|
5
6
|
export { ensureDebugKeystore } from "./keystore.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,GAIhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,GAGnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,QAAQ,EACR,cAAc,GAIf,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,GAKlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAA6B,MAAM,eAAe,CAAC;AAE/E,OAAO,EACL,SAAS,EACT,iBAAiB,GAKlB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,SAAS,GAGV,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,gBAAgB,GAGjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,OAAO,EACP,SAAS,GAGV,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,aAAa,GAOd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAqC,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/tool-bundle.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A tool bundle ships two independently downloadable components:
|
|
3
|
+
*
|
|
4
|
+
* - `tools`: apksigner.jar + zipalign[.exe] (~1.5 MB)
|
|
5
|
+
* - `jre`: a jlink-trimmed Java runtime with java.base + java.logging (~18 MB)
|
|
6
|
+
*
|
|
7
|
+
* A machine that already has Java only needs `tools`, and one that has the
|
|
8
|
+
* Android build-tools only needs `jre`. The installer never re-downloads a
|
|
9
|
+
* component whose digest still matches.
|
|
10
|
+
*/
|
|
11
|
+
export interface ToolBundleComponent {
|
|
3
12
|
/** Archive URL (http:, https:, or file:). */
|
|
4
13
|
url: string;
|
|
5
14
|
/** SHA-256 of the archive. */
|
|
@@ -9,13 +18,18 @@ export interface ToolBundlePlatform {
|
|
|
9
18
|
/** Number of leading path segments to strip during extraction. Default: 1. */
|
|
10
19
|
strip?: number;
|
|
11
20
|
}
|
|
21
|
+
export interface ToolBundlePlatform {
|
|
22
|
+
tools?: ToolBundleComponent;
|
|
23
|
+
jre?: ToolBundleComponent;
|
|
24
|
+
}
|
|
12
25
|
export interface ToolBundleManifest {
|
|
13
|
-
schemaVersion:
|
|
26
|
+
schemaVersion: 2;
|
|
14
27
|
latest: string;
|
|
15
28
|
bundles: Record<string, {
|
|
16
29
|
platforms: Record<string, ToolBundlePlatform>;
|
|
17
30
|
}>;
|
|
18
31
|
}
|
|
32
|
+
export type ToolComponent = "tools" | "jre";
|
|
19
33
|
export interface InstallToolBundleOptions {
|
|
20
34
|
/** Manifest object, local path, or http(s)/file URL. */
|
|
21
35
|
manifest: ToolBundleManifest | string;
|
|
@@ -29,19 +43,21 @@ export interface InstallToolBundleOptions {
|
|
|
29
43
|
proxy?: string;
|
|
30
44
|
/** Re-download even if a cached bundle exists. */
|
|
31
45
|
force?: boolean;
|
|
46
|
+
/** Which components to install. Defaults to both. */
|
|
47
|
+
components?: ToolComponent[];
|
|
48
|
+
log?: (message: string) => void;
|
|
32
49
|
}
|
|
33
50
|
export interface InstalledToolBundle {
|
|
34
|
-
tools: AndroidTools;
|
|
35
51
|
dir: string;
|
|
36
52
|
version: string;
|
|
37
53
|
platform: string;
|
|
54
|
+
installed: ToolComponent[];
|
|
38
55
|
}
|
|
39
|
-
declare function platformKeyOf(platform: NodeJS.Platform, arch: string): string;
|
|
56
|
+
export declare function platformKeyOf(platform: NodeJS.Platform, arch: string): string;
|
|
40
57
|
/**
|
|
41
|
-
* Download, verify
|
|
58
|
+
* Download, verify and cache the requested components of a tool bundle.
|
|
42
59
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
60
|
+
* Components whose cached digest still matches are kept; only the missing ones
|
|
61
|
+
* are fetched. Pass `force` to reinstall everything.
|
|
45
62
|
*/
|
|
46
63
|
export declare function installToolBundle(options: InstallToolBundleOptions): Promise<InstalledToolBundle>;
|
|
47
|
-
export { platformKeyOf };
|
package/dist/tool-bundle.js
CHANGED
|
@@ -6,10 +6,9 @@ import { dirname, join } from "node:path";
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import * as tar from "tar";
|
|
8
8
|
import { ProxyAgent, fetch as undiciFetch } from "undici";
|
|
9
|
-
import { discoverAndroidTools } from "./discover.js";
|
|
10
9
|
import { MioToolError } from "./errors.js";
|
|
11
|
-
const
|
|
12
|
-
function platformKeyOf(platform, arch) {
|
|
10
|
+
const MARKER_FILE = ".mio-tools.json";
|
|
11
|
+
export function platformKeyOf(platform, arch) {
|
|
13
12
|
return `${platform}-${arch}`;
|
|
14
13
|
}
|
|
15
14
|
function defaultCacheDir() {
|
|
@@ -40,9 +39,8 @@ async function fetchBuffer(url, proxy) {
|
|
|
40
39
|
return await readFile(fileURLToPath(url));
|
|
41
40
|
}
|
|
42
41
|
const init = {};
|
|
43
|
-
if (proxy)
|
|
42
|
+
if (proxy)
|
|
44
43
|
init.dispatcher = new ProxyAgent(proxy);
|
|
45
|
-
}
|
|
46
44
|
let response;
|
|
47
45
|
try {
|
|
48
46
|
response = await undiciFetch(url, init);
|
|
@@ -74,12 +72,12 @@ async function loadManifest(source, proxy) {
|
|
|
74
72
|
});
|
|
75
73
|
}
|
|
76
74
|
const manifest = parsed;
|
|
77
|
-
if (manifest.schemaVersion !==
|
|
75
|
+
if (manifest.schemaVersion !== 2 || typeof manifest.latest !== "string" || !manifest.bundles) {
|
|
78
76
|
throw new MioToolError("BUNDLE_DOWNLOAD_FAILED", "Unsupported tool bundle manifest");
|
|
79
77
|
}
|
|
80
78
|
return manifest;
|
|
81
79
|
}
|
|
82
|
-
function
|
|
80
|
+
function selectPlatform(manifest, version, platform) {
|
|
83
81
|
const bundle = manifest.bundles[version];
|
|
84
82
|
if (!bundle) {
|
|
85
83
|
throw new MioToolError("BUNDLE_DOWNLOAD_FAILED", `Unknown tool bundle version: ${version}`);
|
|
@@ -93,15 +91,12 @@ function selectBundle(manifest, version, platform) {
|
|
|
93
91
|
async function readMarker(path) {
|
|
94
92
|
try {
|
|
95
93
|
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
96
|
-
if (typeof parsed.version !== "string" ||
|
|
97
|
-
typeof parsed.platform !== "string" ||
|
|
98
|
-
typeof parsed.sha256 !== "string") {
|
|
94
|
+
if (typeof parsed.version !== "string" || typeof parsed.platform !== "string")
|
|
99
95
|
return undefined;
|
|
100
|
-
}
|
|
101
96
|
return {
|
|
102
97
|
version: parsed.version,
|
|
103
98
|
platform: parsed.platform,
|
|
104
|
-
|
|
99
|
+
components: parsed.components ?? {},
|
|
105
100
|
installedAt: parsed.installedAt ?? "",
|
|
106
101
|
};
|
|
107
102
|
}
|
|
@@ -109,59 +104,27 @@ async function readMarker(path) {
|
|
|
109
104
|
return undefined;
|
|
110
105
|
}
|
|
111
106
|
}
|
|
112
|
-
async function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
for (const candidate of zipalign) {
|
|
125
|
-
if (await exists(candidate))
|
|
126
|
-
break;
|
|
127
|
-
if (candidate === zipalign[zipalign.length - 1]) {
|
|
128
|
-
throw new MioToolError("BUNDLE_EXTRACT_FAILED", "Tool bundle is missing zipalign");
|
|
129
|
-
}
|
|
130
|
-
}
|
|
107
|
+
async function componentPresent(dir, component) {
|
|
108
|
+
if (component === "tools") {
|
|
109
|
+
const jar = [join(dir, "apksigner.jar"), join(dir, "lib", "apksigner.jar")];
|
|
110
|
+
const align = process.platform === "win32"
|
|
111
|
+
? [join(dir, "zipalign.exe"), join(dir, "bin", "zipalign.exe")]
|
|
112
|
+
: [join(dir, "zipalign"), join(dir, "bin", "zipalign")];
|
|
113
|
+
return (await anyExists(jar)) && (await anyExists(align));
|
|
114
|
+
}
|
|
115
|
+
const java = process.platform === "win32" ? "java.exe" : "java";
|
|
116
|
+
return await exists(join(dir, "jre", "bin", java));
|
|
131
117
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
* optionally jre/. The archive is authenticated by SHA-256 before extraction.
|
|
137
|
-
*/
|
|
138
|
-
export async function installToolBundle(options) {
|
|
139
|
-
const proxy = options.proxy ?? defaultProxy();
|
|
140
|
-
const manifest = await loadManifest(options.manifest, proxy);
|
|
141
|
-
const version = options.version ?? manifest.latest;
|
|
142
|
-
const platform = options.platform ?? platformKeyOf(process.platform, process.arch);
|
|
143
|
-
const entry = selectBundle(manifest, version, platform);
|
|
144
|
-
const cacheDir = options.cacheDir ?? defaultCacheDir();
|
|
145
|
-
const dest = join(cacheDir, version, platform);
|
|
146
|
-
const markerPath = join(dest, MANIFEST_FILE);
|
|
147
|
-
await mkdir(cacheDir, { recursive: true });
|
|
148
|
-
if (!options.force) {
|
|
149
|
-
const marker = await readMarker(markerPath);
|
|
150
|
-
if (marker?.sha256 === entry.sha256 && (await exists(dest))) {
|
|
151
|
-
try {
|
|
152
|
-
const tools = await discoverAndroidTools({
|
|
153
|
-
env: { ...process.env, MIO_ANDROID_TOOLS_DIR: dest },
|
|
154
|
-
});
|
|
155
|
-
return { tools, dir: dest, version, platform };
|
|
156
|
-
}
|
|
157
|
-
catch {
|
|
158
|
-
// Cached bundle is incomplete or corrupt; fall through and reinstall.
|
|
159
|
-
await rm(dest, { recursive: true, force: true });
|
|
160
|
-
}
|
|
161
|
-
}
|
|
118
|
+
async function anyExists(paths) {
|
|
119
|
+
for (const path of paths) {
|
|
120
|
+
if (await exists(path))
|
|
121
|
+
return true;
|
|
162
122
|
}
|
|
163
|
-
|
|
164
|
-
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
async function extractComponent(entry, proxy, target) {
|
|
126
|
+
const tempRoot = await mkdtemp(join(target, "..", ".download-"));
|
|
127
|
+
const archivePath = join(tempRoot, "component.tar.gz");
|
|
165
128
|
const extractDir = join(tempRoot, "extracted");
|
|
166
129
|
try {
|
|
167
130
|
await mkdir(extractDir, { recursive: true });
|
|
@@ -181,24 +144,74 @@ export async function installToolBundle(options) {
|
|
|
181
144
|
strict: true,
|
|
182
145
|
preservePaths: false,
|
|
183
146
|
});
|
|
184
|
-
await
|
|
185
|
-
await
|
|
186
|
-
await
|
|
187
|
-
await rename(extractDir, dest);
|
|
188
|
-
await writeFile(markerPath, JSON.stringify({
|
|
189
|
-
version,
|
|
190
|
-
platform,
|
|
191
|
-
sha256: entry.sha256,
|
|
192
|
-
installedAt: new Date().toISOString(),
|
|
193
|
-
}, null, 2));
|
|
194
|
-
const tools = await discoverAndroidTools({
|
|
195
|
-
env: { ...process.env, MIO_ANDROID_TOOLS_DIR: dest },
|
|
196
|
-
});
|
|
197
|
-
return { tools, dir: dest, version, platform };
|
|
147
|
+
await rm(target, { recursive: true, force: true });
|
|
148
|
+
await mkdir(dirname(target), { recursive: true });
|
|
149
|
+
await rename(extractDir, target);
|
|
198
150
|
}
|
|
199
151
|
finally {
|
|
200
152
|
await rm(tempRoot, { recursive: true, force: true });
|
|
201
153
|
}
|
|
202
154
|
}
|
|
203
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Download, verify and cache the requested components of a tool bundle.
|
|
157
|
+
*
|
|
158
|
+
* Components whose cached digest still matches are kept; only the missing ones
|
|
159
|
+
* are fetched. Pass `force` to reinstall everything.
|
|
160
|
+
*/
|
|
161
|
+
export async function installToolBundle(options) {
|
|
162
|
+
const log = options.log ?? (() => { });
|
|
163
|
+
const proxy = options.proxy ?? defaultProxy();
|
|
164
|
+
const manifest = await loadManifest(options.manifest, proxy);
|
|
165
|
+
const version = options.version ?? manifest.latest;
|
|
166
|
+
const platform = options.platform ?? platformKeyOf(process.platform, process.arch);
|
|
167
|
+
const entry = selectPlatform(manifest, version, platform);
|
|
168
|
+
const cacheDir = options.cacheDir ?? defaultCacheDir();
|
|
169
|
+
const dest = join(cacheDir, version, platform);
|
|
170
|
+
const requested = options.components ?? ["tools", "jre"];
|
|
171
|
+
await mkdir(dest, { recursive: true });
|
|
172
|
+
const markerPath = join(dest, MARKER_FILE);
|
|
173
|
+
const marker = options.force ? undefined : await readMarker(markerPath);
|
|
174
|
+
const components = {};
|
|
175
|
+
const installed = [];
|
|
176
|
+
for (const component of requested) {
|
|
177
|
+
const source = entry[component];
|
|
178
|
+
if (!source) {
|
|
179
|
+
throw new MioToolError("BUNDLE_DOWNLOAD_FAILED", `Tool bundle ${version} has no "${component}" component for ${platform}`);
|
|
180
|
+
}
|
|
181
|
+
const cachedDigest = marker?.components[component];
|
|
182
|
+
const present = await componentPresent(dest, component);
|
|
183
|
+
if (!options.force &&
|
|
184
|
+
cachedDigest === source.sha256.toLowerCase() &&
|
|
185
|
+
present) {
|
|
186
|
+
components[component] = cachedDigest;
|
|
187
|
+
log(`${component}: cached`);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
const target = component === "tools" ? join(dest, "tools-root") : join(dest, "jre");
|
|
191
|
+
log(`downloading ${component} (${source.url})`);
|
|
192
|
+
await extractComponent(source, proxy, target);
|
|
193
|
+
if (component === "tools") {
|
|
194
|
+
// Move the flat tools archive into the bundle root.
|
|
195
|
+
for (const name of ["apksigner.jar", "zipalign", "zipalign.exe"]) {
|
|
196
|
+
const from = join(target, name);
|
|
197
|
+
if (await exists(from))
|
|
198
|
+
await rename(from, join(dest, name));
|
|
199
|
+
}
|
|
200
|
+
await rm(target, { recursive: true, force: true });
|
|
201
|
+
}
|
|
202
|
+
if (!(await componentPresent(dest, component))) {
|
|
203
|
+
throw new MioToolError("BUNDLE_EXTRACT_FAILED", `Tool bundle is missing files for "${component}"`);
|
|
204
|
+
}
|
|
205
|
+
components[component] = source.sha256.toLowerCase();
|
|
206
|
+
installed.push(component);
|
|
207
|
+
}
|
|
208
|
+
const now = new Date().toISOString();
|
|
209
|
+
await writeFile(markerPath, JSON.stringify({
|
|
210
|
+
version,
|
|
211
|
+
platform,
|
|
212
|
+
components: { ...(marker?.components ?? {}), ...components },
|
|
213
|
+
installedAt: now,
|
|
214
|
+
}, null, 2));
|
|
215
|
+
return { dir: dest, version, platform, installed };
|
|
216
|
+
}
|
|
204
217
|
//# sourceMappingURL=tool-bundle.js.map
|
package/dist/tool-bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-bundle.js","sourceRoot":"","sources":["../src/tool-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tool-bundle.js","sourceRoot":"","sources":["../src/tool-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EA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