@pylair/cli 0.1.0-rc.30 → 0.1.0-rc.32
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 +1 -1
- package/dist/build.d.ts +19 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +69 -1
- package/dist/build.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +103 -4
- package/dist/cli.js.map +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +5 -1
- package/dist/codegen.js.map +1 -1
- package/dist/compat.d.ts +34 -0
- package/dist/compat.d.ts.map +1 -0
- package/dist/compat.js +27 -0
- package/dist/compat.js.map +1 -0
- package/dist/compat.json +70 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/dev.d.ts +3 -0
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +36 -2
- package/dist/dev.js.map +1 -1
- package/dist/doctor.d.ts +8 -23
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +51 -96
- package/dist/doctor.js.map +1 -1
- package/dist/keys.d.ts +50 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +192 -0
- package/dist/keys.js.map +1 -0
- package/dist/preflight.d.ts +59 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +150 -0
- package/dist/preflight.js.map +1 -0
- package/dist/update.d.ts +64 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +266 -0
- package/dist/update.js.map +1 -0
- package/dist/upgrade.d.ts +41 -0
- package/dist/upgrade.d.ts.map +1 -0
- package/dist/upgrade.js +195 -0
- package/dist/upgrade.js.map +1 -0
- package/dist/versions.d.ts +58 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/versions.js +236 -0
- package/dist/versions.js.map +1 -0
- package/package.json +2 -2
package/dist/update.js
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/** Auto-update support (decision 0011): `pylair update manifest` plus the
|
|
2
|
+
* checks `pylair build` runs on updater-enabled apps.
|
|
3
|
+
*
|
|
4
|
+
* The manifest is Tauri's update JSON:
|
|
5
|
+
* {version, notes?, pub_date, platforms: {<os>-<arch>: {signature, url}}}
|
|
6
|
+
* plus a per-platform `sha256` extension (unknown keys are ignored by the
|
|
7
|
+
* plugin; it is the skip-list key of 0011 §3).
|
|
8
|
+
*/
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
|
|
11
|
+
import { tmpdir } from "node:os";
|
|
12
|
+
import { dirname, join } from "node:path";
|
|
13
|
+
import { parse as parseToml } from "smol-toml";
|
|
14
|
+
import { x as untar } from "tar";
|
|
15
|
+
import { loadTauriConfig } from "./config.js";
|
|
16
|
+
import { ui } from "./ui/index.js";
|
|
17
|
+
/** bundle/<kind> directory → the manifest platform's OS half. */
|
|
18
|
+
const KIND_OS = {
|
|
19
|
+
appimage: "linux",
|
|
20
|
+
macos: "darwin",
|
|
21
|
+
nsis: "windows",
|
|
22
|
+
};
|
|
23
|
+
/** Per bundle kind, what counts as an updater payload (its `.sig` sibling
|
|
24
|
+
* is found separately). macOS has no version in the name. */
|
|
25
|
+
const KIND_FILE = {
|
|
26
|
+
appimage: /\.appimage$/i,
|
|
27
|
+
macos: /\.app\.tar\.gz$/i,
|
|
28
|
+
nsis: /-setup\.(exe|nsis\.zip)$/i,
|
|
29
|
+
};
|
|
30
|
+
/** Arch spellings → the rust-target spelling the manifest platform keys use
|
|
31
|
+
* (`x86_64`/`aarch64`/`i686`): node `process.arch` names, rust-triple
|
|
32
|
+
* prefixes, and the `amd64`/`x64` tokens artifact filenames carry. */
|
|
33
|
+
const ARCH_CANON = {
|
|
34
|
+
x86_64: "x86_64",
|
|
35
|
+
amd64: "x86_64",
|
|
36
|
+
x64: "x86_64",
|
|
37
|
+
aarch64: "aarch64",
|
|
38
|
+
arm64: "aarch64",
|
|
39
|
+
i686: "i686",
|
|
40
|
+
i586: "i686",
|
|
41
|
+
x86: "i686",
|
|
42
|
+
ia32: "i686",
|
|
43
|
+
armv7: "armv7",
|
|
44
|
+
};
|
|
45
|
+
/** Rust-triple arch prefixes (the first `-`-separated segment). */
|
|
46
|
+
const TRIPLE_ARCHS = new Set(Object.keys(ARCH_CANON).concat(["riscv64gc"]));
|
|
47
|
+
export function canonArch(a) {
|
|
48
|
+
return ARCH_CANON[a.toLowerCase()] ?? a.toLowerCase();
|
|
49
|
+
}
|
|
50
|
+
/** `<product>_<version>_<arch>-setup.exe` etc. — the version embedded in an
|
|
51
|
+
* artifact's name, when it carries one (semver-shaped token). */
|
|
52
|
+
function nameVersion(file) {
|
|
53
|
+
return file.match(/(\d+\.\d+\.\d+(?:-[0-9A-Za-z][0-9A-Za-z.-]*)?)/)?.[1];
|
|
54
|
+
}
|
|
55
|
+
function nameArch(file) {
|
|
56
|
+
const m = file.match(/(?:^|[_-])(aarch64|arm64|x86_64|x64|amd64|i686|i586|x86)(?:[_.-]|$)/i);
|
|
57
|
+
return m ? canonArch(m[1]) : undefined;
|
|
58
|
+
}
|
|
59
|
+
/** Where tauri build writes bundles: `<target>/release/bundle` directly and
|
|
60
|
+
* per `--target <triple>` one level down — same root set as findArtifacts. */
|
|
61
|
+
function bundleRoots(tauriDir, env) {
|
|
62
|
+
const target = env.CARGO_TARGET_DIR ? env.CARGO_TARGET_DIR : join(tauriDir, "target");
|
|
63
|
+
const profile = "release";
|
|
64
|
+
const roots = [join(target, profile, "bundle")];
|
|
65
|
+
if (existsSync(target))
|
|
66
|
+
for (const e of readdirSync(target, { withFileTypes: true }))
|
|
67
|
+
if (e.isDirectory() && e.name !== "release" && e.name !== "debug")
|
|
68
|
+
roots.push(join(target, e.name, profile, "bundle"));
|
|
69
|
+
return roots;
|
|
70
|
+
}
|
|
71
|
+
/** The signed updater artifacts under every bundle root, keyed by platform.
|
|
72
|
+
* Arch comes from the `--target <triple>` dir name, then the filename, then
|
|
73
|
+
* the host — a host build of `aarch64.app.tar.gz` still lands darwin-aarch64. */
|
|
74
|
+
export function findUpdaterArtifacts(tauriDir, env = process.env) {
|
|
75
|
+
const byPlatform = new Map();
|
|
76
|
+
for (const root of bundleRoots(tauriDir, env)) {
|
|
77
|
+
if (!existsSync(root))
|
|
78
|
+
continue;
|
|
79
|
+
// <target>/<triple>/release/bundle roots carry the arch in the triple
|
|
80
|
+
// segment two levels up; the flat release/bundle root has none.
|
|
81
|
+
const triple = root.split(/[\\/]/).at(-3) ?? "";
|
|
82
|
+
const tripleArch = /^[a-z0-9_]+-/.test(triple) && TRIPLE_ARCHS.has(triple.split("-")[0])
|
|
83
|
+
? canonArch(triple.split("-")[0])
|
|
84
|
+
: "";
|
|
85
|
+
// A universal-apple-darwin build serves BOTH mac arches from one
|
|
86
|
+
// fat artifact: the triple dir segment, or a `_universal` arch
|
|
87
|
+
// token in the filename, marks it.
|
|
88
|
+
const tripleUniversal = triple.split("-")[0] === "universal";
|
|
89
|
+
for (const kind of readdirSync(root, { withFileTypes: true })) {
|
|
90
|
+
const os = KIND_OS[kind.name];
|
|
91
|
+
if (!kind.isDirectory() || !os)
|
|
92
|
+
continue;
|
|
93
|
+
const re = KIND_FILE[kind.name];
|
|
94
|
+
for (const file of readdirSync(join(root, kind.name))) {
|
|
95
|
+
if (!re.test(file))
|
|
96
|
+
continue;
|
|
97
|
+
const universal = os === "darwin" &&
|
|
98
|
+
(tripleUniversal || /(?:^|[_-])universal(?:[_.-]|$)/i.test(file));
|
|
99
|
+
const arch = tripleArch || nameArch(file) || canonArch(process.arch);
|
|
100
|
+
for (const a of universal ? ["aarch64", "x86_64"] : [arch]) {
|
|
101
|
+
const platform = `${os}-${a}`;
|
|
102
|
+
const artifact = {
|
|
103
|
+
path: join(root, kind.name, file),
|
|
104
|
+
file,
|
|
105
|
+
platform,
|
|
106
|
+
version: nameVersion(file),
|
|
107
|
+
};
|
|
108
|
+
const prev = byPlatform.get(platform);
|
|
109
|
+
// Two spellings of the same payload (.exe and .nsis.zip): the exe wins.
|
|
110
|
+
if (prev && !(prev.file.endsWith(".zip") && file.endsWith(".exe")))
|
|
111
|
+
throw new Error(`multiple updater artifacts for ${platform}: ${prev.file} and ${file} ` +
|
|
112
|
+
`(${join(root, kind.name)}) - clean the bundle dir and rebuild`);
|
|
113
|
+
byPlatform.set(platform, artifact);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return [...byPlatform.values()].sort((a, b) => a.platform.localeCompare(b.platform));
|
|
119
|
+
}
|
|
120
|
+
/** tauri.conf.json `version` must equal src-tauri/Cargo.toml `[package]
|
|
121
|
+
* version`: the updater compares the offer against the CONF value baked into
|
|
122
|
+
* the bundle, while `env!("CARGO_PKG_VERSION")` reads Cargo.toml — a drifted
|
|
123
|
+
* pair makes an app report the wrong version after update (0011 §1). Run for
|
|
124
|
+
* every build of an updater-enabled app. */
|
|
125
|
+
export function assertUpdaterVersionSync(tauriDir, confVersion) {
|
|
126
|
+
const cargoPath = join(tauriDir, "Cargo.toml");
|
|
127
|
+
if (!existsSync(cargoPath))
|
|
128
|
+
return; // not a tauri app after all
|
|
129
|
+
const doc = parseToml(readFileSync(cargoPath, "utf-8"));
|
|
130
|
+
const cargoVersion = doc.package?.version;
|
|
131
|
+
if (cargoVersion === undefined || cargoVersion === confVersion)
|
|
132
|
+
return;
|
|
133
|
+
throw new Error(`version mismatch: src-tauri/tauri.conf.json says "${confVersion}" but ` +
|
|
134
|
+
`src-tauri/Cargo.toml [package] says "${cargoVersion}". The updater ` +
|
|
135
|
+
"compares offers against tauri.conf.json; bump both or the app will " +
|
|
136
|
+
"report a stale version after an update (decision 0011, section 1).");
|
|
137
|
+
}
|
|
138
|
+
/** The manifest's artifact directory base: --base-url, or the app's own
|
|
139
|
+
* endpoint minus its manifest filename. Trailing-slash normalized. */
|
|
140
|
+
function resolveBaseUrl(opts, tconf) {
|
|
141
|
+
let base = opts.baseUrl?.trim();
|
|
142
|
+
if (!base) {
|
|
143
|
+
const endpoint = tconf.updater?.endpoints?.[0];
|
|
144
|
+
if (endpoint) {
|
|
145
|
+
base = endpoint.replace(/\/[^/]*$/, "");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!base)
|
|
149
|
+
throw new Error("no base url: pass --base-url https://host/dir (the directory the manifest " +
|
|
150
|
+
"and artifacts are uploaded to), or configure plugins.updater.endpoints");
|
|
151
|
+
let url;
|
|
152
|
+
try {
|
|
153
|
+
url = new URL(base);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
throw new Error(`--base-url is not a URL: ${base}`);
|
|
157
|
+
}
|
|
158
|
+
if (url.protocol !== "https:" && !opts.insecureDev)
|
|
159
|
+
throw new Error(`--base-url must be https (${base}); endpoints are https-only outside dev ` +
|
|
160
|
+
"(decision 0011, section 1). For a local dev server pass --insecure-dev.");
|
|
161
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
162
|
+
throw new Error(`--base-url must be https: got ${url.protocol}// (${base})`);
|
|
163
|
+
return base.replace(/\/+$/, "");
|
|
164
|
+
}
|
|
165
|
+
function sha256File(path) {
|
|
166
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
167
|
+
}
|
|
168
|
+
/** The CFBundleShortVersionString inside a `<name>.app.tar.gz` updater
|
|
169
|
+
* artifact: the filename carries no version, so without this check a stale
|
|
170
|
+
* bundle (validly signed) would be published under the new version - and
|
|
171
|
+
* Macs would keep being re-offered the old build. Only the matching
|
|
172
|
+
* Contents/Info.plist entry is extracted; tauri writes it as XML. */
|
|
173
|
+
export function appTarVersion(path, file) {
|
|
174
|
+
const tmp = mkdtempSync(join(tmpdir(), "pylair-uptar-"));
|
|
175
|
+
try {
|
|
176
|
+
const plists = [];
|
|
177
|
+
try {
|
|
178
|
+
untar({
|
|
179
|
+
file: path,
|
|
180
|
+
cwd: tmp,
|
|
181
|
+
sync: true,
|
|
182
|
+
filter: (p) => /(^|\/)Contents\/Info\.plist$/.test(p),
|
|
183
|
+
onentry: (e) => {
|
|
184
|
+
if (e.type === "File")
|
|
185
|
+
plists.push(e.path);
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
throw new Error(`${file}: not a readable .app.tar.gz (${e.message}) - ` +
|
|
191
|
+
"was it produced by tauri bundle?");
|
|
192
|
+
}
|
|
193
|
+
for (const p of plists) {
|
|
194
|
+
const m = readFileSync(join(tmp, p), "utf-8").match(/<key>\s*CFBundleShortVersionString\s*<\/key>\s*<string>\s*([^<]+?)\s*<\/string>/);
|
|
195
|
+
if (m)
|
|
196
|
+
return m[1].trim();
|
|
197
|
+
}
|
|
198
|
+
throw new Error(`${file}: no CFBundleShortVersionString in any Contents/Info.plist ` +
|
|
199
|
+
"inside the tarball - not a macOS app bundle?");
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/** Scan the bundle output for signed updater artifacts and write
|
|
206
|
+
* `latest[-<channel>].json`. Returns the manifest path. Fails loudly on: no
|
|
207
|
+
* artifacts, a missing `.sig`, artifacts whose embedded version disagrees
|
|
208
|
+
* with tauri.conf.json, or a non-https base url. */
|
|
209
|
+
export function updateManifest(opts) {
|
|
210
|
+
const tauriDir = join(opts.appDir, "src-tauri");
|
|
211
|
+
const env = opts.env ?? process.env;
|
|
212
|
+
const tconf = loadTauriConfig(opts.appDir);
|
|
213
|
+
const version = tconf.version;
|
|
214
|
+
if (typeof version !== "string" || !version)
|
|
215
|
+
throw new Error(`tauri.conf.json has no "version" - the manifest needs one`);
|
|
216
|
+
const artifacts = findUpdaterArtifacts(tauriDir, env);
|
|
217
|
+
if (!artifacts.length)
|
|
218
|
+
throw new Error(`no updater artifacts under ${tauriDir}/target/.../bundle - build signed ` +
|
|
219
|
+
"updater artifacts first (`pylair build --sign`, or bundle." +
|
|
220
|
+
"createUpdaterArtifacts + TAURI_SIGNING_PRIVATE_KEY)");
|
|
221
|
+
const base = resolveBaseUrl(opts, tconf);
|
|
222
|
+
const platforms = {};
|
|
223
|
+
for (const a of artifacts) {
|
|
224
|
+
// macOS tarballs carry no version in the name - read the bundled
|
|
225
|
+
// Info.plist instead; other platforms carry it in the filename.
|
|
226
|
+
const darwin = a.platform.startsWith("darwin-");
|
|
227
|
+
const actual = darwin ? appTarVersion(a.path, a.file) : a.version;
|
|
228
|
+
if (actual !== undefined && actual !== version)
|
|
229
|
+
throw new Error(`artifact version mismatch: ${a.file} ` +
|
|
230
|
+
(darwin
|
|
231
|
+
? `bundles CFBundleShortVersionString "${actual}" `
|
|
232
|
+
: `is ${actual} `) +
|
|
233
|
+
`but tauri.conf.json says ${version} - rebuild the version you're shipping`);
|
|
234
|
+
const sig = `${a.path}.sig`;
|
|
235
|
+
if (!existsSync(sig))
|
|
236
|
+
throw new Error(`unsigned updater artifact: ${a.file} has no ${a.file}.sig - ` +
|
|
237
|
+
"was the build signed? (createUpdaterArtifacts + TAURI_SIGNING_PRIVATE_KEY)");
|
|
238
|
+
const signature = readFileSync(sig, "utf-8").trim();
|
|
239
|
+
if (!signature)
|
|
240
|
+
throw new Error(`empty signature file: ${sig}`);
|
|
241
|
+
platforms[a.platform] = {
|
|
242
|
+
signature,
|
|
243
|
+
url: `${base}/${encodeURIComponent(a.file)}`,
|
|
244
|
+
sha256: sha256File(a.path),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const manifest = {
|
|
248
|
+
version,
|
|
249
|
+
...(opts.notes ? { notes: opts.notes } : {}),
|
|
250
|
+
pub_date: (opts.now ?? (() => new Date()))().toISOString(),
|
|
251
|
+
platforms,
|
|
252
|
+
};
|
|
253
|
+
const name = `latest${opts.channel ? `-${opts.channel}` : ""}.json`;
|
|
254
|
+
const out = opts.out ?? join(bundleRoots(tauriDir, env)[0], name);
|
|
255
|
+
mkdirSync(dirname(out), { recursive: true });
|
|
256
|
+
writeFileSync(out, JSON.stringify(manifest, null, 2) + "\n");
|
|
257
|
+
return { file: out, platforms: Object.keys(platforms) };
|
|
258
|
+
}
|
|
259
|
+
/** `pylair update manifest`. */
|
|
260
|
+
export function updateManifestCommand(opts) {
|
|
261
|
+
const { file, platforms } = updateManifest(opts);
|
|
262
|
+
ui.ok(`update manifest: wrote ${file}`);
|
|
263
|
+
ui.note(` platforms: ${platforms.join(", ")}`);
|
|
264
|
+
return 0;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,eAAe,EAAoB,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAqBnC,iEAAiE;AACjE,MAAM,OAAO,GAA2B;IACtC,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,SAAS;CAChB,CAAC;AAEF;6DAC6D;AAC7D,MAAM,SAAS,GAA2B;IACxC,QAAQ,EAAE,cAAc;IACxB,KAAK,EAAE,kBAA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CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,gCAAgC;AAChC,MAAM,UAAU,qBAAqB,CAAC,IAA2B;IAC/D,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACjD,EAAE,CAAC,EAAE,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IACxC,EAAE,CAAC,IAAI,CAAC,gBAAgB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** `pylair upgrade`: version alignment against the compatibility
|
|
2
|
+
* manifest. `--check` is the read-only mode (this PR implements nothing
|
|
3
|
+
* else): report the exact manifest edits and commands an upgrade takes,
|
|
4
|
+
* plus the manual notes for every release in between. Fully offline by
|
|
5
|
+
* default; `--online` additionally asks the npm registry whether the
|
|
6
|
+
* manifest in this CLI is itself behind.
|
|
7
|
+
*
|
|
8
|
+
* Exit codes: 0 up to date, 1 upgrade available, 2 mismatched or
|
|
9
|
+
* unresolvable. */
|
|
10
|
+
import { type CompatRelease } from "./compat.js";
|
|
11
|
+
import { type AppVersions } from "./versions.js";
|
|
12
|
+
export interface UpgradeCheckOptions {
|
|
13
|
+
appDir: string;
|
|
14
|
+
online?: boolean;
|
|
15
|
+
/** Test seam: registry probe. Returns the newest published npm version
|
|
16
|
+
* (the `next` dist-tag), or null when unreachable. */
|
|
17
|
+
fetchLatest?: () => Promise<string | null>;
|
|
18
|
+
}
|
|
19
|
+
/** The exact before/after edit for one component, or null when the
|
|
20
|
+
* component is absent or already at the target version. */
|
|
21
|
+
export declare function editLine(v: AppVersions, key: keyof AppVersions, target: CompatRelease): {
|
|
22
|
+
file: string;
|
|
23
|
+
from: string;
|
|
24
|
+
to: string;
|
|
25
|
+
} | null;
|
|
26
|
+
interface Plan {
|
|
27
|
+
edits: {
|
|
28
|
+
file: string;
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
}[];
|
|
32
|
+
commands: string[];
|
|
33
|
+
notes: {
|
|
34
|
+
release: string;
|
|
35
|
+
notes: string[];
|
|
36
|
+
}[];
|
|
37
|
+
}
|
|
38
|
+
export declare function upgradePlan(v: AppVersions, from: CompatRelease): Plan;
|
|
39
|
+
export declare function upgradeCheck(opts: UpgradeCheckOptions): Promise<number>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;mBAQmB;AAEnB,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAA6C,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5F,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;0DACsD;IACtD,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC5C;AAiBD;2DAC2D;AAC3D,wBAAgB,QAAQ,CACtB,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,WAAW,EACtB,MAAM,EAAE,aAAa,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA0BnD;AAED,UAAU,IAAI;IACZ,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC/C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAkBrE;AAmBD,wBAAsB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgF7E"}
|
package/dist/upgrade.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/** `pylair upgrade`: version alignment against the compatibility
|
|
2
|
+
* manifest. `--check` is the read-only mode (this PR implements nothing
|
|
3
|
+
* else): report the exact manifest edits and commands an upgrade takes,
|
|
4
|
+
* plus the manual notes for every release in between. Fully offline by
|
|
5
|
+
* default; `--online` additionally asks the npm registry whether the
|
|
6
|
+
* manifest in this CLI is itself behind.
|
|
7
|
+
*
|
|
8
|
+
* Exit codes: 0 up to date, 1 upgrade available, 2 mismatched or
|
|
9
|
+
* unresolvable. */
|
|
10
|
+
import { currentRelease, releasesAfter } from "./compat.js";
|
|
11
|
+
import { judge, releaseVersion, resolveAppVersions } from "./versions.js";
|
|
12
|
+
import { ui } from "./ui/index.js";
|
|
13
|
+
const COMPONENT_LABELS = {
|
|
14
|
+
client: "@pylair/client",
|
|
15
|
+
cli: "@pylair/cli",
|
|
16
|
+
crate: "tauri-plugin-pylair",
|
|
17
|
+
pylair: "pylair",
|
|
18
|
+
};
|
|
19
|
+
function setLine(v, r) {
|
|
20
|
+
const parts = [];
|
|
21
|
+
for (const key of ["client", "cli", "crate", "pylair"]) {
|
|
22
|
+
if (v[key].status !== "absent")
|
|
23
|
+
parts.push(`${COMPONENT_LABELS[key]} ${releaseVersion(r, key)}`);
|
|
24
|
+
}
|
|
25
|
+
return parts.join(", ");
|
|
26
|
+
}
|
|
27
|
+
/** The exact before/after edit for one component, or null when the
|
|
28
|
+
* component is absent or already at the target version. */
|
|
29
|
+
export function editLine(v, key, target) {
|
|
30
|
+
const c = v[key];
|
|
31
|
+
if (c.status !== "resolved" || !c.resolved)
|
|
32
|
+
return null;
|
|
33
|
+
const want = releaseVersion(target, key);
|
|
34
|
+
if (c.resolved === want)
|
|
35
|
+
return null;
|
|
36
|
+
if (key === "client" || key === "cli") {
|
|
37
|
+
return {
|
|
38
|
+
file: "package.json",
|
|
39
|
+
from: `"${COMPONENT_LABELS[key]}": "${c.resolved}"`,
|
|
40
|
+
to: `"${COMPONENT_LABELS[key]}": "${want}"`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (key === "crate") {
|
|
44
|
+
// String and table forms both pin with `=`.
|
|
45
|
+
const strip = (s) => s.replace(/^[^0-9]*/, "");
|
|
46
|
+
return {
|
|
47
|
+
file: "src-tauri/Cargo.toml",
|
|
48
|
+
from: `version "=${strip(c.resolved)}"`,
|
|
49
|
+
to: `version "=${want}"`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
file: "pyproject.toml",
|
|
54
|
+
from: `"pylair==${c.resolved}"`,
|
|
55
|
+
to: `"pylair==${want}"`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export function upgradePlan(v, from) {
|
|
59
|
+
const target = currentRelease();
|
|
60
|
+
const edits = [];
|
|
61
|
+
const commands = [];
|
|
62
|
+
for (const key of ["client", "cli", "crate", "pylair"]) {
|
|
63
|
+
const e = editLine(v, key, target);
|
|
64
|
+
if (e)
|
|
65
|
+
edits.push(e);
|
|
66
|
+
}
|
|
67
|
+
const npmChanged = edits.some((e) => e.file === "package.json");
|
|
68
|
+
const crateChanged = edits.some((e) => e.file === "src-tauri/Cargo.toml");
|
|
69
|
+
const pyChanged = edits.some((e) => e.file === "pyproject.toml");
|
|
70
|
+
if (npmChanged)
|
|
71
|
+
commands.push("npm install # or pnpm install, matching your lockfile");
|
|
72
|
+
if (crateChanged)
|
|
73
|
+
commands.push("cargo update -p tauri-plugin-pylair # in src-tauri");
|
|
74
|
+
if (pyChanged)
|
|
75
|
+
commands.push("uv lock # then uv sync");
|
|
76
|
+
const notes = releasesAfter(from.npm)
|
|
77
|
+
.filter((r) => r.notes.length > 0)
|
|
78
|
+
.map((r) => ({ release: r.npm, notes: r.notes }));
|
|
79
|
+
return { edits, commands, notes };
|
|
80
|
+
}
|
|
81
|
+
/** The default registry probe: npm's dist-tags for @pylair/cli. Publishes
|
|
82
|
+
* go under `--tag next` (AGENTS.md release train), so `next` is the tag
|
|
83
|
+
* that tracks the newest release candidate. */
|
|
84
|
+
async function fetchLatestNpm() {
|
|
85
|
+
try {
|
|
86
|
+
const r = await fetch("https://registry.npmjs.org/@pylair%2fcli", {
|
|
87
|
+
signal: AbortSignal.timeout(5000),
|
|
88
|
+
headers: { accept: "application/json" },
|
|
89
|
+
});
|
|
90
|
+
if (!r.ok)
|
|
91
|
+
return null;
|
|
92
|
+
const j = (await r.json());
|
|
93
|
+
return j["dist-tags"]?.next ?? j["dist-tags"]?.latest ?? null;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export async function upgradeCheck(opts) {
|
|
100
|
+
const v = resolveAppVersions(opts.appDir);
|
|
101
|
+
ui.header("pylair upgrade --check", [["app", opts.appDir]], []);
|
|
102
|
+
if (!opts.online)
|
|
103
|
+
ui.note("offline: comparing against the manifest bundled in this CLI");
|
|
104
|
+
const verdict = judge(v);
|
|
105
|
+
if (verdict.kind === "empty") {
|
|
106
|
+
ui.error("no Pylair components found - is this a pylair app? (need package.json / src-tauri / pyproject.toml)");
|
|
107
|
+
return 2;
|
|
108
|
+
}
|
|
109
|
+
if (verdict.kind === "unresolved") {
|
|
110
|
+
ui.line("cannot judge versions yet - unresolved components:");
|
|
111
|
+
for (const key of ["client", "cli", "crate", "pylair"]) {
|
|
112
|
+
const c = v[key];
|
|
113
|
+
if (c.status === "unresolved")
|
|
114
|
+
ui.line(` ${COMPONENT_LABELS[key]}: declared ${c.declared} - ${c.detail}`);
|
|
115
|
+
if (c.status === "local")
|
|
116
|
+
ui.line(` ${COMPONENT_LABELS[key]}: ${c.detail} (${c.declared})`);
|
|
117
|
+
}
|
|
118
|
+
ui.line("");
|
|
119
|
+
ui.line("resolve first (install / build / uv sync), or pin registry versions; then re-run.");
|
|
120
|
+
return 2;
|
|
121
|
+
}
|
|
122
|
+
if (verdict.kind === "mismatched") {
|
|
123
|
+
ui.line(`mismatched set - not any single release's combination:`);
|
|
124
|
+
ui.line(` most of the app agrees with npm-v${verdict.best.npm}'s set, but:`);
|
|
125
|
+
for (const o of verdict.offenders)
|
|
126
|
+
ui.line(` ${o.component} ${o.have} is out of step - ${o.want} pairs with the rest`);
|
|
127
|
+
ui.line("");
|
|
128
|
+
ui.line("align every component to one release set first; `pylair doctor` shows the full table.");
|
|
129
|
+
return 2;
|
|
130
|
+
}
|
|
131
|
+
const release = verdict.release;
|
|
132
|
+
const target = currentRelease();
|
|
133
|
+
ui.line(`app set: ${setLine(v, release)} (npm-v${release.npm})`);
|
|
134
|
+
if (release.npm === target.npm) {
|
|
135
|
+
ui.line(`latest set: the same - this is the newest set this CLI knows (${target.date})`);
|
|
136
|
+
if (opts.online)
|
|
137
|
+
await onlineNote(opts, target);
|
|
138
|
+
ui.summary("ok", "up to date");
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
ui.line(`latest set: npm ${target.npm}, crate ${target.crate}, pylair ${target.pylair} (npm-v${target.npm}, ${target.date})`);
|
|
142
|
+
ui.line("");
|
|
143
|
+
const plan = upgradePlan(v, release);
|
|
144
|
+
if (plan.edits.length > 0) {
|
|
145
|
+
ui.line("edits:");
|
|
146
|
+
let file = "";
|
|
147
|
+
for (const e of plan.edits) {
|
|
148
|
+
if (e.file !== file) {
|
|
149
|
+
ui.line(` ${e.file}:`);
|
|
150
|
+
file = e.file;
|
|
151
|
+
}
|
|
152
|
+
ui.line(` - ${e.from}`);
|
|
153
|
+
ui.line(` + ${e.to}`);
|
|
154
|
+
}
|
|
155
|
+
ui.line("");
|
|
156
|
+
ui.line("then re-resolve the lockfiles:");
|
|
157
|
+
for (const c of plan.commands)
|
|
158
|
+
ui.line(` ${c}`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
ui.line("no manifest edits needed - only the lockfiles re-resolve:");
|
|
162
|
+
for (const c of plan.commands)
|
|
163
|
+
ui.line(` ${c}`);
|
|
164
|
+
}
|
|
165
|
+
if (plan.notes.length > 0) {
|
|
166
|
+
ui.line("");
|
|
167
|
+
ui.line("manual upgrade notes for the releases in between:");
|
|
168
|
+
for (const n of plan.notes) {
|
|
169
|
+
ui.line(` npm-v${n.release}:`);
|
|
170
|
+
for (const note of n.notes)
|
|
171
|
+
ui.line(` - ${note}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (opts.online)
|
|
175
|
+
await onlineNote(opts, target);
|
|
176
|
+
ui.line("");
|
|
177
|
+
ui.summary("warn", `upgrade available: npm-v${release.npm} -> npm-v${target.npm} (nothing was edited)`);
|
|
178
|
+
return 1;
|
|
179
|
+
}
|
|
180
|
+
async function onlineNote(opts, target) {
|
|
181
|
+
const probe = opts.fetchLatest ?? fetchLatestNpm;
|
|
182
|
+
const latest = await probe();
|
|
183
|
+
ui.line("");
|
|
184
|
+
if (!latest) {
|
|
185
|
+
ui.note("--online: registry unreachable; offline verdict stands");
|
|
186
|
+
}
|
|
187
|
+
else if (latest !== target.npm) {
|
|
188
|
+
ui.line(`--online: npm has @pylair/cli ${latest} but this CLI's manifest stops at ${target.npm}.` +
|
|
189
|
+
` Update the CLI first (npm install -D @pylair/cli@${latest}), then re-run - its manifest knows the newer set.`);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
ui.note(`--online: registry agrees, ${latest} is the newest published CLI`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;mBAQmB;AAEnB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAoB,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAUnC,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE,gBAAgB;IACxB,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,SAAS,OAAO,CAAC,CAAc,EAAE,CAAgB;IAC/C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAU,EAAE,CAAC;QAChE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;2DAC2D;AAC3D,MAAM,UAAU,QAAQ,CACtB,CAAc,EACd,GAAsB,EACtB,MAAqB;IAErB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACjB,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,I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AC,IAAI,CAAC,wDAAwD,CAAC,CAAC;IACpE,CAAC;SAAM,IAAI,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC;QACjC,EAAE,CAAC,IAAI,CACL,iCAAiC,MAAM,qCAAqC,MAAM,CAAC,GAAG,GAAG;YACvF,qDAAqD,MAAM,oDAAoD,CAClH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,IAAI,CAAC,8BAA8B,MAAM,8BAA8B,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Read the Pylair versions an app actually uses: the requirement as
|
|
2
|
+
* declared in each ecosystem's manifest plus the exact version resolved
|
|
3
|
+
* in its lockfile. Never guesses - a missing lockfile or entry is
|
|
4
|
+
* "unresolved", a file:/path dependency is "local", an undeclared
|
|
5
|
+
* component is "absent". Layout is identical for bridge and wrap apps
|
|
6
|
+
* (package.json, src-tauri/Cargo.toml, pyproject.toml), so one probe
|
|
7
|
+
* covers both. */
|
|
8
|
+
import { type CompatRelease } from "./compat.js";
|
|
9
|
+
export type ResolveStatus = "resolved" | "unresolved" | "local" | "absent";
|
|
10
|
+
export interface ComponentVersion {
|
|
11
|
+
/** The requirement exactly as declared, null when not declared. */
|
|
12
|
+
declared: string | null;
|
|
13
|
+
/** The exact lockfile-resolved version, null when unavailable. */
|
|
14
|
+
resolved: string | null;
|
|
15
|
+
status: ResolveStatus;
|
|
16
|
+
/** One-line explanation when not resolved. */
|
|
17
|
+
detail?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AppVersions {
|
|
20
|
+
/** @pylair/client (npm). */
|
|
21
|
+
client: ComponentVersion;
|
|
22
|
+
/** @pylair/cli (npm). */
|
|
23
|
+
cli: ComponentVersion;
|
|
24
|
+
/** tauri-plugin-pylair (crates.io). */
|
|
25
|
+
crate: ComponentVersion;
|
|
26
|
+
/** pylair (PyPI). */
|
|
27
|
+
pylair: ComponentVersion;
|
|
28
|
+
}
|
|
29
|
+
/** Resolve every component. Pure file reading - no process spawns, fully
|
|
30
|
+
* offline. */
|
|
31
|
+
export declare function resolveAppVersions(appDir: string): AppVersions;
|
|
32
|
+
export type Verdict = {
|
|
33
|
+
kind: "compatible";
|
|
34
|
+
release: CompatRelease;
|
|
35
|
+
} | {
|
|
36
|
+
kind: "mismatched";
|
|
37
|
+
/** The release most of the set agrees with (newest on ties). */
|
|
38
|
+
best: CompatRelease;
|
|
39
|
+
offenders: {
|
|
40
|
+
component: string;
|
|
41
|
+
have: string;
|
|
42
|
+
want: string;
|
|
43
|
+
}[];
|
|
44
|
+
} | {
|
|
45
|
+
kind: "unresolved";
|
|
46
|
+
components: string[];
|
|
47
|
+
} | {
|
|
48
|
+
kind: "empty";
|
|
49
|
+
};
|
|
50
|
+
/** The version of `key` in a release tuple. client/cli share npm. */
|
|
51
|
+
export declare function releaseVersion(r: CompatRelease, key: keyof AppVersions): string;
|
|
52
|
+
/** Judge the resolved set against the manifest. A set is compatible when
|
|
53
|
+
* every component with a resolved version matches one release's tuple -
|
|
54
|
+
* subsets are fine (a wrap app may not use the client). Anything
|
|
55
|
+
* unresolved makes the whole verdict unjudgable: a wrong guess is worse
|
|
56
|
+
* than no guess. */
|
|
57
|
+
export declare function judge(v: AppVersions): Verdict;
|
|
58
|
+
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":"AAAA;;;;;;kBAMkB;AAKlB,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3E,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA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